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
sequence | docstring
stringlengths 3
16k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 105
339
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.insertByLeftShift | Object insertByLeftShift(
int ix,
Object new1)
{
Object old1 = leftMostKey();
leftShift(ix);
_nodeKey[ix] = new1;
if (midPoint() > rightMostIndex())
_nodeKey[midPoint()] = rightMostKey();
return old1;
} | java | Object insertByLeftShift(
int ix,
Object new1)
{
Object old1 = leftMostKey();
leftShift(ix);
_nodeKey[ix] = new1;
if (midPoint() > rightMostIndex())
_nodeKey[midPoint()] = rightMostKey();
return old1;
} | [
"Object",
"insertByLeftShift",
"(",
"int",
"ix",
",",
"Object",
"new1",
")",
"{",
"Object",
"old1",
"=",
"leftMostKey",
"(",
")",
";",
"leftShift",
"(",
"ix",
")",
";",
"_nodeKey",
"[",
"ix",
"]",
"=",
"new1",
";",
"if",
"(",
"midPoint",
"(",
")",
">",
"rightMostIndex",
"(",
")",
")",
"_nodeKey",
"[",
"midPoint",
"(",
")",
"]",
"=",
"rightMostKey",
"(",
")",
";",
"return",
"old1",
";",
"}"
] | Insert a new key by overlaying the left-most key, shifting
other keys left and inserting the new key at the appropriate
insert point.
@param ix The insert point within the node.
@param new1 The new key to be inserted.
@return the key that used to be the left-most key in the node. | [
"Insert",
"a",
"new",
"key",
"by",
"overlaying",
"the",
"left",
"-",
"most",
"key",
"shifting",
"other",
"keys",
"left",
"and",
"inserting",
"the",
"new",
"key",
"at",
"the",
"appropriate",
"insert",
"point",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L972-L982 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.leftShift | private void leftShift(
int ix)
{
for (int j = 0; j < ix; j++)
_nodeKey[j] = _nodeKey[j+1];
} | java | private void leftShift(
int ix)
{
for (int j = 0; j < ix; j++)
_nodeKey[j] = _nodeKey[j+1];
} | [
"private",
"void",
"leftShift",
"(",
"int",
"ix",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"ix",
";",
"j",
"++",
")",
"_nodeKey",
"[",
"j",
"]",
"=",
"_nodeKey",
"[",
"j",
"+",
"1",
"]",
";",
"}"
] | Open up a slot in a node by shifting the keys left.
<p>We are inserting a new key into a node that is not currently
full. There is at least one vacant slot. We open up the correct
slot for the new key by shifting all other keys left.</p> | [
"Open",
"up",
"a",
"slot",
"in",
"a",
"node",
"by",
"shifting",
"the",
"keys",
"left",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L1004-L1009 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.insertByRightShift | Object insertByRightShift(
int ix,
Object new1)
{
Object old1 = null;
if (isFull())
{
old1 = rightMostKey();
rightMove(ix+1);
_nodeKey[ix+1] = new1;
}
else
{
rightShift(ix+1);
_nodeKey[ix+1] = new1;
_population++;
if (midPoint() > rightMostIndex())
_nodeKey[midPoint()] = rightMostKey();
}
return old1;
} | java | Object insertByRightShift(
int ix,
Object new1)
{
Object old1 = null;
if (isFull())
{
old1 = rightMostKey();
rightMove(ix+1);
_nodeKey[ix+1] = new1;
}
else
{
rightShift(ix+1);
_nodeKey[ix+1] = new1;
_population++;
if (midPoint() > rightMostIndex())
_nodeKey[midPoint()] = rightMostKey();
}
return old1;
} | [
"Object",
"insertByRightShift",
"(",
"int",
"ix",
",",
"Object",
"new1",
")",
"{",
"Object",
"old1",
"=",
"null",
";",
"if",
"(",
"isFull",
"(",
")",
")",
"{",
"old1",
"=",
"rightMostKey",
"(",
")",
";",
"rightMove",
"(",
"ix",
"+",
"1",
")",
";",
"_nodeKey",
"[",
"ix",
"+",
"1",
"]",
"=",
"new1",
";",
"}",
"else",
"{",
"rightShift",
"(",
"ix",
"+",
"1",
")",
";",
"_nodeKey",
"[",
"ix",
"+",
"1",
"]",
"=",
"new1",
";",
"_population",
"++",
";",
"if",
"(",
"midPoint",
"(",
")",
">",
"rightMostIndex",
"(",
")",
")",
"_nodeKey",
"[",
"midPoint",
"(",
")",
"]",
"=",
"rightMostKey",
"(",
")",
";",
"}",
"return",
"old1",
";",
"}"
] | Insert a new key by shifting keys right.
<p>Insert a new key by overlaying the right-most key, shifting
other keys right and inserting the new key at the appropriate
insert point.</p>
@param ix The insert point within the node.
@param new1 The new key to be inserted.
@return the key that used to be the right-most key in the node. | [
"Insert",
"a",
"new",
"key",
"by",
"shifting",
"keys",
"right",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L1022-L1042 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.addRightMostKey | Object addRightMostKey(
Object new1)
{
Object old1 = null;
if (isFull()) /* Node is currently full */
{ /* We will overlay right-most key */
old1 = rightMostKey();
_nodeKey[rightMostIndex()] = new1;
}
else
{
_population++;
_nodeKey[rightMostIndex()] = new1;
if (midPoint() > rightMostIndex())
_nodeKey[midPoint()] = rightMostKey();
}
return old1;
} | java | Object addRightMostKey(
Object new1)
{
Object old1 = null;
if (isFull()) /* Node is currently full */
{ /* We will overlay right-most key */
old1 = rightMostKey();
_nodeKey[rightMostIndex()] = new1;
}
else
{
_population++;
_nodeKey[rightMostIndex()] = new1;
if (midPoint() > rightMostIndex())
_nodeKey[midPoint()] = rightMostKey();
}
return old1;
} | [
"Object",
"addRightMostKey",
"(",
"Object",
"new1",
")",
"{",
"Object",
"old1",
"=",
"null",
";",
"if",
"(",
"isFull",
"(",
")",
")",
"/* Node is currently full */",
"{",
"/* We will overlay right-most key */",
"old1",
"=",
"rightMostKey",
"(",
")",
";",
"_nodeKey",
"[",
"rightMostIndex",
"(",
")",
"]",
"=",
"new1",
";",
"}",
"else",
"{",
"_population",
"++",
";",
"_nodeKey",
"[",
"rightMostIndex",
"(",
")",
"]",
"=",
"new1",
";",
"if",
"(",
"midPoint",
"(",
")",
">",
"rightMostIndex",
"(",
")",
")",
"_nodeKey",
"[",
"midPoint",
"(",
")",
"]",
"=",
"rightMostKey",
"(",
")",
";",
"}",
"return",
"old1",
";",
"}"
] | Add the right-most key to the node.
<p>Insert a new key in the right-most slot in the node.
If this causes the right-most key to be overlayed
it is returned to the caller. Otherwise null is returned to the
caller.</p>
@param new1 The new key to be inserted.
@return the key that used to be the right-most key in the node
iff it was overlayed in the process. | [
"Add",
"the",
"right",
"-",
"most",
"key",
"to",
"the",
"node",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L1092-L1111 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.fillFromRight | void fillFromRight()
{
int gapWid = width() - population();
int gidx = population();
GBSNode p = rightChild();
for (int j = 0; j < gapWid; j++)
_nodeKey[j+gidx] = p._nodeKey[j];
int delta = gapWid;
if (p._population < delta)
delta = p._population;
_population += delta;
p._population -= delta;
for (int j = 0; j < gidx; j++)
p._nodeKey[j] = p._nodeKey[j+gapWid];
} | java | void fillFromRight()
{
int gapWid = width() - population();
int gidx = population();
GBSNode p = rightChild();
for (int j = 0; j < gapWid; j++)
_nodeKey[j+gidx] = p._nodeKey[j];
int delta = gapWid;
if (p._population < delta)
delta = p._population;
_population += delta;
p._population -= delta;
for (int j = 0; j < gidx; j++)
p._nodeKey[j] = p._nodeKey[j+gapWid];
} | [
"void",
"fillFromRight",
"(",
")",
"{",
"int",
"gapWid",
"=",
"width",
"(",
")",
"-",
"population",
"(",
")",
";",
"int",
"gidx",
"=",
"population",
"(",
")",
";",
"GBSNode",
"p",
"=",
"rightChild",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"gapWid",
";",
"j",
"++",
")",
"_nodeKey",
"[",
"j",
"+",
"gidx",
"]",
"=",
"p",
".",
"_nodeKey",
"[",
"j",
"]",
";",
"int",
"delta",
"=",
"gapWid",
";",
"if",
"(",
"p",
".",
"_population",
"<",
"delta",
")",
"delta",
"=",
"p",
".",
"_population",
";",
"_population",
"+=",
"delta",
";",
"p",
".",
"_population",
"-=",
"delta",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"gidx",
";",
"j",
"++",
")",
"p",
".",
"_nodeKey",
"[",
"j",
"]",
"=",
"p",
".",
"_nodeKey",
"[",
"j",
"+",
"gapWid",
"]",
";",
"}"
] | Fill a node with new keys from the right side.
<p>A node that is not completely full has acquired a right child.
Use the left keys of the right child to fill the node as much
as possible, limited by the free space in the current node and
the population of the right child.</p> | [
"Fill",
"a",
"node",
"with",
"new",
"keys",
"from",
"the",
"right",
"side",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L1179-L1193 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.rightMostChild | GBSNode rightMostChild()
{
GBSNode q = this;
GBSNode p = rightChild();
while (p != null)
{
q = p;
p = p.rightChild();
}
return q;
} | java | GBSNode rightMostChild()
{
GBSNode q = this;
GBSNode p = rightChild();
while (p != null)
{
q = p;
p = p.rightChild();
}
return q;
} | [
"GBSNode",
"rightMostChild",
"(",
")",
"{",
"GBSNode",
"q",
"=",
"this",
";",
"GBSNode",
"p",
"=",
"rightChild",
"(",
")",
";",
"while",
"(",
"p",
"!=",
"null",
")",
"{",
"q",
"=",
"p",
";",
"p",
"=",
"p",
".",
"rightChild",
"(",
")",
";",
"}",
"return",
"q",
";",
"}"
] | Find the right-most child of a node by following the paths of
all of the right-most children all the way to the bottom of
the tree. | [
"Find",
"the",
"right",
"-",
"most",
"child",
"of",
"a",
"node",
"by",
"following",
"the",
"paths",
"of",
"all",
"of",
"the",
"right",
"-",
"most",
"children",
"all",
"the",
"way",
"to",
"the",
"bottom",
"of",
"the",
"tree",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L1210-L1220 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.rightShift | private void rightShift(
int ix)
{
for (int j = rightMostIndex(); j >= ix; j--)
_nodeKey[j+1] = _nodeKey[j];
} | java | private void rightShift(
int ix)
{
for (int j = rightMostIndex(); j >= ix; j--)
_nodeKey[j+1] = _nodeKey[j];
} | [
"private",
"void",
"rightShift",
"(",
"int",
"ix",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"rightMostIndex",
"(",
")",
";",
"j",
">=",
"ix",
";",
"j",
"--",
")",
"_nodeKey",
"[",
"j",
"+",
"1",
"]",
"=",
"_nodeKey",
"[",
"j",
"]",
";",
"}"
] | Open up a slot for a new key by shifting keys right to make room.
<p>We are inserting a new key into a node that is not currently
full. There is at least one vacant slot. We open up the correct
slot for the new key by shifting all other keys right.</p> | [
"Open",
"up",
"a",
"slot",
"for",
"a",
"new",
"key",
"by",
"shifting",
"keys",
"right",
"to",
"make",
"room",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L1229-L1234 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.rightMove | private void rightMove(
int ix)
{
for (int j = rightMostIndex()-1; j >= ix; j--)
_nodeKey[j+1] = _nodeKey[j];
} | java | private void rightMove(
int ix)
{
for (int j = rightMostIndex()-1; j >= ix; j--)
_nodeKey[j+1] = _nodeKey[j];
} | [
"private",
"void",
"rightMove",
"(",
"int",
"ix",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"rightMostIndex",
"(",
")",
"-",
"1",
";",
"j",
">=",
"ix",
";",
"j",
"--",
")",
"_nodeKey",
"[",
"j",
"+",
"1",
"]",
"=",
"_nodeKey",
"[",
"j",
"]",
";",
"}"
] | Open up a slot for a new key by shifting keys right to make room
and overlaying the right-most key.
<p>We are inserting a new key into a node that is currently full.
We open up the correct slot for the new key by shifting all other
keys right, overlaying the right-most key.</p> | [
"Open",
"up",
"a",
"slot",
"for",
"a",
"new",
"key",
"by",
"shifting",
"keys",
"right",
"to",
"make",
"room",
"and",
"overlaying",
"the",
"right",
"-",
"most",
"key",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L1244-L1249 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.overlayLeftShift | void overlayLeftShift(
int ix)
{
for (int j = ix; j < rightMostIndex(); j++)
_nodeKey[j] = _nodeKey[j+1];
} | java | void overlayLeftShift(
int ix)
{
for (int j = ix; j < rightMostIndex(); j++)
_nodeKey[j] = _nodeKey[j+1];
} | [
"void",
"overlayLeftShift",
"(",
"int",
"ix",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"ix",
";",
"j",
"<",
"rightMostIndex",
"(",
")",
";",
"j",
"++",
")",
"_nodeKey",
"[",
"j",
"]",
"=",
"_nodeKey",
"[",
"j",
"+",
"1",
"]",
";",
"}"
] | Overlay a key to be deleted by moving keys left.
<p>We are removing a key from a node. We shift all of the keys
left to overlay the slot of the key to be deleted and open up the
slot occupied by the right-most key in the node.</p> | [
"Overlay",
"a",
"key",
"to",
"be",
"deleted",
"by",
"moving",
"keys",
"left",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L1258-L1263 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.overlayRightShift | private void overlayRightShift(
int ix)
{
for (int j = ix; j > 0; j--)
_nodeKey[j] = _nodeKey[j-1];
} | java | private void overlayRightShift(
int ix)
{
for (int j = ix; j > 0; j--)
_nodeKey[j] = _nodeKey[j-1];
} | [
"private",
"void",
"overlayRightShift",
"(",
"int",
"ix",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"ix",
";",
"j",
">",
"0",
";",
"j",
"--",
")",
"_nodeKey",
"[",
"j",
"]",
"=",
"_nodeKey",
"[",
"j",
"-",
"1",
"]",
";",
"}"
] | Overlay a key to be deleted by moving keys right.
<p>We are removing a key from a node. We shift all of the keys
right to overlay the slot of the key to be deleted and open up the
slot occupied by the left most key in the node.</p> | [
"Overlay",
"a",
"key",
"to",
"be",
"deleted",
"by",
"moving",
"keys",
"right",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L1272-L1277 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.lowerPredecessor | GBSNode lowerPredecessor(
NodeStack stack)
{
GBSNode r = leftChild();
GBSNode lastr = r;
if (r != null)
stack.push(NodeStack.PROCESS_CURRENT, this);
while (r != null) /* Find right-most child of left child */
{
if (r.rightChild() != null)
stack.push(NodeStack.DONE_VISITS, r);
lastr = r;
r = r.rightChild();
}
return lastr;
} | java | GBSNode lowerPredecessor(
NodeStack stack)
{
GBSNode r = leftChild();
GBSNode lastr = r;
if (r != null)
stack.push(NodeStack.PROCESS_CURRENT, this);
while (r != null) /* Find right-most child of left child */
{
if (r.rightChild() != null)
stack.push(NodeStack.DONE_VISITS, r);
lastr = r;
r = r.rightChild();
}
return lastr;
} | [
"GBSNode",
"lowerPredecessor",
"(",
"NodeStack",
"stack",
")",
"{",
"GBSNode",
"r",
"=",
"leftChild",
"(",
")",
";",
"GBSNode",
"lastr",
"=",
"r",
";",
"if",
"(",
"r",
"!=",
"null",
")",
"stack",
".",
"push",
"(",
"NodeStack",
".",
"PROCESS_CURRENT",
",",
"this",
")",
";",
"while",
"(",
"r",
"!=",
"null",
")",
"/* Find right-most child of left child */",
"{",
"if",
"(",
"r",
".",
"rightChild",
"(",
")",
"!=",
"null",
")",
"stack",
".",
"push",
"(",
"NodeStack",
".",
"DONE_VISITS",
",",
"r",
")",
";",
"lastr",
"=",
"r",
";",
"r",
"=",
"r",
".",
"rightChild",
"(",
")",
";",
"}",
"return",
"lastr",
";",
"}"
] | Find the lower predecessor of this node.
<p>The lower predecessor is the right-most child of the left child.
This is the prior node in order that is also below this node.</p>
@param stack The stack that is used to remember the traversal path.
@return The lower predecessor node. | [
"Find",
"the",
"lower",
"predecessor",
"of",
"this",
"node",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L1289-L1304 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.validate | public boolean validate()
{
boolean correct = true;
if (population() > 1)
{
java.util.Comparator comp = index().insertComparator();
int xcc = 0;
for (int i = 0; i < population()-1; i++)
{
xcc = comp.compare(_nodeKey[i], _nodeKey[i+1]);
if ( !(xcc < 0) )
{
System.out.println("Entry " + i + " not less than entry " + i+1);
correct = false;
}
}
}
return correct;
} | java | public boolean validate()
{
boolean correct = true;
if (population() > 1)
{
java.util.Comparator comp = index().insertComparator();
int xcc = 0;
for (int i = 0; i < population()-1; i++)
{
xcc = comp.compare(_nodeKey[i], _nodeKey[i+1]);
if ( !(xcc < 0) )
{
System.out.println("Entry " + i + " not less than entry " + i+1);
correct = false;
}
}
}
return correct;
} | [
"public",
"boolean",
"validate",
"(",
")",
"{",
"boolean",
"correct",
"=",
"true",
";",
"if",
"(",
"population",
"(",
")",
">",
"1",
")",
"{",
"java",
".",
"util",
".",
"Comparator",
"comp",
"=",
"index",
"(",
")",
".",
"insertComparator",
"(",
")",
";",
"int",
"xcc",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"population",
"(",
")",
"-",
"1",
";",
"i",
"++",
")",
"{",
"xcc",
"=",
"comp",
".",
"compare",
"(",
"_nodeKey",
"[",
"i",
"]",
",",
"_nodeKey",
"[",
"i",
"+",
"1",
"]",
")",
";",
"if",
"(",
"!",
"(",
"xcc",
"<",
"0",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Entry \"",
"+",
"i",
"+",
"\" not less than entry \"",
"+",
"i",
"+",
"1",
")",
";",
"correct",
"=",
"false",
";",
"}",
"}",
"}",
"return",
"correct",
";",
"}"
] | Used by test code to make sure that all of the keys within
a node are in the correct collating sequence. | [
"Used",
"by",
"test",
"code",
"to",
"make",
"sure",
"that",
"all",
"of",
"the",
"keys",
"within",
"a",
"node",
"are",
"in",
"the",
"correct",
"collating",
"sequence",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L1375-L1393 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/archive/AbstractCDIArchive.java | AbstractCDIArchive.getExtensionClasses | @Override
public Set<String> getExtensionClasses() {
Set<String> serviceClazzes = new HashSet<>();
if (getType() == ArchiveType.WEB_MODULE) {
Resource webInfClassesMetaInfServicesEntry = getResource(CDIUtils.WEB_INF_CLASSES_META_INF_SERVICES_CDI_EXTENSION);
serviceClazzes.addAll(CDIUtils.parseServiceSPIExtensionFile(webInfClassesMetaInfServicesEntry));
}
Resource metaInfServicesEntry = getResource(CDIUtils.META_INF_SERVICES_CDI_EXTENSION);
serviceClazzes.addAll(CDIUtils.parseServiceSPIExtensionFile(metaInfServicesEntry));
return serviceClazzes;
} | java | @Override
public Set<String> getExtensionClasses() {
Set<String> serviceClazzes = new HashSet<>();
if (getType() == ArchiveType.WEB_MODULE) {
Resource webInfClassesMetaInfServicesEntry = getResource(CDIUtils.WEB_INF_CLASSES_META_INF_SERVICES_CDI_EXTENSION);
serviceClazzes.addAll(CDIUtils.parseServiceSPIExtensionFile(webInfClassesMetaInfServicesEntry));
}
Resource metaInfServicesEntry = getResource(CDIUtils.META_INF_SERVICES_CDI_EXTENSION);
serviceClazzes.addAll(CDIUtils.parseServiceSPIExtensionFile(metaInfServicesEntry));
return serviceClazzes;
} | [
"@",
"Override",
"public",
"Set",
"<",
"String",
">",
"getExtensionClasses",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"serviceClazzes",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"if",
"(",
"getType",
"(",
")",
"==",
"ArchiveType",
".",
"WEB_MODULE",
")",
"{",
"Resource",
"webInfClassesMetaInfServicesEntry",
"=",
"getResource",
"(",
"CDIUtils",
".",
"WEB_INF_CLASSES_META_INF_SERVICES_CDI_EXTENSION",
")",
";",
"serviceClazzes",
".",
"addAll",
"(",
"CDIUtils",
".",
"parseServiceSPIExtensionFile",
"(",
"webInfClassesMetaInfServicesEntry",
")",
")",
";",
"}",
"Resource",
"metaInfServicesEntry",
"=",
"getResource",
"(",
"CDIUtils",
".",
"META_INF_SERVICES_CDI_EXTENSION",
")",
";",
"serviceClazzes",
".",
"addAll",
"(",
"CDIUtils",
".",
"parseServiceSPIExtensionFile",
"(",
"metaInfServicesEntry",
")",
")",
";",
"return",
"serviceClazzes",
";",
"}"
] | Get hold of the extension class names from the file of META-INF\services\javax.enterprise.inject.spi.Extension
@return a set of classes mentioned in the extension file | [
"Get",
"hold",
"of",
"the",
"extension",
"class",
"names",
"from",
"the",
"file",
"of",
"META",
"-",
"INF",
"\\",
"services",
"\\",
"javax",
".",
"enterprise",
".",
"inject",
".",
"spi",
".",
"Extension"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/archive/AbstractCDIArchive.java#L134-L147 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/archive/AbstractCDIArchive.java | AbstractCDIArchive.getBeanDiscoveryMode | public BeanDiscoveryMode getBeanDiscoveryMode(CDIRuntime cdiRuntime, BeansXml beansXml) {
BeanDiscoveryMode mode = BeanDiscoveryMode.ANNOTATED;
if (beansXml != null) {
mode = beansXml.getBeanDiscoveryMode();
} else if (cdiRuntime.isImplicitBeanArchivesScanningDisabled(this)) {
// If the server.xml has the configuration of enableImplicitBeanArchives sets to false, we will not scan the implicit bean archives
mode = BeanDiscoveryMode.NONE;
}
return mode;
} | java | public BeanDiscoveryMode getBeanDiscoveryMode(CDIRuntime cdiRuntime, BeansXml beansXml) {
BeanDiscoveryMode mode = BeanDiscoveryMode.ANNOTATED;
if (beansXml != null) {
mode = beansXml.getBeanDiscoveryMode();
} else if (cdiRuntime.isImplicitBeanArchivesScanningDisabled(this)) {
// If the server.xml has the configuration of enableImplicitBeanArchives sets to false, we will not scan the implicit bean archives
mode = BeanDiscoveryMode.NONE;
}
return mode;
} | [
"public",
"BeanDiscoveryMode",
"getBeanDiscoveryMode",
"(",
"CDIRuntime",
"cdiRuntime",
",",
"BeansXml",
"beansXml",
")",
"{",
"BeanDiscoveryMode",
"mode",
"=",
"BeanDiscoveryMode",
".",
"ANNOTATED",
";",
"if",
"(",
"beansXml",
"!=",
"null",
")",
"{",
"mode",
"=",
"beansXml",
".",
"getBeanDiscoveryMode",
"(",
")",
";",
"}",
"else",
"if",
"(",
"cdiRuntime",
".",
"isImplicitBeanArchivesScanningDisabled",
"(",
"this",
")",
")",
"{",
"// If the server.xml has the configuration of enableImplicitBeanArchives sets to false, we will not scan the implicit bean archives",
"mode",
"=",
"BeanDiscoveryMode",
".",
"NONE",
";",
"}",
"return",
"mode",
";",
"}"
] | Determine the bean deployment archive scanning mode
If there is a beans.xml, the bean discovery mode will be used.
If there is no beans.xml, the mode will be annotated, unless the enableImplicitBeanArchives is configured as false via the server.xml.
If there is no beans.xml and the enableImplicitBeanArchives attribute on cdi12 is configured to false, the scanning mode is none.
@return | [
"Determine",
"the",
"bean",
"deployment",
"archive",
"scanning",
"mode",
"If",
"there",
"is",
"a",
"beans",
".",
"xml",
"the",
"bean",
"discovery",
"mode",
"will",
"be",
"used",
".",
"If",
"there",
"is",
"no",
"beans",
".",
"xml",
"the",
"mode",
"will",
"be",
"annotated",
"unless",
"the",
"enableImplicitBeanArchives",
"is",
"configured",
"as",
"false",
"via",
"the",
"server",
".",
"xml",
".",
"If",
"there",
"is",
"no",
"beans",
".",
"xml",
"and",
"the",
"enableImplicitBeanArchives",
"attribute",
"on",
"cdi12",
"is",
"configured",
"to",
"false",
"the",
"scanning",
"mode",
"is",
"none",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/archive/AbstractCDIArchive.java#L183-L192 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap_fat/fat/src/com/ibm/ws/security/wim/adapter/ldap/fat/URAPIs_UserGroupSearchBases.java | URAPIs_UserGroupSearchBases.teardownClass | @AfterClass
public static void teardownClass() throws Exception {
try {
if (libertyServer != null) {
libertyServer.stopServer("CWIML4537E");
}
} finally {
if (ds != null) {
ds.shutDown(true);
}
}
libertyServer.deleteFileFromLibertyInstallRoot("lib/features/internalfeatures/securitylibertyinternals-1.0.mf");
} | java | @AfterClass
public static void teardownClass() throws Exception {
try {
if (libertyServer != null) {
libertyServer.stopServer("CWIML4537E");
}
} finally {
if (ds != null) {
ds.shutDown(true);
}
}
libertyServer.deleteFileFromLibertyInstallRoot("lib/features/internalfeatures/securitylibertyinternals-1.0.mf");
} | [
"@",
"AfterClass",
"public",
"static",
"void",
"teardownClass",
"(",
")",
"throws",
"Exception",
"{",
"try",
"{",
"if",
"(",
"libertyServer",
"!=",
"null",
")",
"{",
"libertyServer",
".",
"stopServer",
"(",
"\"CWIML4537E\"",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"ds",
"!=",
"null",
")",
"{",
"ds",
".",
"shutDown",
"(",
"true",
")",
";",
"}",
"}",
"libertyServer",
".",
"deleteFileFromLibertyInstallRoot",
"(",
"\"lib/features/internalfeatures/securitylibertyinternals-1.0.mf\"",
")",
";",
"}"
] | Tear down the test. | [
"Tear",
"down",
"the",
"test",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap_fat/fat/src/com/ibm/ws/security/wim/adapter/ldap/fat/URAPIs_UserGroupSearchBases.java#L94-L106 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap_fat/fat/src/com/ibm/ws/security/wim/adapter/ldap/fat/URAPIs_UserGroupSearchBases.java | URAPIs_UserGroupSearchBases.setupLibertyServer | private static void setupLibertyServer() throws Exception {
/*
* Add LDAP variables to bootstrap properties file
*/
LDAPUtils.addLDAPVariables(libertyServer);
Log.info(c, "setUp", "Starting the server... (will wait for userRegistry servlet to start)");
libertyServer.copyFileToLibertyInstallRoot("lib/features", "internalfeatures/securitylibertyinternals-1.0.mf");
libertyServer.addInstalledAppForValidation("userRegistry");
libertyServer.startServer(c.getName() + ".log");
/*
* Make sure the application has come up before proceeding
*/
assertNotNull("Application userRegistry does not appear to have started.",
libertyServer.waitForStringInLog("CWWKZ0001I:.*userRegistry"));
assertNotNull("Security service did not report it was ready",
libertyServer.waitForStringInLog("CWWKS0008I"));
assertNotNull("Server did not came up",
libertyServer.waitForStringInLog("CWWKF0011I"));
Log.info(c, "setUp", "Creating servlet connection the server");
servlet = new UserRegistryServletConnection(libertyServer.getHostname(), libertyServer.getHttpDefaultPort());
if (servlet.getRealm() == null) {
Thread.sleep(5000);
servlet.getRealm();
}
/*
* The original server configuration has no registry or Federated Repository configuration.
*/
emptyConfiguration = libertyServer.getServerConfiguration();
} | java | private static void setupLibertyServer() throws Exception {
/*
* Add LDAP variables to bootstrap properties file
*/
LDAPUtils.addLDAPVariables(libertyServer);
Log.info(c, "setUp", "Starting the server... (will wait for userRegistry servlet to start)");
libertyServer.copyFileToLibertyInstallRoot("lib/features", "internalfeatures/securitylibertyinternals-1.0.mf");
libertyServer.addInstalledAppForValidation("userRegistry");
libertyServer.startServer(c.getName() + ".log");
/*
* Make sure the application has come up before proceeding
*/
assertNotNull("Application userRegistry does not appear to have started.",
libertyServer.waitForStringInLog("CWWKZ0001I:.*userRegistry"));
assertNotNull("Security service did not report it was ready",
libertyServer.waitForStringInLog("CWWKS0008I"));
assertNotNull("Server did not came up",
libertyServer.waitForStringInLog("CWWKF0011I"));
Log.info(c, "setUp", "Creating servlet connection the server");
servlet = new UserRegistryServletConnection(libertyServer.getHostname(), libertyServer.getHttpDefaultPort());
if (servlet.getRealm() == null) {
Thread.sleep(5000);
servlet.getRealm();
}
/*
* The original server configuration has no registry or Federated Repository configuration.
*/
emptyConfiguration = libertyServer.getServerConfiguration();
} | [
"private",
"static",
"void",
"setupLibertyServer",
"(",
")",
"throws",
"Exception",
"{",
"/*\n * Add LDAP variables to bootstrap properties file\n */",
"LDAPUtils",
".",
"addLDAPVariables",
"(",
"libertyServer",
")",
";",
"Log",
".",
"info",
"(",
"c",
",",
"\"setUp\"",
",",
"\"Starting the server... (will wait for userRegistry servlet to start)\"",
")",
";",
"libertyServer",
".",
"copyFileToLibertyInstallRoot",
"(",
"\"lib/features\"",
",",
"\"internalfeatures/securitylibertyinternals-1.0.mf\"",
")",
";",
"libertyServer",
".",
"addInstalledAppForValidation",
"(",
"\"userRegistry\"",
")",
";",
"libertyServer",
".",
"startServer",
"(",
"c",
".",
"getName",
"(",
")",
"+",
"\".log\"",
")",
";",
"/*\n * Make sure the application has come up before proceeding\n */",
"assertNotNull",
"(",
"\"Application userRegistry does not appear to have started.\"",
",",
"libertyServer",
".",
"waitForStringInLog",
"(",
"\"CWWKZ0001I:.*userRegistry\"",
")",
")",
";",
"assertNotNull",
"(",
"\"Security service did not report it was ready\"",
",",
"libertyServer",
".",
"waitForStringInLog",
"(",
"\"CWWKS0008I\"",
")",
")",
";",
"assertNotNull",
"(",
"\"Server did not came up\"",
",",
"libertyServer",
".",
"waitForStringInLog",
"(",
"\"CWWKF0011I\"",
")",
")",
";",
"Log",
".",
"info",
"(",
"c",
",",
"\"setUp\"",
",",
"\"Creating servlet connection the server\"",
")",
";",
"servlet",
"=",
"new",
"UserRegistryServletConnection",
"(",
"libertyServer",
".",
"getHostname",
"(",
")",
",",
"libertyServer",
".",
"getHttpDefaultPort",
"(",
")",
")",
";",
"if",
"(",
"servlet",
".",
"getRealm",
"(",
")",
"==",
"null",
")",
"{",
"Thread",
".",
"sleep",
"(",
"5000",
")",
";",
"servlet",
".",
"getRealm",
"(",
")",
";",
"}",
"/*\n * The original server configuration has no registry or Federated Repository configuration.\n */",
"emptyConfiguration",
"=",
"libertyServer",
".",
"getServerConfiguration",
"(",
")",
";",
"}"
] | Setup the Liberty server. This server will start with very basic configuration. The tests
will configure the server dynamically.
@throws Exception If there was an issue setting up the Liberty server. | [
"Setup",
"the",
"Liberty",
"server",
".",
"This",
"server",
"will",
"start",
"with",
"very",
"basic",
"configuration",
".",
"The",
"tests",
"will",
"configure",
"the",
"server",
"dynamically",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap_fat/fat/src/com/ibm/ws/security/wim/adapter/ldap/fat/URAPIs_UserGroupSearchBases.java#L114-L146 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap_fat/fat/src/com/ibm/ws/security/wim/adapter/ldap/fat/URAPIs_UserGroupSearchBases.java | URAPIs_UserGroupSearchBases.setupldapServer | private static void setupldapServer() throws Exception {
ds = new InMemoryLDAPServer(SUB_DN);
Entry entry = new Entry(SUB_DN);
entry.addAttribute("objectclass", "top");
entry.addAttribute("objectclass", "domain");
ds.add(entry);
/*
* Add the partition entries.
*/
entry = new Entry("ou=Test,o=ibm,c=us");
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Test");
ds.add(entry);
entry = new Entry(USER_BASE_DN);
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Test");
entry.addAttribute("ou", "TestUsers");
ds.add(entry);
entry = new Entry(BAD_USER_BASE_DN);
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "BadUsers");
ds.add(entry);
entry = new Entry("ou=Dev,o=ibm,c=us");
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Dev");
ds.add(entry);
entry = new Entry(GROUP_BASE_DN);
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Dev");
entry.addAttribute("ou", "DevGroups");
ds.add(entry);
/*
* Create the user and group.
*/
entry = new Entry(USER_DN);
entry.addAttribute("objectclass", "inetorgperson");
entry.addAttribute("uid", USER);
entry.addAttribute("sn", USER);
entry.addAttribute("cn", USER);
entry.addAttribute("userPassword", "password");
ds.add(entry);
entry = new Entry(BAD_USER_DN);
entry.addAttribute("objectclass", "inetorgperson");
entry.addAttribute("uid", BAD_USER);
entry.addAttribute("sn", BAD_USER);
entry.addAttribute("cn", BAD_USER);
entry.addAttribute("userPassword", "password");
ds.add(entry);
entry = new Entry(GROUP_DN);
entry.addAttribute("objectclass", "groupofnames");
entry.addAttribute("cn", GROUP);
entry.addAttribute("member", USER_DN);
entry.addAttribute("member", BAD_USER_DN);
ds.add(entry);
} | java | private static void setupldapServer() throws Exception {
ds = new InMemoryLDAPServer(SUB_DN);
Entry entry = new Entry(SUB_DN);
entry.addAttribute("objectclass", "top");
entry.addAttribute("objectclass", "domain");
ds.add(entry);
/*
* Add the partition entries.
*/
entry = new Entry("ou=Test,o=ibm,c=us");
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Test");
ds.add(entry);
entry = new Entry(USER_BASE_DN);
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Test");
entry.addAttribute("ou", "TestUsers");
ds.add(entry);
entry = new Entry(BAD_USER_BASE_DN);
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "BadUsers");
ds.add(entry);
entry = new Entry("ou=Dev,o=ibm,c=us");
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Dev");
ds.add(entry);
entry = new Entry(GROUP_BASE_DN);
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Dev");
entry.addAttribute("ou", "DevGroups");
ds.add(entry);
/*
* Create the user and group.
*/
entry = new Entry(USER_DN);
entry.addAttribute("objectclass", "inetorgperson");
entry.addAttribute("uid", USER);
entry.addAttribute("sn", USER);
entry.addAttribute("cn", USER);
entry.addAttribute("userPassword", "password");
ds.add(entry);
entry = new Entry(BAD_USER_DN);
entry.addAttribute("objectclass", "inetorgperson");
entry.addAttribute("uid", BAD_USER);
entry.addAttribute("sn", BAD_USER);
entry.addAttribute("cn", BAD_USER);
entry.addAttribute("userPassword", "password");
ds.add(entry);
entry = new Entry(GROUP_DN);
entry.addAttribute("objectclass", "groupofnames");
entry.addAttribute("cn", GROUP);
entry.addAttribute("member", USER_DN);
entry.addAttribute("member", BAD_USER_DN);
ds.add(entry);
} | [
"private",
"static",
"void",
"setupldapServer",
"(",
")",
"throws",
"Exception",
"{",
"ds",
"=",
"new",
"InMemoryLDAPServer",
"(",
"SUB_DN",
")",
";",
"Entry",
"entry",
"=",
"new",
"Entry",
"(",
"SUB_DN",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"objectclass\"",
",",
"\"top\"",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"objectclass\"",
",",
"\"domain\"",
")",
";",
"ds",
".",
"add",
"(",
"entry",
")",
";",
"/*\n * Add the partition entries.\n */",
"entry",
"=",
"new",
"Entry",
"(",
"\"ou=Test,o=ibm,c=us\"",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"objectclass\"",
",",
"\"organizationalunit\"",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"ou\"",
",",
"\"Test\"",
")",
";",
"ds",
".",
"add",
"(",
"entry",
")",
";",
"entry",
"=",
"new",
"Entry",
"(",
"USER_BASE_DN",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"objectclass\"",
",",
"\"organizationalunit\"",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"ou\"",
",",
"\"Test\"",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"ou\"",
",",
"\"TestUsers\"",
")",
";",
"ds",
".",
"add",
"(",
"entry",
")",
";",
"entry",
"=",
"new",
"Entry",
"(",
"BAD_USER_BASE_DN",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"objectclass\"",
",",
"\"organizationalunit\"",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"ou\"",
",",
"\"BadUsers\"",
")",
";",
"ds",
".",
"add",
"(",
"entry",
")",
";",
"entry",
"=",
"new",
"Entry",
"(",
"\"ou=Dev,o=ibm,c=us\"",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"objectclass\"",
",",
"\"organizationalunit\"",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"ou\"",
",",
"\"Dev\"",
")",
";",
"ds",
".",
"add",
"(",
"entry",
")",
";",
"entry",
"=",
"new",
"Entry",
"(",
"GROUP_BASE_DN",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"objectclass\"",
",",
"\"organizationalunit\"",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"ou\"",
",",
"\"Dev\"",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"ou\"",
",",
"\"DevGroups\"",
")",
";",
"ds",
".",
"add",
"(",
"entry",
")",
";",
"/*\n * Create the user and group.\n */",
"entry",
"=",
"new",
"Entry",
"(",
"USER_DN",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"objectclass\"",
",",
"\"inetorgperson\"",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"uid\"",
",",
"USER",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"sn\"",
",",
"USER",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"cn\"",
",",
"USER",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"userPassword\"",
",",
"\"password\"",
")",
";",
"ds",
".",
"add",
"(",
"entry",
")",
";",
"entry",
"=",
"new",
"Entry",
"(",
"BAD_USER_DN",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"objectclass\"",
",",
"\"inetorgperson\"",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"uid\"",
",",
"BAD_USER",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"sn\"",
",",
"BAD_USER",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"cn\"",
",",
"BAD_USER",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"userPassword\"",
",",
"\"password\"",
")",
";",
"ds",
".",
"add",
"(",
"entry",
")",
";",
"entry",
"=",
"new",
"Entry",
"(",
"GROUP_DN",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"objectclass\"",
",",
"\"groupofnames\"",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"cn\"",
",",
"GROUP",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"member\"",
",",
"USER_DN",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"member\"",
",",
"BAD_USER_DN",
")",
";",
"ds",
".",
"add",
"(",
"entry",
")",
";",
"}"
] | Configure the embedded LDAP server.
@throws Exception If the server failed to start for some reason. | [
"Configure",
"the",
"embedded",
"LDAP",
"server",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap_fat/fat/src/com/ibm/ws/security/wim/adapter/ldap/fat/URAPIs_UserGroupSearchBases.java#L153-L216 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/FastSynchHashTable.java | FastSynchHashTable.syncGetValueFromBucket | private Object syncGetValueFromBucket(FastSyncHashBucket hb, int key, boolean remove) {
FastSyncHashEntry e = null;
FastSyncHashEntry last = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "syncGetValueFromBucket: key, remove " + key + " " + remove);
}
synchronized (hb) {
e = hb.root;
while (e != null) {
if (e.key == key) {
if (remove) {
if (last == null) {
// this is root
hb.root = e.next;
} else {
last.next = e.next;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "syncGetValueFromBucket: found value in bucket");
}
return e.value;
}
last = e;
e = e.next;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "syncGetValueFromBucket-returned null");
}
return null;
} | java | private Object syncGetValueFromBucket(FastSyncHashBucket hb, int key, boolean remove) {
FastSyncHashEntry e = null;
FastSyncHashEntry last = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "syncGetValueFromBucket: key, remove " + key + " " + remove);
}
synchronized (hb) {
e = hb.root;
while (e != null) {
if (e.key == key) {
if (remove) {
if (last == null) {
// this is root
hb.root = e.next;
} else {
last.next = e.next;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "syncGetValueFromBucket: found value in bucket");
}
return e.value;
}
last = e;
e = e.next;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "syncGetValueFromBucket-returned null");
}
return null;
} | [
"private",
"Object",
"syncGetValueFromBucket",
"(",
"FastSyncHashBucket",
"hb",
",",
"int",
"key",
",",
"boolean",
"remove",
")",
"{",
"FastSyncHashEntry",
"e",
"=",
"null",
";",
"FastSyncHashEntry",
"last",
"=",
"null",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"syncGetValueFromBucket: key, remove \"",
"+",
"key",
"+",
"\" \"",
"+",
"remove",
")",
";",
"}",
"synchronized",
"(",
"hb",
")",
"{",
"e",
"=",
"hb",
".",
"root",
";",
"while",
"(",
"e",
"!=",
"null",
")",
"{",
"if",
"(",
"e",
".",
"key",
"==",
"key",
")",
"{",
"if",
"(",
"remove",
")",
"{",
"if",
"(",
"last",
"==",
"null",
")",
"{",
"// this is root",
"hb",
".",
"root",
"=",
"e",
".",
"next",
";",
"}",
"else",
"{",
"last",
".",
"next",
"=",
"e",
".",
"next",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"syncGetValueFromBucket: found value in bucket\"",
")",
";",
"}",
"return",
"e",
".",
"value",
";",
"}",
"last",
"=",
"e",
";",
"e",
"=",
"e",
".",
"next",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"syncGetValueFromBucket-returned null\"",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Internal get from the table which is partially synchronized at the hash
bucket level.
@param hb
a hash bucket to go to.
@param key
the key to retrieve
@param remove
whether to remove it from the table or not
@return value in the table | [
"Internal",
"get",
"from",
"the",
"table",
"which",
"is",
"partially",
"synchronized",
"at",
"the",
"hash",
"bucket",
"level",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/FastSynchHashTable.java#L91-L123 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/FastSynchHashTable.java | FastSynchHashTable.put | public Object put(int key, Object value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "put");
}
if (value == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "value == null");
}
throw new NullPointerException("Missing value");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "key " + key);
}
// check the table
FastSyncHashBucket bucket = getBucket(key);
Object retVal = syncGetValueFromBucket(bucket, key, false);
if (retVal != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "put: key is already defined in bucket...returning value from bucket and new key value will be discarded.");
return retVal;
}
// new entry
FastSyncHashEntry e = new FastSyncHashEntry(key, value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "put: put new key and value into bucket");
}
return syncPutIntoBucket(bucket, e);
} | java | public Object put(int key, Object value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "put");
}
if (value == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "value == null");
}
throw new NullPointerException("Missing value");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "key " + key);
}
// check the table
FastSyncHashBucket bucket = getBucket(key);
Object retVal = syncGetValueFromBucket(bucket, key, false);
if (retVal != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "put: key is already defined in bucket...returning value from bucket and new key value will be discarded.");
return retVal;
}
// new entry
FastSyncHashEntry e = new FastSyncHashEntry(key, value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "put: put new key and value into bucket");
}
return syncPutIntoBucket(bucket, e);
} | [
"public",
"Object",
"put",
"(",
"int",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"put\"",
")",
";",
"}",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"value == null\"",
")",
";",
"}",
"throw",
"new",
"NullPointerException",
"(",
"\"Missing value\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"key \"",
"+",
"key",
")",
";",
"}",
"// check the table",
"FastSyncHashBucket",
"bucket",
"=",
"getBucket",
"(",
"key",
")",
";",
"Object",
"retVal",
"=",
"syncGetValueFromBucket",
"(",
"bucket",
",",
"key",
",",
"false",
")",
";",
"if",
"(",
"retVal",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"put: key is already defined in bucket...returning value from bucket and new key value will be discarded.\"",
")",
";",
"return",
"retVal",
";",
"}",
"// new entry",
"FastSyncHashEntry",
"e",
"=",
"new",
"FastSyncHashEntry",
"(",
"key",
",",
"value",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"put: put new key and value into bucket\"",
")",
";",
"}",
"return",
"syncPutIntoBucket",
"(",
"bucket",
",",
"e",
")",
";",
"}"
] | Put into the table if does not exist.
@param key
Object to identify the value by
@param value
Object to store in the table
@return value of the object in the cache | [
"Put",
"into",
"the",
"table",
"if",
"does",
"not",
"exist",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/FastSynchHashTable.java#L134-L162 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/FastSynchHashTable.java | FastSynchHashTable.syncPutIntoBucket | private Object syncPutIntoBucket(FastSyncHashBucket hb, FastSyncHashEntry newEntry) {
FastSyncHashEntry e = null;
FastSyncHashEntry last = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "syncPutIntoBucket");
}
synchronized (hb) {
e = hb.root;
// already in there?
while (e != null) {
if (e.key == newEntry.key) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "syncPutIntoBucket: key/hash pair is already in the bucket");
}
return e.value;
}
last = e;
e = e.next;
}
if (last == null) {
if (hb.root == null) {
// this is root
hb.root = newEntry;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "syncPutIntoBucket: Adding new entry at the beginning (root)");
}
return newEntry.value;
}
last = hb.root;
while (last.next != null) {
last = last.next;
}
}
last.next = newEntry;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "syncPutIntoBucket: Adding new entry at the end");
}
return newEntry.value;
} // end-sync
} | java | private Object syncPutIntoBucket(FastSyncHashBucket hb, FastSyncHashEntry newEntry) {
FastSyncHashEntry e = null;
FastSyncHashEntry last = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "syncPutIntoBucket");
}
synchronized (hb) {
e = hb.root;
// already in there?
while (e != null) {
if (e.key == newEntry.key) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "syncPutIntoBucket: key/hash pair is already in the bucket");
}
return e.value;
}
last = e;
e = e.next;
}
if (last == null) {
if (hb.root == null) {
// this is root
hb.root = newEntry;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "syncPutIntoBucket: Adding new entry at the beginning (root)");
}
return newEntry.value;
}
last = hb.root;
while (last.next != null) {
last = last.next;
}
}
last.next = newEntry;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "syncPutIntoBucket: Adding new entry at the end");
}
return newEntry.value;
} // end-sync
} | [
"private",
"Object",
"syncPutIntoBucket",
"(",
"FastSyncHashBucket",
"hb",
",",
"FastSyncHashEntry",
"newEntry",
")",
"{",
"FastSyncHashEntry",
"e",
"=",
"null",
";",
"FastSyncHashEntry",
"last",
"=",
"null",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"syncPutIntoBucket\"",
")",
";",
"}",
"synchronized",
"(",
"hb",
")",
"{",
"e",
"=",
"hb",
".",
"root",
";",
"// already in there?",
"while",
"(",
"e",
"!=",
"null",
")",
"{",
"if",
"(",
"e",
".",
"key",
"==",
"newEntry",
".",
"key",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"syncPutIntoBucket: key/hash pair is already in the bucket\"",
")",
";",
"}",
"return",
"e",
".",
"value",
";",
"}",
"last",
"=",
"e",
";",
"e",
"=",
"e",
".",
"next",
";",
"}",
"if",
"(",
"last",
"==",
"null",
")",
"{",
"if",
"(",
"hb",
".",
"root",
"==",
"null",
")",
"{",
"// this is root",
"hb",
".",
"root",
"=",
"newEntry",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"syncPutIntoBucket: Adding new entry at the beginning (root)\"",
")",
";",
"}",
"return",
"newEntry",
".",
"value",
";",
"}",
"last",
"=",
"hb",
".",
"root",
";",
"while",
"(",
"last",
".",
"next",
"!=",
"null",
")",
"{",
"last",
"=",
"last",
".",
"next",
";",
"}",
"}",
"last",
".",
"next",
"=",
"newEntry",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"syncPutIntoBucket: Adding new entry at the end\"",
")",
";",
"}",
"return",
"newEntry",
".",
"value",
";",
"}",
"// end-sync",
"}"
] | Put synchronized into bucket.
Puts an object into the bucket and is synchronized.
@param hb
a FastSyncHashBucket
@param newEntry
a FastSyncHashEntry to place in the Bucket
@return the value in the table | [
"Put",
"synchronized",
"into",
"bucket",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/FastSynchHashTable.java#L224-L265 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/FastSynchHashTable.java | FastSynchHashTable.getAllEntryValues | public Object[] getAllEntryValues() {
List<Object> values = new ArrayList<Object>();
FastSyncHashBucket hb = null;
FastSyncHashEntry e = null;
for (int i = 0; i < xVar; i++) {
for (int j = 0; j < yVar; j++) {
hb = mainTable[i][j];
synchronized (hb) {
e = hb.root;
while (e != null) {
values.add(e.value);
e = e.next;
}
}
}
}
return values.toArray();
} | java | public Object[] getAllEntryValues() {
List<Object> values = new ArrayList<Object>();
FastSyncHashBucket hb = null;
FastSyncHashEntry e = null;
for (int i = 0; i < xVar; i++) {
for (int j = 0; j < yVar; j++) {
hb = mainTable[i][j];
synchronized (hb) {
e = hb.root;
while (e != null) {
values.add(e.value);
e = e.next;
}
}
}
}
return values.toArray();
} | [
"public",
"Object",
"[",
"]",
"getAllEntryValues",
"(",
")",
"{",
"List",
"<",
"Object",
">",
"values",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"FastSyncHashBucket",
"hb",
"=",
"null",
";",
"FastSyncHashEntry",
"e",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"xVar",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"yVar",
";",
"j",
"++",
")",
"{",
"hb",
"=",
"mainTable",
"[",
"i",
"]",
"[",
"j",
"]",
";",
"synchronized",
"(",
"hb",
")",
"{",
"e",
"=",
"hb",
".",
"root",
";",
"while",
"(",
"e",
"!=",
"null",
")",
"{",
"values",
".",
"add",
"(",
"e",
".",
"value",
")",
";",
"e",
"=",
"e",
".",
"next",
";",
"}",
"}",
"}",
"}",
"return",
"values",
".",
"toArray",
"(",
")",
";",
"}"
] | This routine returns a snapshot of all the values in the hash table.
CAUTION: The entries returned may no longer be valid, so code that
processes
of the return values should be aware of this. The main reason for
this function is to provide a way of dumping the table for diagnostic
purposes.
@return an array of all the values in the hash table. | [
"This",
"routine",
"returns",
"a",
"snapshot",
"of",
"all",
"the",
"values",
"in",
"the",
"hash",
"table",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/FastSynchHashTable.java#L291-L310 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java | JmsConnectionImpl.removeSession | void removeSession(JmsSessionImpl sess) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "removeSession", sess);
synchronized (stateLock) {
// Remove the Session
// Note that this is a synchronized collection.
boolean res = sessions.remove(sess);
// Release the ordering context associated with the session
unusedOrderingContexts.add(sess.getOrderingContext());
if (!res && TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "session not found in list");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "removeSession");
} | java | void removeSession(JmsSessionImpl sess) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "removeSession", sess);
synchronized (stateLock) {
// Remove the Session
// Note that this is a synchronized collection.
boolean res = sessions.remove(sess);
// Release the ordering context associated with the session
unusedOrderingContexts.add(sess.getOrderingContext());
if (!res && TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "session not found in list");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "removeSession");
} | [
"void",
"removeSession",
"(",
"JmsSessionImpl",
"sess",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"removeSession\"",
",",
"sess",
")",
";",
"synchronized",
"(",
"stateLock",
")",
"{",
"// Remove the Session",
"// Note that this is a synchronized collection.",
"boolean",
"res",
"=",
"sessions",
".",
"remove",
"(",
"sess",
")",
";",
"// Release the ordering context associated with the session",
"unusedOrderingContexts",
".",
"add",
"(",
"sess",
".",
"getOrderingContext",
"(",
")",
")",
";",
"if",
"(",
"!",
"res",
"&&",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"session not found in list\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"removeSession\"",
")",
";",
"}"
] | This method is used to remove a Session from the list of sessions held by
the Connection. | [
"This",
"method",
"is",
"used",
"to",
"remove",
"a",
"Session",
"from",
"the",
"list",
"of",
"sessions",
"held",
"by",
"the",
"Connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java#L880-L898 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java | JmsConnectionImpl.getState | protected int getState() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getState");
int tempState;
synchronized (stateLock) {
tempState = state;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getState", state);
return tempState;
} | java | protected int getState() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getState");
int tempState;
synchronized (stateLock) {
tempState = state;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getState", state);
return tempState;
} | [
"protected",
"int",
"getState",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getState\"",
")",
";",
"int",
"tempState",
";",
"synchronized",
"(",
"stateLock",
")",
"{",
"tempState",
"=",
"state",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getState\"",
",",
"state",
")",
";",
"return",
"tempState",
";",
"}"
] | Returns the state.
@return int | [
"Returns",
"the",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java#L905-L915 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java | JmsConnectionImpl.setState | protected void setState(int newState) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setState", newState);
synchronized (stateLock) {
if ((newState == JmsInternalConstants.CLOSED)
|| (newState == JmsInternalConstants.STOPPED)
|| (newState == JmsInternalConstants.STARTED)) {
state = newState;
stateLock.notifyAll();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setState");
} | java | protected void setState(int newState) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setState", newState);
synchronized (stateLock) {
if ((newState == JmsInternalConstants.CLOSED)
|| (newState == JmsInternalConstants.STOPPED)
|| (newState == JmsInternalConstants.STARTED)) {
state = newState;
stateLock.notifyAll();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setState");
} | [
"protected",
"void",
"setState",
"(",
"int",
"newState",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"setState\"",
",",
"newState",
")",
";",
"synchronized",
"(",
"stateLock",
")",
"{",
"if",
"(",
"(",
"newState",
"==",
"JmsInternalConstants",
".",
"CLOSED",
")",
"||",
"(",
"newState",
"==",
"JmsInternalConstants",
".",
"STOPPED",
")",
"||",
"(",
"newState",
"==",
"JmsInternalConstants",
".",
"STARTED",
")",
")",
"{",
"state",
"=",
"newState",
";",
"stateLock",
".",
"notifyAll",
"(",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"setState\"",
")",
";",
"}"
] | Sets the state.
@param state The state to set | [
"Sets",
"the",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java#L922-L937 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java | JmsConnectionImpl.checkClosed | protected void checkClosed() throws JMSException {
if (getState() == CLOSED) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "This Connection is closed.");
throw (javax.jms.IllegalStateException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
"CONNECTION_CLOSED_CWSIA0021",
null, tc);
}
} | java | protected void checkClosed() throws JMSException {
if (getState() == CLOSED) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "This Connection is closed.");
throw (javax.jms.IllegalStateException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
"CONNECTION_CLOSED_CWSIA0021",
null, tc);
}
} | [
"protected",
"void",
"checkClosed",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"getState",
"(",
")",
"==",
"CLOSED",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"This Connection is closed.\"",
")",
";",
"throw",
"(",
"javax",
".",
"jms",
".",
"IllegalStateException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"javax",
".",
"jms",
".",
"IllegalStateException",
".",
"class",
",",
"\"CONNECTION_CLOSED_CWSIA0021\"",
",",
"null",
",",
"tc",
")",
";",
"}",
"}"
] | This method is called at the beginning of every method that should not work
if the Connection has been closed. It prevents further execution by throwing
a JMSException with a suitable "I'm closed" message. | [
"This",
"method",
"is",
"called",
"at",
"the",
"beginning",
"of",
"every",
"method",
"that",
"should",
"not",
"work",
"if",
"the",
"Connection",
"has",
"been",
"closed",
".",
"It",
"prevents",
"further",
"execution",
"by",
"throwing",
"a",
"JMSException",
"with",
"a",
"suitable",
"I",
"m",
"closed",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java#L944-L952 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java | JmsConnectionImpl.fixClientID | protected void fixClientID() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "fixClientID");
synchronized (stateLock) {
clientIDFixed = true;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "fixClientID");
} | java | protected void fixClientID() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "fixClientID");
synchronized (stateLock) {
clientIDFixed = true;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "fixClientID");
} | [
"protected",
"void",
"fixClientID",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"fixClientID\"",
")",
";",
"synchronized",
"(",
"stateLock",
")",
"{",
"clientIDFixed",
"=",
"true",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"fixClientID\"",
")",
";",
"}"
] | This method is called in order to mark that the clientID may not now change. | [
"This",
"method",
"is",
"called",
"in",
"order",
"to",
"mark",
"that",
"the",
"clientID",
"may",
"not",
"now",
"change",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java#L965-L975 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java | JmsConnectionImpl.unfixClientID | void unfixClientID() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "unfixClientID");
synchronized (stateLock) {
clientIDFixed = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "unfixClientID");
} | java | void unfixClientID() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "unfixClientID");
synchronized (stateLock) {
clientIDFixed = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "unfixClientID");
} | [
"void",
"unfixClientID",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"unfixClientID\"",
")",
";",
"synchronized",
"(",
"stateLock",
")",
"{",
"clientIDFixed",
"=",
"false",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"unfixClientID\"",
")",
";",
"}"
] | This method is called in order to mark that the clientID may now change. | [
"This",
"method",
"is",
"called",
"in",
"order",
"to",
"mark",
"that",
"the",
"clientID",
"may",
"now",
"change",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java#L980-L990 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java | JmsConnectionImpl.createJcaSession | protected JmsJcaSession createJcaSession(boolean transacted) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createJcaSession", transacted);
JmsJcaSession jcaSess = null;
// If we have a JCA connection, then make a JCA session
if (jcaConnection != null) {
try {
jcaSess = jcaConnection.createSession(transacted);
} catch (Exception e) { // ResourceE, IllegalStateE, SIE, SIErrorE
// No FFDC code needed
// d238447 Generate FFDC for these cases.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"JCA_CREATE_SESS_CWSIA0024",
null,
e,
"JmsConnectionImpl.createSession#1",
this,
tc);
}
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "jcaConnection is null, returning null jcaSess");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createJcaSession", jcaSess);
return jcaSess;
} | java | protected JmsJcaSession createJcaSession(boolean transacted) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createJcaSession", transacted);
JmsJcaSession jcaSess = null;
// If we have a JCA connection, then make a JCA session
if (jcaConnection != null) {
try {
jcaSess = jcaConnection.createSession(transacted);
} catch (Exception e) { // ResourceE, IllegalStateE, SIE, SIErrorE
// No FFDC code needed
// d238447 Generate FFDC for these cases.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"JCA_CREATE_SESS_CWSIA0024",
null,
e,
"JmsConnectionImpl.createSession#1",
this,
tc);
}
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "jcaConnection is null, returning null jcaSess");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createJcaSession", jcaSess);
return jcaSess;
} | [
"protected",
"JmsJcaSession",
"createJcaSession",
"(",
"boolean",
"transacted",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"createJcaSession\"",
",",
"transacted",
")",
";",
"JmsJcaSession",
"jcaSess",
"=",
"null",
";",
"// If we have a JCA connection, then make a JCA session",
"if",
"(",
"jcaConnection",
"!=",
"null",
")",
"{",
"try",
"{",
"jcaSess",
"=",
"jcaConnection",
".",
"createSession",
"(",
"transacted",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// ResourceE, IllegalStateE, SIE, SIErrorE",
"// No FFDC code needed",
"// d238447 Generate FFDC for these cases.",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"JMSException",
".",
"class",
",",
"\"JCA_CREATE_SESS_CWSIA0024\"",
",",
"null",
",",
"e",
",",
"\"JmsConnectionImpl.createSession#1\"",
",",
"this",
",",
"tc",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"jcaConnection is null, returning null jcaSess\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"createJcaSession\"",
",",
"jcaSess",
")",
";",
"return",
"jcaSess",
";",
"}"
] | Create a JCA Session.
If this Connection contains a JCA Connection, then use it to create a
JCA Session.
@return The new JCA Session
@throws JMSException if the JCA runtime fails to create the JCA Session | [
"Create",
"a",
"JCA",
"Session",
".",
"If",
"this",
"Connection",
"contains",
"a",
"JCA",
"Connection",
"then",
"use",
"it",
"to",
"create",
"a",
"JCA",
"Session",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java#L1000-L1030 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java | JmsConnectionImpl.addTemporaryDestination | protected void addTemporaryDestination(JmsTemporaryDestinationInternal tempDest) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "addTemporaryDestination", System.identityHashCode(tempDest));
synchronized (temporaryDestinations) { // synchronize against removeTemporaryDestination
temporaryDestinations.add(tempDest);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "addTemporaryDestination");
} | java | protected void addTemporaryDestination(JmsTemporaryDestinationInternal tempDest) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "addTemporaryDestination", System.identityHashCode(tempDest));
synchronized (temporaryDestinations) { // synchronize against removeTemporaryDestination
temporaryDestinations.add(tempDest);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "addTemporaryDestination");
} | [
"protected",
"void",
"addTemporaryDestination",
"(",
"JmsTemporaryDestinationInternal",
"tempDest",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"addTemporaryDestination\"",
",",
"System",
".",
"identityHashCode",
"(",
"tempDest",
")",
")",
";",
"synchronized",
"(",
"temporaryDestinations",
")",
"{",
"// synchronize against removeTemporaryDestination",
"temporaryDestinations",
".",
"add",
"(",
"tempDest",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"addTemporaryDestination\"",
")",
";",
"}"
] | Add a TemporaryDestination to the list of temporary destinations
created by sessions under this connection
@param tempDest - the temporary destination | [
"Add",
"a",
"TemporaryDestination",
"to",
"the",
"list",
"of",
"temporary",
"destinations",
"created",
"by",
"sessions",
"under",
"this",
"connection"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java#L1049-L1059 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java | JmsConnectionImpl.removeTemporaryDestination | protected void removeTemporaryDestination(JmsTemporaryDestinationInternal tempDest) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "removeTemporaryDestination", System.identityHashCode(tempDest));
synchronized (temporaryDestinations) { // synchronize against addTemporaryDestination
temporaryDestinations.remove(tempDest);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "removeTemporaryDestination");
} | java | protected void removeTemporaryDestination(JmsTemporaryDestinationInternal tempDest) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "removeTemporaryDestination", System.identityHashCode(tempDest));
synchronized (temporaryDestinations) { // synchronize against addTemporaryDestination
temporaryDestinations.remove(tempDest);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "removeTemporaryDestination");
} | [
"protected",
"void",
"removeTemporaryDestination",
"(",
"JmsTemporaryDestinationInternal",
"tempDest",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"removeTemporaryDestination\"",
",",
"System",
".",
"identityHashCode",
"(",
"tempDest",
")",
")",
";",
"synchronized",
"(",
"temporaryDestinations",
")",
"{",
"// synchronize against addTemporaryDestination",
"temporaryDestinations",
".",
"remove",
"(",
"tempDest",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"removeTemporaryDestination\"",
")",
";",
"}"
] | Remove a TemporaryDestination from the list of temporary destinations
created by sessions under this connection
@param tempDest - the temporary destination to be removed from the List | [
"Remove",
"a",
"TemporaryDestination",
"from",
"the",
"list",
"of",
"temporary",
"destinations",
"created",
"by",
"sessions",
"under",
"this",
"connection"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java#L1067-L1077 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java | JmsConnectionImpl.allocateOrderingContext | public OrderingContext allocateOrderingContext() throws SIConnectionDroppedException, SIConnectionUnavailableException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "allocateOrderingContext");
// Synchronize on the state lock, and either re-use an existing
// unused and open OrderingContext, or create a new one.
OrderingContext oc = null;
synchronized (stateLock) {
while (oc == null && !unusedOrderingContexts.isEmpty()) {
oc = unusedOrderingContexts.remove(0);
if (oc.isProxyConnectionClosed()) {
// Abandon this one.
oc = null;
}
}
if (oc == null) {
oc = coreConnection.createOrderingContext();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "allocateOrderingContext", oc);
return oc;
} | java | public OrderingContext allocateOrderingContext() throws SIConnectionDroppedException, SIConnectionUnavailableException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "allocateOrderingContext");
// Synchronize on the state lock, and either re-use an existing
// unused and open OrderingContext, or create a new one.
OrderingContext oc = null;
synchronized (stateLock) {
while (oc == null && !unusedOrderingContexts.isEmpty()) {
oc = unusedOrderingContexts.remove(0);
if (oc.isProxyConnectionClosed()) {
// Abandon this one.
oc = null;
}
}
if (oc == null) {
oc = coreConnection.createOrderingContext();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "allocateOrderingContext", oc);
return oc;
} | [
"public",
"OrderingContext",
"allocateOrderingContext",
"(",
")",
"throws",
"SIConnectionDroppedException",
",",
"SIConnectionUnavailableException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"allocateOrderingContext\"",
")",
";",
"// Synchronize on the state lock, and either re-use an existing",
"// unused and open OrderingContext, or create a new one.",
"OrderingContext",
"oc",
"=",
"null",
";",
"synchronized",
"(",
"stateLock",
")",
"{",
"while",
"(",
"oc",
"==",
"null",
"&&",
"!",
"unusedOrderingContexts",
".",
"isEmpty",
"(",
")",
")",
"{",
"oc",
"=",
"unusedOrderingContexts",
".",
"remove",
"(",
"0",
")",
";",
"if",
"(",
"oc",
".",
"isProxyConnectionClosed",
"(",
")",
")",
"{",
"// Abandon this one.",
"oc",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"oc",
"==",
"null",
")",
"{",
"oc",
"=",
"coreConnection",
".",
"createOrderingContext",
"(",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"allocateOrderingContext\"",
",",
"oc",
")",
";",
"return",
"oc",
";",
"}"
] | Called by each session when it is created to get an ordering context for that session.
@throws SIConnectionUnavailableException
@throws SIConnectionDroppedException | [
"Called",
"by",
"each",
"session",
"when",
"it",
"is",
"created",
"to",
"get",
"an",
"ordering",
"context",
"for",
"that",
"session",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java#L1121-L1145 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java | JmsConnectionImpl.initExceptionThreadPool | private static void initExceptionThreadPool() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initExceptionThreadPool");
// Do a synchronous check to ensure once-only creation
synchronized (exceptionTPCreateSync) {
if (exceptionThreadPool == null) {
// Get the maximum size for the thread pool, defaulting if
// not specified or if the value cannot be parsed
int maxThreads = Integer.parseInt(ApiJmsConstants.EXCEPTION_MAXTHREADS_DEFAULT_INT);
String maxThreadsStr = RuntimeInfo.getProperty(ApiJmsConstants.EXCEPTION_MAXTHREADS_NAME_INT,
ApiJmsConstants.EXCEPTION_MAXTHREADS_DEFAULT_INT);
try {
maxThreads = Integer.parseInt(maxThreadsStr);
} catch (NumberFormatException e) {
// No FFDC code needed, but we will exception this
SibTr.exception(tc, e);
}
// Trace the value we will use
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, ApiJmsConstants.EXCEPTION_MAXTHREADS_NAME_INT + ": " + Integer.toString(maxThreads));
// Create the thread pool
exceptionThreadPool = new ThreadPool(ApiJmsConstants.EXCEPTION_THREADPOOL_NAME_INT, 0, maxThreads);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initExceptionThreadPool");
} | java | private static void initExceptionThreadPool() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initExceptionThreadPool");
// Do a synchronous check to ensure once-only creation
synchronized (exceptionTPCreateSync) {
if (exceptionThreadPool == null) {
// Get the maximum size for the thread pool, defaulting if
// not specified or if the value cannot be parsed
int maxThreads = Integer.parseInt(ApiJmsConstants.EXCEPTION_MAXTHREADS_DEFAULT_INT);
String maxThreadsStr = RuntimeInfo.getProperty(ApiJmsConstants.EXCEPTION_MAXTHREADS_NAME_INT,
ApiJmsConstants.EXCEPTION_MAXTHREADS_DEFAULT_INT);
try {
maxThreads = Integer.parseInt(maxThreadsStr);
} catch (NumberFormatException e) {
// No FFDC code needed, but we will exception this
SibTr.exception(tc, e);
}
// Trace the value we will use
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, ApiJmsConstants.EXCEPTION_MAXTHREADS_NAME_INT + ": " + Integer.toString(maxThreads));
// Create the thread pool
exceptionThreadPool = new ThreadPool(ApiJmsConstants.EXCEPTION_THREADPOOL_NAME_INT, 0, maxThreads);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initExceptionThreadPool");
} | [
"private",
"static",
"void",
"initExceptionThreadPool",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"initExceptionThreadPool\"",
")",
";",
"// Do a synchronous check to ensure once-only creation",
"synchronized",
"(",
"exceptionTPCreateSync",
")",
"{",
"if",
"(",
"exceptionThreadPool",
"==",
"null",
")",
"{",
"// Get the maximum size for the thread pool, defaulting if",
"// not specified or if the value cannot be parsed",
"int",
"maxThreads",
"=",
"Integer",
".",
"parseInt",
"(",
"ApiJmsConstants",
".",
"EXCEPTION_MAXTHREADS_DEFAULT_INT",
")",
";",
"String",
"maxThreadsStr",
"=",
"RuntimeInfo",
".",
"getProperty",
"(",
"ApiJmsConstants",
".",
"EXCEPTION_MAXTHREADS_NAME_INT",
",",
"ApiJmsConstants",
".",
"EXCEPTION_MAXTHREADS_DEFAULT_INT",
")",
";",
"try",
"{",
"maxThreads",
"=",
"Integer",
".",
"parseInt",
"(",
"maxThreadsStr",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"// No FFDC code needed, but we will exception this",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"// Trace the value we will use",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"ApiJmsConstants",
".",
"EXCEPTION_MAXTHREADS_NAME_INT",
"+",
"\": \"",
"+",
"Integer",
".",
"toString",
"(",
"maxThreads",
")",
")",
";",
"// Create the thread pool",
"exceptionThreadPool",
"=",
"new",
"ThreadPool",
"(",
"ApiJmsConstants",
".",
"EXCEPTION_THREADPOOL_NAME_INT",
",",
"0",
",",
"maxThreads",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"initExceptionThreadPool\"",
")",
";",
"}"
] | PK59962 Ensure the existence of a single thread pool within the process | [
"PK59962",
"Ensure",
"the",
"existence",
"of",
"a",
"single",
"thread",
"pool",
"within",
"the",
"process"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java#L1167-L1197 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java | JmsConnectionImpl.addClientId | private void addClientId(String clientId) {
//Sometimes the client Id will be null. For instance in the case QueueConnectionFactory, there is no default client Id specified in metatype.xml.
if (clientId == null)
return; //do nothing
ConcurrentHashMap<String, Integer> clientIdTable = JmsFactoryFactoryImpl.getClientIdTable();
if (clientIdTable.containsKey(clientId)) {
clientIdTable.put(clientId, clientIdTable.get(clientId).intValue() + 1);
} else {
clientIdTable.put(clientId, 1);
}
} | java | private void addClientId(String clientId) {
//Sometimes the client Id will be null. For instance in the case QueueConnectionFactory, there is no default client Id specified in metatype.xml.
if (clientId == null)
return; //do nothing
ConcurrentHashMap<String, Integer> clientIdTable = JmsFactoryFactoryImpl.getClientIdTable();
if (clientIdTable.containsKey(clientId)) {
clientIdTable.put(clientId, clientIdTable.get(clientId).intValue() + 1);
} else {
clientIdTable.put(clientId, 1);
}
} | [
"private",
"void",
"addClientId",
"(",
"String",
"clientId",
")",
"{",
"//Sometimes the client Id will be null. For instance in the case QueueConnectionFactory, there is no default client Id specified in metatype.xml.",
"if",
"(",
"clientId",
"==",
"null",
")",
"return",
";",
"//do nothing",
"ConcurrentHashMap",
"<",
"String",
",",
"Integer",
">",
"clientIdTable",
"=",
"JmsFactoryFactoryImpl",
".",
"getClientIdTable",
"(",
")",
";",
"if",
"(",
"clientIdTable",
".",
"containsKey",
"(",
"clientId",
")",
")",
"{",
"clientIdTable",
".",
"put",
"(",
"clientId",
",",
"clientIdTable",
".",
"get",
"(",
"clientId",
")",
".",
"intValue",
"(",
")",
"+",
"1",
")",
";",
"}",
"else",
"{",
"clientIdTable",
".",
"put",
"(",
"clientId",
",",
"1",
")",
";",
"}",
"}"
] | If there is no entry for the given Client Id in the "clientIdTable", then add it with count as "1".
If its already exists then just increment the counter value by "1".
@param clientId | [
"If",
"there",
"is",
"no",
"entry",
"for",
"the",
"given",
"Client",
"Id",
"in",
"the",
"clientIdTable",
"then",
"add",
"it",
"with",
"count",
"as",
"1",
".",
"If",
"its",
"already",
"exists",
"then",
"just",
"increment",
"the",
"counter",
"value",
"by",
"1",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java#L1479-L1492 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java | JmsConnectionImpl.removeClientId | private void removeClientId(String clientId) {
//Sometimes the client Id will be null. For instance in the case QueueConnectionFactory, there is no default client Id specified in metatype.xml.
if (clientId == null)
return; //do nothing
ConcurrentHashMap<String, Integer> clientIdTable = JmsFactoryFactoryImpl.getClientIdTable();
if (clientIdTable.containsKey(clientId)) {
int referenceCount = clientIdTable.get(clientId).intValue();
if (referenceCount == 1) {
clientIdTable.remove(clientId);
} else {
clientIdTable.put(clientId, clientIdTable.get(clientId).intValue() - 1);
}
}
} | java | private void removeClientId(String clientId) {
//Sometimes the client Id will be null. For instance in the case QueueConnectionFactory, there is no default client Id specified in metatype.xml.
if (clientId == null)
return; //do nothing
ConcurrentHashMap<String, Integer> clientIdTable = JmsFactoryFactoryImpl.getClientIdTable();
if (clientIdTable.containsKey(clientId)) {
int referenceCount = clientIdTable.get(clientId).intValue();
if (referenceCount == 1) {
clientIdTable.remove(clientId);
} else {
clientIdTable.put(clientId, clientIdTable.get(clientId).intValue() - 1);
}
}
} | [
"private",
"void",
"removeClientId",
"(",
"String",
"clientId",
")",
"{",
"//Sometimes the client Id will be null. For instance in the case QueueConnectionFactory, there is no default client Id specified in metatype.xml. ",
"if",
"(",
"clientId",
"==",
"null",
")",
"return",
";",
"//do nothing",
"ConcurrentHashMap",
"<",
"String",
",",
"Integer",
">",
"clientIdTable",
"=",
"JmsFactoryFactoryImpl",
".",
"getClientIdTable",
"(",
")",
";",
"if",
"(",
"clientIdTable",
".",
"containsKey",
"(",
"clientId",
")",
")",
"{",
"int",
"referenceCount",
"=",
"clientIdTable",
".",
"get",
"(",
"clientId",
")",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"referenceCount",
"==",
"1",
")",
"{",
"clientIdTable",
".",
"remove",
"(",
"clientId",
")",
";",
"}",
"else",
"{",
"clientIdTable",
".",
"put",
"(",
"clientId",
",",
"clientIdTable",
".",
"get",
"(",
"clientId",
")",
".",
"intValue",
"(",
")",
"-",
"1",
")",
";",
"}",
"}",
"}"
] | To remove the client id from client table.
Whenever this method is called, the counter of respective HashMap entry is decremented by one. If the count reaches "0", then that entry wil be removed from the
clientIdTable.
@param clientId | [
"To",
"remove",
"the",
"client",
"id",
"from",
"client",
"table",
".",
"Whenever",
"this",
"method",
"is",
"called",
"the",
"counter",
"of",
"respective",
"HashMap",
"entry",
"is",
"decremented",
"by",
"one",
".",
"If",
"the",
"count",
"reaches",
"0",
"then",
"that",
"entry",
"wil",
"be",
"removed",
"from",
"the",
"clientIdTable",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java#L1501-L1516 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InvocationContextImpl.java | InvocationContextImpl.initializeForAroundConstruct | public void initializeForAroundConstruct(ManagedObjectContext managedObjectContext,
Object[] interceptors, InterceptorProxy[] proxies) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "initializeForAroundConstruct : context = " + managedObjectContext +
" interceptors = " + Arrays.toString(interceptors) + ", proxies = " + Arrays.toString(proxies));
ivBean = null;
ivManagedObjectContext = managedObjectContext;
ivInterceptors = interceptors;
ivInterceptorProxies = proxies;
ivTimer = null;
} | java | public void initializeForAroundConstruct(ManagedObjectContext managedObjectContext,
Object[] interceptors, InterceptorProxy[] proxies) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "initializeForAroundConstruct : context = " + managedObjectContext +
" interceptors = " + Arrays.toString(interceptors) + ", proxies = " + Arrays.toString(proxies));
ivBean = null;
ivManagedObjectContext = managedObjectContext;
ivInterceptors = interceptors;
ivInterceptorProxies = proxies;
ivTimer = null;
} | [
"public",
"void",
"initializeForAroundConstruct",
"(",
"ManagedObjectContext",
"managedObjectContext",
",",
"Object",
"[",
"]",
"interceptors",
",",
"InterceptorProxy",
"[",
"]",
"proxies",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"initializeForAroundConstruct : context = \"",
"+",
"managedObjectContext",
"+",
"\" interceptors = \"",
"+",
"Arrays",
".",
"toString",
"(",
"interceptors",
")",
"+",
"\", proxies = \"",
"+",
"Arrays",
".",
"toString",
"(",
"proxies",
")",
")",
";",
"ivBean",
"=",
"null",
";",
"ivManagedObjectContext",
"=",
"managedObjectContext",
";",
"ivInterceptors",
"=",
"interceptors",
";",
"ivInterceptorProxies",
"=",
"proxies",
";",
"ivTimer",
"=",
"null",
";",
"}"
] | Initialize a InvocationContext for AroundConstruct with
an array of interceptor instances created for this bean instance
and the interceptor proxies.
@param interceptors is the ordered array of interceptor instances
created for the bean.
@param proxies is an array of InterceptorProxy objects that
represent the list of AroundInvoke interceptor
methods to be invoked. | [
"Initialize",
"a",
"InvocationContext",
"for",
"AroundConstruct",
"with",
"an",
"array",
"of",
"interceptor",
"instances",
"created",
"for",
"this",
"bean",
"instance",
"and",
"the",
"interceptor",
"proxies",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InvocationContextImpl.java#L195-L205 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InvocationContextImpl.java | InvocationContextImpl.doAroundInvoke | public Object doAroundInvoke(InterceptorProxy[] proxies, Method businessMethod, Object[] parameters, EJSDeployedSupport s) //LIDB3294-41
throws Exception {
ivMethod = businessMethod;
ivParameters = parameters;
ivEJSDeployedSupport = s; //LIDB3294-41
ivInterceptorProxies = proxies;
ivIsAroundConstruct = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) // d367572.7
{
Tr.entry(tc, "doAroundInvoke for business method: " + ivMethod.getName());
}
try {
return doAroundInterceptor();
} finally // d367572.8
{
// Let the mapping strategy handle checked and unchecked exceptions
// that occurs since it knows whether to treat unchecked exceptions
// as an application exception or as a system exception.
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) // d415968
{
Tr.exit(tc, "doAroundInvoke for business method: " + ivMethod.getName());
}
ivMethod = null;
ivParameters = null;
}
} | java | public Object doAroundInvoke(InterceptorProxy[] proxies, Method businessMethod, Object[] parameters, EJSDeployedSupport s) //LIDB3294-41
throws Exception {
ivMethod = businessMethod;
ivParameters = parameters;
ivEJSDeployedSupport = s; //LIDB3294-41
ivInterceptorProxies = proxies;
ivIsAroundConstruct = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) // d367572.7
{
Tr.entry(tc, "doAroundInvoke for business method: " + ivMethod.getName());
}
try {
return doAroundInterceptor();
} finally // d367572.8
{
// Let the mapping strategy handle checked and unchecked exceptions
// that occurs since it knows whether to treat unchecked exceptions
// as an application exception or as a system exception.
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) // d415968
{
Tr.exit(tc, "doAroundInvoke for business method: " + ivMethod.getName());
}
ivMethod = null;
ivParameters = null;
}
} | [
"public",
"Object",
"doAroundInvoke",
"(",
"InterceptorProxy",
"[",
"]",
"proxies",
",",
"Method",
"businessMethod",
",",
"Object",
"[",
"]",
"parameters",
",",
"EJSDeployedSupport",
"s",
")",
"//LIDB3294-41",
"throws",
"Exception",
"{",
"ivMethod",
"=",
"businessMethod",
";",
"ivParameters",
"=",
"parameters",
";",
"ivEJSDeployedSupport",
"=",
"s",
";",
"//LIDB3294-41",
"ivInterceptorProxies",
"=",
"proxies",
";",
"ivIsAroundConstruct",
"=",
"false",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"// d367572.7",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"doAroundInvoke for business method: \"",
"+",
"ivMethod",
".",
"getName",
"(",
")",
")",
";",
"}",
"try",
"{",
"return",
"doAroundInterceptor",
"(",
")",
";",
"}",
"finally",
"// d367572.8",
"{",
"// Let the mapping strategy handle checked and unchecked exceptions",
"// that occurs since it knows whether to treat unchecked exceptions",
"// as an application exception or as a system exception.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"// d415968",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"doAroundInvoke for business method: \"",
"+",
"ivMethod",
".",
"getName",
"(",
")",
")",
";",
"}",
"ivMethod",
"=",
"null",
";",
"ivParameters",
"=",
"null",
";",
"}",
"}"
] | Invoke each AroundInvoke interceptor methods for a specified
business method of an EJB being invoked.
@param proxies is an array of InterceptorProxy objects that
represent the list of AroundInvoke interceptor
methods to be invoked.
@param businessMethod is the Method object for invoking the business method.
@param parameters is the array of arguments to be passed to business method.
@return the Object that is returned by business method.
@throws Exception from around invoke or business method. | [
"Invoke",
"each",
"AroundInvoke",
"interceptor",
"methods",
"for",
"a",
"specified",
"business",
"method",
"of",
"an",
"EJB",
"being",
"invoked",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InvocationContextImpl.java#L254-L280 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InvocationContextImpl.java | InvocationContextImpl.doAroundInterceptor | private Object doAroundInterceptor() throws Exception {
// Note, we do not call setParameters since the assumption is the
// wrapper code passes an Object array that always contains the
// correct type. If we want type checking to ensure wrapper
// code is correct, we could call setParameters(parameters) instead
// of just doing assignment here.
ivNextIndex = 0;
ivNumberOfInterceptors = ivInterceptorProxies == null ? 0 : ivInterceptorProxies.length;
ivParametersModified = false; //LIDB3294-41
return proceed();
} | java | private Object doAroundInterceptor() throws Exception {
// Note, we do not call setParameters since the assumption is the
// wrapper code passes an Object array that always contains the
// correct type. If we want type checking to ensure wrapper
// code is correct, we could call setParameters(parameters) instead
// of just doing assignment here.
ivNextIndex = 0;
ivNumberOfInterceptors = ivInterceptorProxies == null ? 0 : ivInterceptorProxies.length;
ivParametersModified = false; //LIDB3294-41
return proceed();
} | [
"private",
"Object",
"doAroundInterceptor",
"(",
")",
"throws",
"Exception",
"{",
"// Note, we do not call setParameters since the assumption is the",
"// wrapper code passes an Object array that always contains the",
"// correct type. If we want type checking to ensure wrapper",
"// code is correct, we could call setParameters(parameters) instead",
"// of just doing assignment here.",
"ivNextIndex",
"=",
"0",
";",
"ivNumberOfInterceptors",
"=",
"ivInterceptorProxies",
"==",
"null",
"?",
"0",
":",
"ivInterceptorProxies",
".",
"length",
";",
"ivParametersModified",
"=",
"false",
";",
"//LIDB3294-41",
"return",
"proceed",
"(",
")",
";",
"}"
] | Invoke each AroundInvoke or AroundConstruct interceptor methods
@return the Object that is returned by business method.
@throws Exception from around invoke or business method. | [
"Invoke",
"each",
"AroundInvoke",
"or",
"AroundConstruct",
"interceptor",
"methods"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InvocationContextImpl.java#L289-L299 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InvocationContextImpl.java | InvocationContextImpl.doLifeCycle | public void doLifeCycle(InterceptorProxy[] proxies, EJBModuleMetaDataImpl mmd) // F743-14982
{
ivMethod = null;
ivParameters = null; // d367572.8
ivInterceptorProxies = proxies;
ivNumberOfInterceptors = ivInterceptorProxies.length;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) // d367572.7
{
Tr.entry(tc, "doLifeCycle, number of interceptors = " + ivNumberOfInterceptors);
}
if (ivNumberOfInterceptors > 0) {
ivNextIndex = 0;
try {
proceed();
} catch (Throwable t) // d415968
{
// FFDCFilter.processException( t, CLASS_NAME + ".doLifeCycle", "260", this );
lifeCycleExceptionHandler(t, mmd); // d367572.7, F743-14982
} finally {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) // d415968
{
Tr.exit(tc, "doLifeCycle");
}
}
}
} | java | public void doLifeCycle(InterceptorProxy[] proxies, EJBModuleMetaDataImpl mmd) // F743-14982
{
ivMethod = null;
ivParameters = null; // d367572.8
ivInterceptorProxies = proxies;
ivNumberOfInterceptors = ivInterceptorProxies.length;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) // d367572.7
{
Tr.entry(tc, "doLifeCycle, number of interceptors = " + ivNumberOfInterceptors);
}
if (ivNumberOfInterceptors > 0) {
ivNextIndex = 0;
try {
proceed();
} catch (Throwable t) // d415968
{
// FFDCFilter.processException( t, CLASS_NAME + ".doLifeCycle", "260", this );
lifeCycleExceptionHandler(t, mmd); // d367572.7, F743-14982
} finally {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) // d415968
{
Tr.exit(tc, "doLifeCycle");
}
}
}
} | [
"public",
"void",
"doLifeCycle",
"(",
"InterceptorProxy",
"[",
"]",
"proxies",
",",
"EJBModuleMetaDataImpl",
"mmd",
")",
"// F743-14982",
"{",
"ivMethod",
"=",
"null",
";",
"ivParameters",
"=",
"null",
";",
"// d367572.8",
"ivInterceptorProxies",
"=",
"proxies",
";",
"ivNumberOfInterceptors",
"=",
"ivInterceptorProxies",
".",
"length",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"// d367572.7",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"doLifeCycle, number of interceptors = \"",
"+",
"ivNumberOfInterceptors",
")",
";",
"}",
"if",
"(",
"ivNumberOfInterceptors",
">",
"0",
")",
"{",
"ivNextIndex",
"=",
"0",
";",
"try",
"{",
"proceed",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"// d415968",
"{",
"// FFDCFilter.processException( t, CLASS_NAME + \".doLifeCycle\", \"260\", this );",
"lifeCycleExceptionHandler",
"(",
"t",
",",
"mmd",
")",
";",
"// d367572.7, F743-14982",
"}",
"finally",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"// d415968",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"doLifeCycle\"",
")",
";",
"}",
"}",
"}",
"}"
] | d450431 - add appExceptionMap parameter. | [
"d450431",
"-",
"add",
"appExceptionMap",
"parameter",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InvocationContextImpl.java#L312-L338 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InvocationContextImpl.java | InvocationContextImpl.lifeCycleExceptionHandler | private void lifeCycleExceptionHandler(Throwable t, EJBModuleMetaDataImpl mmd) // F743-14982
{
if (t instanceof RuntimeException) {
// Is the RuntimeException an application exception?
RuntimeException rtex = (RuntimeException) t;
if (mmd.getApplicationExceptionRollback(rtex) != null) // F743-14982
{
// Yes it is, which is not valid for lifecycle callback
// methods. So turn this into a system runtime exception.
InterceptorProxy w = ivInterceptorProxies[ivNextIndex - 1];
String lifeCycle = w.getMethodGenericString();
EJBException ex = ExceptionUtil.EJBException(lifeCycle
+ " is not allowed to throw an application exception", rtex);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "lifeCycleExceptionHandler throwing EJBException", ex);
}
throw ex;
} else {
// Not an application exception, so let the mapping
// strategy handle this system runtime exception.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "lifeCycleExceptionHandler is rethrowing RuntimeException "
+ "from lifecycle callback method: " + t,
t);
}
throw rtex;
}
} else if (t instanceof Error) {
// Let the mapping strategy handle this unchecked exception.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "lifeCycleExceptionHandler is rethrowing Error from "
+ "lifecycle callback method: " + t,
t);
}
throw (Error) t;
} else {
// Must be a checked exception, which should never happen since
// InterceptorMetaDataFactory throws EJBConfigurationException
// and does a Tr.error using message key of INVALID_LIFECYCLE_SIGNATURE_CNTR0231E
// if interceptor method throws clause is not empty. But if
// it does happen, wrap the exception in a special EJBException
// that does not include EJB container in the exception stack.
InterceptorProxy w = ivInterceptorProxies[ivNextIndex - 1]; // d367572.7
String lifeCycle = w.getMethodGenericString(); // d367572.7
EJBException ex = ExceptionUtil.EJBException(lifeCycle
+ " is not allowed to throw a checked exception", t);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) // d367572.7
{
Tr.debug(tc, "lifeCycleExceptionHandler throwing EJBException", ex);
}
throw ex;
}
} | java | private void lifeCycleExceptionHandler(Throwable t, EJBModuleMetaDataImpl mmd) // F743-14982
{
if (t instanceof RuntimeException) {
// Is the RuntimeException an application exception?
RuntimeException rtex = (RuntimeException) t;
if (mmd.getApplicationExceptionRollback(rtex) != null) // F743-14982
{
// Yes it is, which is not valid for lifecycle callback
// methods. So turn this into a system runtime exception.
InterceptorProxy w = ivInterceptorProxies[ivNextIndex - 1];
String lifeCycle = w.getMethodGenericString();
EJBException ex = ExceptionUtil.EJBException(lifeCycle
+ " is not allowed to throw an application exception", rtex);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "lifeCycleExceptionHandler throwing EJBException", ex);
}
throw ex;
} else {
// Not an application exception, so let the mapping
// strategy handle this system runtime exception.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "lifeCycleExceptionHandler is rethrowing RuntimeException "
+ "from lifecycle callback method: " + t,
t);
}
throw rtex;
}
} else if (t instanceof Error) {
// Let the mapping strategy handle this unchecked exception.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "lifeCycleExceptionHandler is rethrowing Error from "
+ "lifecycle callback method: " + t,
t);
}
throw (Error) t;
} else {
// Must be a checked exception, which should never happen since
// InterceptorMetaDataFactory throws EJBConfigurationException
// and does a Tr.error using message key of INVALID_LIFECYCLE_SIGNATURE_CNTR0231E
// if interceptor method throws clause is not empty. But if
// it does happen, wrap the exception in a special EJBException
// that does not include EJB container in the exception stack.
InterceptorProxy w = ivInterceptorProxies[ivNextIndex - 1]; // d367572.7
String lifeCycle = w.getMethodGenericString(); // d367572.7
EJBException ex = ExceptionUtil.EJBException(lifeCycle
+ " is not allowed to throw a checked exception", t);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) // d367572.7
{
Tr.debug(tc, "lifeCycleExceptionHandler throwing EJBException", ex);
}
throw ex;
}
} | [
"private",
"void",
"lifeCycleExceptionHandler",
"(",
"Throwable",
"t",
",",
"EJBModuleMetaDataImpl",
"mmd",
")",
"// F743-14982",
"{",
"if",
"(",
"t",
"instanceof",
"RuntimeException",
")",
"{",
"// Is the RuntimeException an application exception?",
"RuntimeException",
"rtex",
"=",
"(",
"RuntimeException",
")",
"t",
";",
"if",
"(",
"mmd",
".",
"getApplicationExceptionRollback",
"(",
"rtex",
")",
"!=",
"null",
")",
"// F743-14982",
"{",
"// Yes it is, which is not valid for lifecycle callback",
"// methods. So turn this into a system runtime exception.",
"InterceptorProxy",
"w",
"=",
"ivInterceptorProxies",
"[",
"ivNextIndex",
"-",
"1",
"]",
";",
"String",
"lifeCycle",
"=",
"w",
".",
"getMethodGenericString",
"(",
")",
";",
"EJBException",
"ex",
"=",
"ExceptionUtil",
".",
"EJBException",
"(",
"lifeCycle",
"+",
"\" is not allowed to throw an application exception\"",
",",
"rtex",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"lifeCycleExceptionHandler throwing EJBException\"",
",",
"ex",
")",
";",
"}",
"throw",
"ex",
";",
"}",
"else",
"{",
"// Not an application exception, so let the mapping",
"// strategy handle this system runtime exception.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"lifeCycleExceptionHandler is rethrowing RuntimeException \"",
"+",
"\"from lifecycle callback method: \"",
"+",
"t",
",",
"t",
")",
";",
"}",
"throw",
"rtex",
";",
"}",
"}",
"else",
"if",
"(",
"t",
"instanceof",
"Error",
")",
"{",
"// Let the mapping strategy handle this unchecked exception.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"lifeCycleExceptionHandler is rethrowing Error from \"",
"+",
"\"lifecycle callback method: \"",
"+",
"t",
",",
"t",
")",
";",
"}",
"throw",
"(",
"Error",
")",
"t",
";",
"}",
"else",
"{",
"// Must be a checked exception, which should never happen since",
"// InterceptorMetaDataFactory throws EJBConfigurationException",
"// and does a Tr.error using message key of INVALID_LIFECYCLE_SIGNATURE_CNTR0231E",
"// if interceptor method throws clause is not empty. But if",
"// it does happen, wrap the exception in a special EJBException",
"// that does not include EJB container in the exception stack.",
"InterceptorProxy",
"w",
"=",
"ivInterceptorProxies",
"[",
"ivNextIndex",
"-",
"1",
"]",
";",
"// d367572.7",
"String",
"lifeCycle",
"=",
"w",
".",
"getMethodGenericString",
"(",
")",
";",
"// d367572.7",
"EJBException",
"ex",
"=",
"ExceptionUtil",
".",
"EJBException",
"(",
"lifeCycle",
"+",
"\" is not allowed to throw a checked exception\"",
",",
"t",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"// d367572.7",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"lifeCycleExceptionHandler throwing EJBException\"",
",",
"ex",
")",
";",
"}",
"throw",
"ex",
";",
"}",
"}"
] | d450431 - ensure runtime exception is not an application exception. | [
"d450431",
"-",
"ensure",
"runtime",
"exception",
"is",
"not",
"an",
"application",
"exception",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InvocationContextImpl.java#L351-L403 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InvocationContextImpl.java | InvocationContextImpl.throwUndeclaredExceptionCause | private void throwUndeclaredExceptionCause(Throwable undeclaredException) throws Exception {
Throwable cause = undeclaredException.getCause();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "proceed unwrappering " + undeclaredException.getClass().getSimpleName() + " : " + cause, cause);
// CDI interceptors tend to result in a UndeclaredThrowableException wrapped in an InvocationTargetException
if (cause instanceof UndeclaredThrowableException) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "proceed unwrappering " + cause.getClass().getSimpleName() + " : " + cause, cause.getCause());
cause = cause.getCause();
}
if (cause instanceof RuntimeException) {
// Let the mapping strategy handle this unchecked exception.
throw (RuntimeException) cause;
} else if (cause instanceof Error) {
// Let the mapping strategy handle this unchecked exception.
throw (Error) cause;
} else {
// Probably an application exception occurred, so just throw it. The mapping
// strategy will handle if it turns out not to be an application exception.
throw (Exception) cause;
}
} | java | private void throwUndeclaredExceptionCause(Throwable undeclaredException) throws Exception {
Throwable cause = undeclaredException.getCause();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "proceed unwrappering " + undeclaredException.getClass().getSimpleName() + " : " + cause, cause);
// CDI interceptors tend to result in a UndeclaredThrowableException wrapped in an InvocationTargetException
if (cause instanceof UndeclaredThrowableException) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "proceed unwrappering " + cause.getClass().getSimpleName() + " : " + cause, cause.getCause());
cause = cause.getCause();
}
if (cause instanceof RuntimeException) {
// Let the mapping strategy handle this unchecked exception.
throw (RuntimeException) cause;
} else if (cause instanceof Error) {
// Let the mapping strategy handle this unchecked exception.
throw (Error) cause;
} else {
// Probably an application exception occurred, so just throw it. The mapping
// strategy will handle if it turns out not to be an application exception.
throw (Exception) cause;
}
} | [
"private",
"void",
"throwUndeclaredExceptionCause",
"(",
"Throwable",
"undeclaredException",
")",
"throws",
"Exception",
"{",
"Throwable",
"cause",
"=",
"undeclaredException",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"proceed unwrappering \"",
"+",
"undeclaredException",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\" : \"",
"+",
"cause",
",",
"cause",
")",
";",
"// CDI interceptors tend to result in a UndeclaredThrowableException wrapped in an InvocationTargetException",
"if",
"(",
"cause",
"instanceof",
"UndeclaredThrowableException",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"proceed unwrappering \"",
"+",
"cause",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\" : \"",
"+",
"cause",
",",
"cause",
".",
"getCause",
"(",
")",
")",
";",
"cause",
"=",
"cause",
".",
"getCause",
"(",
")",
";",
"}",
"if",
"(",
"cause",
"instanceof",
"RuntimeException",
")",
"{",
"// Let the mapping strategy handle this unchecked exception.",
"throw",
"(",
"RuntimeException",
")",
"cause",
";",
"}",
"else",
"if",
"(",
"cause",
"instanceof",
"Error",
")",
"{",
"// Let the mapping strategy handle this unchecked exception.",
"throw",
"(",
"Error",
")",
"cause",
";",
"}",
"else",
"{",
"// Probably an application exception occurred, so just throw it. The mapping",
"// strategy will handle if it turns out not to be an application exception.",
"throw",
"(",
"Exception",
")",
"cause",
";",
"}",
"}"
] | Since some interceptor methods cannot throw 'Exception', but the target
method on the bean can throw application exceptions, this method may be
used to unwrap the application exception from either an
InvocationTargetException or UndeclaredThrowableException.
@param undeclaredException the InvocationTargetException or UndeclaredThrowableException
that is wrapping the real application exception.
@throws Exception the application exception | [
"Since",
"some",
"interceptor",
"methods",
"cannot",
"throw",
"Exception",
"but",
"the",
"target",
"method",
"on",
"the",
"bean",
"can",
"throw",
"application",
"exceptions",
"this",
"method",
"may",
"be",
"used",
"to",
"unwrap",
"the",
"application",
"exception",
"from",
"either",
"an",
"InvocationTargetException",
"or",
"UndeclaredThrowableException",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InvocationContextImpl.java#L624-L645 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/UnauthenticatedSubjectServiceImpl.java | UnauthenticatedSubjectServiceImpl.setCredentialProvider | protected void setCredentialProvider(ServiceReference<CredentialProvider> ref) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Resetting unauthenticatedSubject as new CredentialProvider has been set");
}
synchronized (unauthenticatedSubjectLock) {
unauthenticatedSubject = null;
}
} | java | protected void setCredentialProvider(ServiceReference<CredentialProvider> ref) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Resetting unauthenticatedSubject as new CredentialProvider has been set");
}
synchronized (unauthenticatedSubjectLock) {
unauthenticatedSubject = null;
}
} | [
"protected",
"void",
"setCredentialProvider",
"(",
"ServiceReference",
"<",
"CredentialProvider",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Resetting unauthenticatedSubject as new CredentialProvider has been set\"",
")",
";",
"}",
"synchronized",
"(",
"unauthenticatedSubjectLock",
")",
"{",
"unauthenticatedSubject",
"=",
"null",
";",
"}",
"}"
] | When CredentialProviders come and go, reset the unauthenticated subject.
@param ref | [
"When",
"CredentialProviders",
"come",
"and",
"go",
"reset",
"the",
"unauthenticated",
"subject",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/UnauthenticatedSubjectServiceImpl.java#L73-L80 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/UnauthenticatedSubjectServiceImpl.java | UnauthenticatedSubjectServiceImpl.getUnauthenticatedSubject | @Override
@FFDCIgnore(Exception.class)
public Subject getUnauthenticatedSubject() {
if (unauthenticatedSubject == null) {
CredentialsService cs = credentialsServiceRef.getService();
String unauthenticatedUserid = cs.getUnauthenticatedUserid();
try {
Subject subject = new Subject();
Hashtable<String, Object> hashtable = new Hashtable<String, Object>();
hashtable.put(AttributeNameConstants.WSCREDENTIAL_SECURITYNAME, unauthenticatedUserid);
hashtable.put(AttributeNameConstants.WSCREDENTIAL_UNIQUEID,
AccessIdUtil.createAccessId(AccessIdUtil.TYPE_USER, getUserRegistryRealm(), unauthenticatedUserid));
subject.getPublicCredentials().add(hashtable);
SecurityService securityService = securityServiceRef.getService();
AuthenticationService authenticationService = securityService.getAuthenticationService();
Subject tempUnauthenticatedSubject = authenticationService.authenticate(JaasLoginConfigConstants.SYSTEM_UNAUTHENTICATED, subject);
tempUnauthenticatedSubject.setReadOnly();
synchronized (unauthenticatedSubjectLock) {
if (unauthenticatedSubject == null) {
unauthenticatedSubject = tempUnauthenticatedSubject;
}
}
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Internal error creating UNAUTHENTICATED subject.", e);
}
}
}
return unauthenticatedSubject;
} | java | @Override
@FFDCIgnore(Exception.class)
public Subject getUnauthenticatedSubject() {
if (unauthenticatedSubject == null) {
CredentialsService cs = credentialsServiceRef.getService();
String unauthenticatedUserid = cs.getUnauthenticatedUserid();
try {
Subject subject = new Subject();
Hashtable<String, Object> hashtable = new Hashtable<String, Object>();
hashtable.put(AttributeNameConstants.WSCREDENTIAL_SECURITYNAME, unauthenticatedUserid);
hashtable.put(AttributeNameConstants.WSCREDENTIAL_UNIQUEID,
AccessIdUtil.createAccessId(AccessIdUtil.TYPE_USER, getUserRegistryRealm(), unauthenticatedUserid));
subject.getPublicCredentials().add(hashtable);
SecurityService securityService = securityServiceRef.getService();
AuthenticationService authenticationService = securityService.getAuthenticationService();
Subject tempUnauthenticatedSubject = authenticationService.authenticate(JaasLoginConfigConstants.SYSTEM_UNAUTHENTICATED, subject);
tempUnauthenticatedSubject.setReadOnly();
synchronized (unauthenticatedSubjectLock) {
if (unauthenticatedSubject == null) {
unauthenticatedSubject = tempUnauthenticatedSubject;
}
}
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Internal error creating UNAUTHENTICATED subject.", e);
}
}
}
return unauthenticatedSubject;
} | [
"@",
"Override",
"@",
"FFDCIgnore",
"(",
"Exception",
".",
"class",
")",
"public",
"Subject",
"getUnauthenticatedSubject",
"(",
")",
"{",
"if",
"(",
"unauthenticatedSubject",
"==",
"null",
")",
"{",
"CredentialsService",
"cs",
"=",
"credentialsServiceRef",
".",
"getService",
"(",
")",
";",
"String",
"unauthenticatedUserid",
"=",
"cs",
".",
"getUnauthenticatedUserid",
"(",
")",
";",
"try",
"{",
"Subject",
"subject",
"=",
"new",
"Subject",
"(",
")",
";",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"hashtable",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"hashtable",
".",
"put",
"(",
"AttributeNameConstants",
".",
"WSCREDENTIAL_SECURITYNAME",
",",
"unauthenticatedUserid",
")",
";",
"hashtable",
".",
"put",
"(",
"AttributeNameConstants",
".",
"WSCREDENTIAL_UNIQUEID",
",",
"AccessIdUtil",
".",
"createAccessId",
"(",
"AccessIdUtil",
".",
"TYPE_USER",
",",
"getUserRegistryRealm",
"(",
")",
",",
"unauthenticatedUserid",
")",
")",
";",
"subject",
".",
"getPublicCredentials",
"(",
")",
".",
"add",
"(",
"hashtable",
")",
";",
"SecurityService",
"securityService",
"=",
"securityServiceRef",
".",
"getService",
"(",
")",
";",
"AuthenticationService",
"authenticationService",
"=",
"securityService",
".",
"getAuthenticationService",
"(",
")",
";",
"Subject",
"tempUnauthenticatedSubject",
"=",
"authenticationService",
".",
"authenticate",
"(",
"JaasLoginConfigConstants",
".",
"SYSTEM_UNAUTHENTICATED",
",",
"subject",
")",
";",
"tempUnauthenticatedSubject",
".",
"setReadOnly",
"(",
")",
";",
"synchronized",
"(",
"unauthenticatedSubjectLock",
")",
"{",
"if",
"(",
"unauthenticatedSubject",
"==",
"null",
")",
"{",
"unauthenticatedSubject",
"=",
"tempUnauthenticatedSubject",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Internal error creating UNAUTHENTICATED subject.\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"return",
"unauthenticatedSubject",
";",
"}"
] | Return the unauthenticated subject. If we don't already have one create it.
@return unauthenticated subject | [
"Return",
"the",
"unauthenticated",
"subject",
".",
"If",
"we",
"don",
"t",
"already",
"have",
"one",
"create",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/UnauthenticatedSubjectServiceImpl.java#L147-L176 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/core/WSX509KeyManager.java | WSX509KeyManager.setClientAlias | public void setClientAlias(String alias) throws Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "setClientAlias", new Object[] { alias });
if (!ks.containsAlias(alias)) {
String keyFileName = config.getProperty(Constants.SSLPROP_KEY_STORE);
String tokenLibraryFile = config.getProperty(Constants.SSLPROP_TOKEN_LIBRARY);
String location = keyFileName != null ? keyFileName : tokenLibraryFile;
String message = TraceNLSHelper.getInstance().getFormattedMessage("ssl.client.alias.not.found.CWPKI0023E", new Object[] { alias, location },
"Client alias " + alias + " not found in keystore.");
Tr.error(tc, "ssl.client.alias.not.found.CWPKI0023E", new Object[] { alias, location });
throw new IllegalArgumentException(message);
}
this.clientAlias = alias;
if (customKM != null && customKM instanceof KeyManagerExtendedInfo)
((KeyManagerExtendedInfo) customKM).setKeyStoreClientAlias(alias);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "setClientAlias");
} | java | public void setClientAlias(String alias) throws Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "setClientAlias", new Object[] { alias });
if (!ks.containsAlias(alias)) {
String keyFileName = config.getProperty(Constants.SSLPROP_KEY_STORE);
String tokenLibraryFile = config.getProperty(Constants.SSLPROP_TOKEN_LIBRARY);
String location = keyFileName != null ? keyFileName : tokenLibraryFile;
String message = TraceNLSHelper.getInstance().getFormattedMessage("ssl.client.alias.not.found.CWPKI0023E", new Object[] { alias, location },
"Client alias " + alias + " not found in keystore.");
Tr.error(tc, "ssl.client.alias.not.found.CWPKI0023E", new Object[] { alias, location });
throw new IllegalArgumentException(message);
}
this.clientAlias = alias;
if (customKM != null && customKM instanceof KeyManagerExtendedInfo)
((KeyManagerExtendedInfo) customKM).setKeyStoreClientAlias(alias);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "setClientAlias");
} | [
"public",
"void",
"setClientAlias",
"(",
"String",
"alias",
")",
"throws",
"Exception",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"setClientAlias\"",
",",
"new",
"Object",
"[",
"]",
"{",
"alias",
"}",
")",
";",
"if",
"(",
"!",
"ks",
".",
"containsAlias",
"(",
"alias",
")",
")",
"{",
"String",
"keyFileName",
"=",
"config",
".",
"getProperty",
"(",
"Constants",
".",
"SSLPROP_KEY_STORE",
")",
";",
"String",
"tokenLibraryFile",
"=",
"config",
".",
"getProperty",
"(",
"Constants",
".",
"SSLPROP_TOKEN_LIBRARY",
")",
";",
"String",
"location",
"=",
"keyFileName",
"!=",
"null",
"?",
"keyFileName",
":",
"tokenLibraryFile",
";",
"String",
"message",
"=",
"TraceNLSHelper",
".",
"getInstance",
"(",
")",
".",
"getFormattedMessage",
"(",
"\"ssl.client.alias.not.found.CWPKI0023E\"",
",",
"new",
"Object",
"[",
"]",
"{",
"alias",
",",
"location",
"}",
",",
"\"Client alias \"",
"+",
"alias",
"+",
"\" not found in keystore.\"",
")",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"ssl.client.alias.not.found.CWPKI0023E\"",
",",
"new",
"Object",
"[",
"]",
"{",
"alias",
",",
"location",
"}",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
";",
"}",
"this",
".",
"clientAlias",
"=",
"alias",
";",
"if",
"(",
"customKM",
"!=",
"null",
"&&",
"customKM",
"instanceof",
"KeyManagerExtendedInfo",
")",
"(",
"(",
"KeyManagerExtendedInfo",
")",
"customKM",
")",
".",
"setKeyStoreClientAlias",
"(",
"alias",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"setClientAlias\"",
")",
";",
"}"
] | Set the client alias value for the given slot number.
@param alias
@param slotnum
@throws Exception | [
"Set",
"the",
"client",
"alias",
"value",
"for",
"the",
"given",
"slot",
"number",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/core/WSX509KeyManager.java#L118-L138 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/core/WSX509KeyManager.java | WSX509KeyManager.chooseClientAlias | public String chooseClientAlias(String keyType, Principal[] issuers) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "chooseClientAlias", new Object[] { keyType, issuers });
Map<String, Object> connectionInfo = JSSEHelper.getInstance().getOutboundConnectionInfo();
// if SSL client auth is disabled do not return a client alias
if (connectionInfo != null && Constants.ENDPOINT_IIOP.equals(connectionInfo.get(Constants.CONNECTION_INFO_ENDPOINT_NAME))
&& !SSLConfigManager.getInstance().isClientAuthenticationEnabled()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "chooseClientAlias: null");
return null;
} else if (clientAlias != null && !clientAlias.equals("")) {
String[] list = km.getClientAliases(keyType, issuers);
if (list != null) {
boolean found = false;
for (int i = 0; i < list.length && !found; i++) {
if (clientAlias.equalsIgnoreCase(list[i]))
found = true;
}
if (found) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "chooseClientAlias", new Object[] { clientAlias });
// JCERACFKS and JCECCARACFKS support mixed case, if we see that type,
// do not lowercase the alias
if (ks.getType() != null
&& (ks.getType().equals(Constants.KEYSTORE_TYPE_JCERACFKS) || ks.getType().equals(Constants.KEYSTORE_TYPE_JCECCARACFKS) || ks.getType().equals(Constants.KEYSTORE_TYPE_JCEHYBRIDRACFKS))) {
return clientAlias;
}
return clientAlias.toLowerCase();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "chooseClientAlias (default)", new Object[] { clientAlias });
// error case, alias not found in the list.
return clientAlias;
} else {
String[] keyArray = new String[] { keyType };
String alias = km.chooseClientAlias(keyArray, issuers, null);
// JCERACFKS and JCECCARACFKS support mixed case, if we see that type, do
// not lowercase the alias
if (ks.getType() != null
&& (!ks.getType().equals(Constants.KEYSTORE_TYPE_JCERACFKS) && !ks.getType().equals(Constants.KEYSTORE_TYPE_JCECCARACFKS) && !ks.getType().equals(Constants.KEYSTORE_TYPE_JCEHYBRIDRACFKS))) {
if (alias != null) {
alias = alias.toLowerCase();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "chooseClientAlias (from JSSE)", new Object[] { alias });
return alias;
}
} | java | public String chooseClientAlias(String keyType, Principal[] issuers) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "chooseClientAlias", new Object[] { keyType, issuers });
Map<String, Object> connectionInfo = JSSEHelper.getInstance().getOutboundConnectionInfo();
// if SSL client auth is disabled do not return a client alias
if (connectionInfo != null && Constants.ENDPOINT_IIOP.equals(connectionInfo.get(Constants.CONNECTION_INFO_ENDPOINT_NAME))
&& !SSLConfigManager.getInstance().isClientAuthenticationEnabled()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "chooseClientAlias: null");
return null;
} else if (clientAlias != null && !clientAlias.equals("")) {
String[] list = km.getClientAliases(keyType, issuers);
if (list != null) {
boolean found = false;
for (int i = 0; i < list.length && !found; i++) {
if (clientAlias.equalsIgnoreCase(list[i]))
found = true;
}
if (found) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "chooseClientAlias", new Object[] { clientAlias });
// JCERACFKS and JCECCARACFKS support mixed case, if we see that type,
// do not lowercase the alias
if (ks.getType() != null
&& (ks.getType().equals(Constants.KEYSTORE_TYPE_JCERACFKS) || ks.getType().equals(Constants.KEYSTORE_TYPE_JCECCARACFKS) || ks.getType().equals(Constants.KEYSTORE_TYPE_JCEHYBRIDRACFKS))) {
return clientAlias;
}
return clientAlias.toLowerCase();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "chooseClientAlias (default)", new Object[] { clientAlias });
// error case, alias not found in the list.
return clientAlias;
} else {
String[] keyArray = new String[] { keyType };
String alias = km.chooseClientAlias(keyArray, issuers, null);
// JCERACFKS and JCECCARACFKS support mixed case, if we see that type, do
// not lowercase the alias
if (ks.getType() != null
&& (!ks.getType().equals(Constants.KEYSTORE_TYPE_JCERACFKS) && !ks.getType().equals(Constants.KEYSTORE_TYPE_JCECCARACFKS) && !ks.getType().equals(Constants.KEYSTORE_TYPE_JCEHYBRIDRACFKS))) {
if (alias != null) {
alias = alias.toLowerCase();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "chooseClientAlias (from JSSE)", new Object[] { alias });
return alias;
}
} | [
"public",
"String",
"chooseClientAlias",
"(",
"String",
"keyType",
",",
"Principal",
"[",
"]",
"issuers",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"chooseClientAlias\"",
",",
"new",
"Object",
"[",
"]",
"{",
"keyType",
",",
"issuers",
"}",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"connectionInfo",
"=",
"JSSEHelper",
".",
"getInstance",
"(",
")",
".",
"getOutboundConnectionInfo",
"(",
")",
";",
"// if SSL client auth is disabled do not return a client alias",
"if",
"(",
"connectionInfo",
"!=",
"null",
"&&",
"Constants",
".",
"ENDPOINT_IIOP",
".",
"equals",
"(",
"connectionInfo",
".",
"get",
"(",
"Constants",
".",
"CONNECTION_INFO_ENDPOINT_NAME",
")",
")",
"&&",
"!",
"SSLConfigManager",
".",
"getInstance",
"(",
")",
".",
"isClientAuthenticationEnabled",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"chooseClientAlias: null\"",
")",
";",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"clientAlias",
"!=",
"null",
"&&",
"!",
"clientAlias",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"String",
"[",
"]",
"list",
"=",
"km",
".",
"getClientAliases",
"(",
"keyType",
",",
"issuers",
")",
";",
"if",
"(",
"list",
"!=",
"null",
")",
"{",
"boolean",
"found",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"length",
"&&",
"!",
"found",
";",
"i",
"++",
")",
"{",
"if",
"(",
"clientAlias",
".",
"equalsIgnoreCase",
"(",
"list",
"[",
"i",
"]",
")",
")",
"found",
"=",
"true",
";",
"}",
"if",
"(",
"found",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"chooseClientAlias\"",
",",
"new",
"Object",
"[",
"]",
"{",
"clientAlias",
"}",
")",
";",
"// JCERACFKS and JCECCARACFKS support mixed case, if we see that type,",
"// do not lowercase the alias",
"if",
"(",
"ks",
".",
"getType",
"(",
")",
"!=",
"null",
"&&",
"(",
"ks",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"Constants",
".",
"KEYSTORE_TYPE_JCERACFKS",
")",
"||",
"ks",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"Constants",
".",
"KEYSTORE_TYPE_JCECCARACFKS",
")",
"||",
"ks",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"Constants",
".",
"KEYSTORE_TYPE_JCEHYBRIDRACFKS",
")",
")",
")",
"{",
"return",
"clientAlias",
";",
"}",
"return",
"clientAlias",
".",
"toLowerCase",
"(",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"chooseClientAlias (default)\"",
",",
"new",
"Object",
"[",
"]",
"{",
"clientAlias",
"}",
")",
";",
"// error case, alias not found in the list.",
"return",
"clientAlias",
";",
"}",
"else",
"{",
"String",
"[",
"]",
"keyArray",
"=",
"new",
"String",
"[",
"]",
"{",
"keyType",
"}",
";",
"String",
"alias",
"=",
"km",
".",
"chooseClientAlias",
"(",
"keyArray",
",",
"issuers",
",",
"null",
")",
";",
"// JCERACFKS and JCECCARACFKS support mixed case, if we see that type, do",
"// not lowercase the alias",
"if",
"(",
"ks",
".",
"getType",
"(",
")",
"!=",
"null",
"&&",
"(",
"!",
"ks",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"Constants",
".",
"KEYSTORE_TYPE_JCERACFKS",
")",
"&&",
"!",
"ks",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"Constants",
".",
"KEYSTORE_TYPE_JCECCARACFKS",
")",
"&&",
"!",
"ks",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"Constants",
".",
"KEYSTORE_TYPE_JCEHYBRIDRACFKS",
")",
")",
")",
"{",
"if",
"(",
"alias",
"!=",
"null",
")",
"{",
"alias",
"=",
"alias",
".",
"toLowerCase",
"(",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"chooseClientAlias (from JSSE)\"",
",",
"new",
"Object",
"[",
"]",
"{",
"alias",
"}",
")",
";",
"return",
"alias",
";",
"}",
"}"
] | Choose a client alias.
@param keyType
@param issuers
@return String | [
"Choose",
"a",
"client",
"alias",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/core/WSX509KeyManager.java#L248-L305 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/core/WSX509KeyManager.java | WSX509KeyManager.chooseEngineServerAlias | @Override
public String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "chooseEngineServerAlias", new Object[] { keyType, issuers, engine });
String rc = null;
if (null != customKM && customKM instanceof X509ExtendedKeyManager) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "chooseEngineServerAlias, using customKM -> " + customKM.getClass().getName());
rc = ((X509ExtendedKeyManager) customKM).chooseEngineServerAlias(keyType, issuers, engine);
} else {
rc = chooseServerAlias(keyType, issuers);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "chooseEngineServerAlias: " + rc);
return rc;
} | java | @Override
public String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "chooseEngineServerAlias", new Object[] { keyType, issuers, engine });
String rc = null;
if (null != customKM && customKM instanceof X509ExtendedKeyManager) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "chooseEngineServerAlias, using customKM -> " + customKM.getClass().getName());
rc = ((X509ExtendedKeyManager) customKM).chooseEngineServerAlias(keyType, issuers, engine);
} else {
rc = chooseServerAlias(keyType, issuers);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "chooseEngineServerAlias: " + rc);
return rc;
} | [
"@",
"Override",
"public",
"String",
"chooseEngineServerAlias",
"(",
"String",
"keyType",
",",
"Principal",
"[",
"]",
"issuers",
",",
"SSLEngine",
"engine",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"chooseEngineServerAlias\"",
",",
"new",
"Object",
"[",
"]",
"{",
"keyType",
",",
"issuers",
",",
"engine",
"}",
")",
";",
"String",
"rc",
"=",
"null",
";",
"if",
"(",
"null",
"!=",
"customKM",
"&&",
"customKM",
"instanceof",
"X509ExtendedKeyManager",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"chooseEngineServerAlias, using customKM -> \"",
"+",
"customKM",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"rc",
"=",
"(",
"(",
"X509ExtendedKeyManager",
")",
"customKM",
")",
".",
"chooseEngineServerAlias",
"(",
"keyType",
",",
"issuers",
",",
"engine",
")",
";",
"}",
"else",
"{",
"rc",
"=",
"chooseServerAlias",
"(",
"keyType",
",",
"issuers",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"chooseEngineServerAlias: \"",
"+",
"rc",
")",
";",
"return",
"rc",
";",
"}"
] | Handshakes that use the SSLEngine and not an SSLSocket require this method
from the extended X509KeyManager.
@see javax.net.ssl.X509ExtendedKeyManager#chooseEngineServerAlias(java.lang.String, java.security.Principal[], javax.net.ssl.SSLEngine) | [
"Handshakes",
"that",
"use",
"the",
"SSLEngine",
"and",
"not",
"an",
"SSLSocket",
"require",
"this",
"method",
"from",
"the",
"extended",
"X509KeyManager",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/core/WSX509KeyManager.java#L313-L329 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/core/WSX509KeyManager.java | WSX509KeyManager.getX509KeyManager | public X509KeyManager getX509KeyManager() {
if (customKM != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getX509KeyManager -> " + customKM.getClass().getName());
return customKM;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getX509KeyManager -> " + km.getClass().getName());
return km;
} | java | public X509KeyManager getX509KeyManager() {
if (customKM != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getX509KeyManager -> " + customKM.getClass().getName());
return customKM;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getX509KeyManager -> " + km.getClass().getName());
return km;
} | [
"public",
"X509KeyManager",
"getX509KeyManager",
"(",
")",
"{",
"if",
"(",
"customKM",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getX509KeyManager -> \"",
"+",
"customKM",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"return",
"customKM",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getX509KeyManager -> \"",
"+",
"km",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"return",
"km",
";",
"}"
] | Get the appropriate X509KeyManager for this instance.
@return X509KeyManager | [
"Get",
"the",
"appropriate",
"X509KeyManager",
"for",
"this",
"instance",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/core/WSX509KeyManager.java#L496-L505 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/AlpnSupportUtils.java | AlpnSupportUtils.getAlpnResult | protected static void getAlpnResult(SSLEngine engine, SSLConnectionLink link) {
alpnNegotiator.tryToRemoveAlpnNegotiator(link.getAlpnNegotiator(), engine, link);
} | java | protected static void getAlpnResult(SSLEngine engine, SSLConnectionLink link) {
alpnNegotiator.tryToRemoveAlpnNegotiator(link.getAlpnNegotiator(), engine, link);
} | [
"protected",
"static",
"void",
"getAlpnResult",
"(",
"SSLEngine",
"engine",
",",
"SSLConnectionLink",
"link",
")",
"{",
"alpnNegotiator",
".",
"tryToRemoveAlpnNegotiator",
"(",
"link",
".",
"getAlpnNegotiator",
"(",
")",
",",
"engine",
",",
"link",
")",
";",
"}"
] | This must be called after the SSL handshake has completed. If an ALPN protocol was selected by the available provider,
that protocol will be set on the SSLConnectionLink. Also, additional cleanup will be done for some ALPN providers.
@param SSLEngine
@param SSLConnectionLink | [
"This",
"must",
"be",
"called",
"after",
"the",
"SSL",
"handshake",
"has",
"completed",
".",
"If",
"an",
"ALPN",
"protocol",
"was",
"selected",
"by",
"the",
"available",
"provider",
"that",
"protocol",
"will",
"be",
"set",
"on",
"the",
"SSLConnectionLink",
".",
"Also",
"additional",
"cleanup",
"will",
"be",
"done",
"for",
"some",
"ALPN",
"providers",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/AlpnSupportUtils.java#L58-L60 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.metadataProcessingInitialize | void metadataProcessingInitialize(ComponentNameSpaceConfiguration nameSpaceConfig)
{
ivContext = (InjectionProcessorContext) nameSpaceConfig.getInjectionProcessorContext();
ivNameSpaceConfig = nameSpaceConfig;
// Following must be available after ivContext and ivNameSpaceConfig are cleared
ivCheckAppConfig = nameSpaceConfig.isCheckApplicationConfiguration();
} | java | void metadataProcessingInitialize(ComponentNameSpaceConfiguration nameSpaceConfig)
{
ivContext = (InjectionProcessorContext) nameSpaceConfig.getInjectionProcessorContext();
ivNameSpaceConfig = nameSpaceConfig;
// Following must be available after ivContext and ivNameSpaceConfig are cleared
ivCheckAppConfig = nameSpaceConfig.isCheckApplicationConfiguration();
} | [
"void",
"metadataProcessingInitialize",
"(",
"ComponentNameSpaceConfiguration",
"nameSpaceConfig",
")",
"{",
"ivContext",
"=",
"(",
"InjectionProcessorContext",
")",
"nameSpaceConfig",
".",
"getInjectionProcessorContext",
"(",
")",
";",
"ivNameSpaceConfig",
"=",
"nameSpaceConfig",
";",
"// Following must be available after ivContext and ivNameSpaceConfig are cleared",
"ivCheckAppConfig",
"=",
"nameSpaceConfig",
".",
"isCheckApplicationConfiguration",
"(",
")",
";",
"}"
] | d730349.1 | [
"d730349",
".",
"1"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L225-L232 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.mergeError | protected void mergeError(Object oldValue,
Object newValue,
boolean xml,
String elementName,
boolean property,
String key) throws InjectionConfigurationException {
JNDIEnvironmentRefType refType = getJNDIEnvironmentRefType();
String component = ivNameSpaceConfig.getDisplayName();
String module = ivNameSpaceConfig.getModuleName();
String application = ivNameSpaceConfig.getApplicationName();
String jndiName = getJndiName();
if (xml) {
Tr.error(tc, "CONFLICTING_XML_VALUES_CWNEN0052E",
component,
module,
application,
elementName,
refType.getXMLElementName(),
refType.getNameXMLElementName(),
jndiName,
oldValue,
newValue);
} else {
Tr.error(tc, "CONFLICTING_ANNOTATION_VALUES_CWNEN0054E",
component,
module,
application,
elementName,
'@' + refType.getAnnotationShortName(),
refType.getNameAnnotationElementName(),
jndiName,
oldValue,
newValue);
}
String exMsg;
if (xml) {
exMsg = "The " + component +
" component in the " + module +
" module of the " + application +
" application has conflicting configuration data in the XML" +
" deployment descriptor. Conflicting " + elementName +
" element values exist for multiple " + refType.getXMLElementName() +
" elements with the same " + refType.getNameXMLElementName() +
" element value : " + jndiName +
". The conflicting " + elementName +
" element values are " + oldValue +
" and " + newValue + ".";
} else {
exMsg = "The " + component +
" component in the " + module +
" module of the " + application +
" application has conflicting configuration data" +
" in source code annotations. Conflicting " + elementName +
" attribute values exist for multiple @" + refType.getAnnotationShortName() +
" annotations with the same " + refType.getNameAnnotationElementName() +
" attribute value : " + jndiName +
". The conflicting " + elementName +
" attribute values are " + oldValue +
" and " + newValue + ".";
}
throw new InjectionConfigurationException(exMsg);
} | java | protected void mergeError(Object oldValue,
Object newValue,
boolean xml,
String elementName,
boolean property,
String key) throws InjectionConfigurationException {
JNDIEnvironmentRefType refType = getJNDIEnvironmentRefType();
String component = ivNameSpaceConfig.getDisplayName();
String module = ivNameSpaceConfig.getModuleName();
String application = ivNameSpaceConfig.getApplicationName();
String jndiName = getJndiName();
if (xml) {
Tr.error(tc, "CONFLICTING_XML_VALUES_CWNEN0052E",
component,
module,
application,
elementName,
refType.getXMLElementName(),
refType.getNameXMLElementName(),
jndiName,
oldValue,
newValue);
} else {
Tr.error(tc, "CONFLICTING_ANNOTATION_VALUES_CWNEN0054E",
component,
module,
application,
elementName,
'@' + refType.getAnnotationShortName(),
refType.getNameAnnotationElementName(),
jndiName,
oldValue,
newValue);
}
String exMsg;
if (xml) {
exMsg = "The " + component +
" component in the " + module +
" module of the " + application +
" application has conflicting configuration data in the XML" +
" deployment descriptor. Conflicting " + elementName +
" element values exist for multiple " + refType.getXMLElementName() +
" elements with the same " + refType.getNameXMLElementName() +
" element value : " + jndiName +
". The conflicting " + elementName +
" element values are " + oldValue +
" and " + newValue + ".";
} else {
exMsg = "The " + component +
" component in the " + module +
" module of the " + application +
" application has conflicting configuration data" +
" in source code annotations. Conflicting " + elementName +
" attribute values exist for multiple @" + refType.getAnnotationShortName() +
" annotations with the same " + refType.getNameAnnotationElementName() +
" attribute value : " + jndiName +
". The conflicting " + elementName +
" attribute values are " + oldValue +
" and " + newValue + ".";
}
throw new InjectionConfigurationException(exMsg);
} | [
"protected",
"void",
"mergeError",
"(",
"Object",
"oldValue",
",",
"Object",
"newValue",
",",
"boolean",
"xml",
",",
"String",
"elementName",
",",
"boolean",
"property",
",",
"String",
"key",
")",
"throws",
"InjectionConfigurationException",
"{",
"JNDIEnvironmentRefType",
"refType",
"=",
"getJNDIEnvironmentRefType",
"(",
")",
";",
"String",
"component",
"=",
"ivNameSpaceConfig",
".",
"getDisplayName",
"(",
")",
";",
"String",
"module",
"=",
"ivNameSpaceConfig",
".",
"getModuleName",
"(",
")",
";",
"String",
"application",
"=",
"ivNameSpaceConfig",
".",
"getApplicationName",
"(",
")",
";",
"String",
"jndiName",
"=",
"getJndiName",
"(",
")",
";",
"if",
"(",
"xml",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"CONFLICTING_XML_VALUES_CWNEN0052E\"",
",",
"component",
",",
"module",
",",
"application",
",",
"elementName",
",",
"refType",
".",
"getXMLElementName",
"(",
")",
",",
"refType",
".",
"getNameXMLElementName",
"(",
")",
",",
"jndiName",
",",
"oldValue",
",",
"newValue",
")",
";",
"}",
"else",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"CONFLICTING_ANNOTATION_VALUES_CWNEN0054E\"",
",",
"component",
",",
"module",
",",
"application",
",",
"elementName",
",",
"'",
"'",
"+",
"refType",
".",
"getAnnotationShortName",
"(",
")",
",",
"refType",
".",
"getNameAnnotationElementName",
"(",
")",
",",
"jndiName",
",",
"oldValue",
",",
"newValue",
")",
";",
"}",
"String",
"exMsg",
";",
"if",
"(",
"xml",
")",
"{",
"exMsg",
"=",
"\"The \"",
"+",
"component",
"+",
"\" component in the \"",
"+",
"module",
"+",
"\" module of the \"",
"+",
"application",
"+",
"\" application has conflicting configuration data in the XML\"",
"+",
"\" deployment descriptor. Conflicting \"",
"+",
"elementName",
"+",
"\" element values exist for multiple \"",
"+",
"refType",
".",
"getXMLElementName",
"(",
")",
"+",
"\" elements with the same \"",
"+",
"refType",
".",
"getNameXMLElementName",
"(",
")",
"+",
"\" element value : \"",
"+",
"jndiName",
"+",
"\". The conflicting \"",
"+",
"elementName",
"+",
"\" element values are \"",
"+",
"oldValue",
"+",
"\" and \"",
"+",
"newValue",
"+",
"\".\"",
";",
"}",
"else",
"{",
"exMsg",
"=",
"\"The \"",
"+",
"component",
"+",
"\" component in the \"",
"+",
"module",
"+",
"\" module of the \"",
"+",
"application",
"+",
"\" application has conflicting configuration data\"",
"+",
"\" in source code annotations. Conflicting \"",
"+",
"elementName",
"+",
"\" attribute values exist for multiple @\"",
"+",
"refType",
".",
"getAnnotationShortName",
"(",
")",
"+",
"\" annotations with the same \"",
"+",
"refType",
".",
"getNameAnnotationElementName",
"(",
")",
"+",
"\" attribute value : \"",
"+",
"jndiName",
"+",
"\". The conflicting \"",
"+",
"elementName",
"+",
"\" attribute values are \"",
"+",
"oldValue",
"+",
"\" and \"",
"+",
"newValue",
"+",
"\".\"",
";",
"}",
"throw",
"new",
"InjectionConfigurationException",
"(",
"exMsg",
")",
";",
"}"
] | Indication that an error has occurred while merging an attribute value.
<p>This method requires {@link #getJNDIEnvironmentRefType} to be defined.
@param oldValue the old value
@param newValue the new value
@param xml true if the error occurred for an XML element
@param elementName the XML element name if xml is true, or the annotation
element name
@param property true if the error occurred for a property
@param key the optional property name if property is true, or the
annotation element name | [
"Indication",
"that",
"an",
"error",
"has",
"occurred",
"while",
"merging",
"an",
"attribute",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L807-L871 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.mergeAnnotationBoolean | protected Boolean mergeAnnotationBoolean(Boolean oldValue,
boolean oldValueXML,
boolean newValue,
String elementName,
boolean defaultValue) throws InjectionConfigurationException {
if (newValue == defaultValue || oldValueXML) {
return oldValue;
}
if (isComplete()) {
mergeError(oldValue, newValue, false, elementName, false, elementName);
return oldValue;
}
// Merge errors cannot occur for boolean attributes because there are
// only two possible values: the default value, for which there is no way
// to detect if it was explicitly specified, and the other value. So, if
// any of the annotations specify the non-default value, we use it.
return newValue;
} | java | protected Boolean mergeAnnotationBoolean(Boolean oldValue,
boolean oldValueXML,
boolean newValue,
String elementName,
boolean defaultValue) throws InjectionConfigurationException {
if (newValue == defaultValue || oldValueXML) {
return oldValue;
}
if (isComplete()) {
mergeError(oldValue, newValue, false, elementName, false, elementName);
return oldValue;
}
// Merge errors cannot occur for boolean attributes because there are
// only two possible values: the default value, for which there is no way
// to detect if it was explicitly specified, and the other value. So, if
// any of the annotations specify the non-default value, we use it.
return newValue;
} | [
"protected",
"Boolean",
"mergeAnnotationBoolean",
"(",
"Boolean",
"oldValue",
",",
"boolean",
"oldValueXML",
",",
"boolean",
"newValue",
",",
"String",
"elementName",
",",
"boolean",
"defaultValue",
")",
"throws",
"InjectionConfigurationException",
"{",
"if",
"(",
"newValue",
"==",
"defaultValue",
"||",
"oldValueXML",
")",
"{",
"return",
"oldValue",
";",
"}",
"if",
"(",
"isComplete",
"(",
")",
")",
"{",
"mergeError",
"(",
"oldValue",
",",
"newValue",
",",
"false",
",",
"elementName",
",",
"false",
",",
"elementName",
")",
";",
"return",
"oldValue",
";",
"}",
"// Merge errors cannot occur for boolean attributes because there are",
"// only two possible values: the default value, for which there is no way",
"// to detect if it was explicitly specified, and the other value. So, if",
"// any of the annotations specify the non-default value, we use it.",
"return",
"newValue",
";",
"}"
] | Merges the value of a boolean annotation value.
<p>If an error occurs, {@link #mergeError} will be called, which
requires {@link #getJNDIEnvironmentRefType} to be defined.
@param oldValue the old value
@param oldValueXML true if the old value was set by XML
@param newValue the new value
@param elementName the annotation element name
@param defaultValue the default value as specified in the annotation
@return the merged value
@throws InjectionConfigurationException if an error occurs | [
"Merges",
"the",
"value",
"of",
"a",
"boolean",
"annotation",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L887-L906 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.mergeAnnotationInteger | protected Integer mergeAnnotationInteger(Integer oldValue,
boolean oldValueXML,
int newValue,
String elementName,
int defaultValue,
Map<Integer, String> valueNames) throws InjectionConfigurationException {
if (newValue == defaultValue) {
return oldValue;
}
if (oldValueXML) {
return oldValue;
}
if (oldValue == null ? isComplete() : !oldValue.equals(newValue)) {
Object oldValueName = valueNames == null ? oldValue : valueNames.get(oldValue);
Object newValueName = valueNames == null ? newValue : valueNames.get(newValue);
mergeError(oldValueName, newValueName, false, elementName, false, elementName);
return oldValue;
}
return newValue;
} | java | protected Integer mergeAnnotationInteger(Integer oldValue,
boolean oldValueXML,
int newValue,
String elementName,
int defaultValue,
Map<Integer, String> valueNames) throws InjectionConfigurationException {
if (newValue == defaultValue) {
return oldValue;
}
if (oldValueXML) {
return oldValue;
}
if (oldValue == null ? isComplete() : !oldValue.equals(newValue)) {
Object oldValueName = valueNames == null ? oldValue : valueNames.get(oldValue);
Object newValueName = valueNames == null ? newValue : valueNames.get(newValue);
mergeError(oldValueName, newValueName, false, elementName, false, elementName);
return oldValue;
}
return newValue;
} | [
"protected",
"Integer",
"mergeAnnotationInteger",
"(",
"Integer",
"oldValue",
",",
"boolean",
"oldValueXML",
",",
"int",
"newValue",
",",
"String",
"elementName",
",",
"int",
"defaultValue",
",",
"Map",
"<",
"Integer",
",",
"String",
">",
"valueNames",
")",
"throws",
"InjectionConfigurationException",
"{",
"if",
"(",
"newValue",
"==",
"defaultValue",
")",
"{",
"return",
"oldValue",
";",
"}",
"if",
"(",
"oldValueXML",
")",
"{",
"return",
"oldValue",
";",
"}",
"if",
"(",
"oldValue",
"==",
"null",
"?",
"isComplete",
"(",
")",
":",
"!",
"oldValue",
".",
"equals",
"(",
"newValue",
")",
")",
"{",
"Object",
"oldValueName",
"=",
"valueNames",
"==",
"null",
"?",
"oldValue",
":",
"valueNames",
".",
"get",
"(",
"oldValue",
")",
";",
"Object",
"newValueName",
"=",
"valueNames",
"==",
"null",
"?",
"newValue",
":",
"valueNames",
".",
"get",
"(",
"newValue",
")",
";",
"mergeError",
"(",
"oldValueName",
",",
"newValueName",
",",
"false",
",",
"elementName",
",",
"false",
",",
"elementName",
")",
";",
"return",
"oldValue",
";",
"}",
"return",
"newValue",
";",
"}"
] | Merges the value of an integer annotation value.
<p>If an error occurs, {@link #mergeError} will be called, which
requires {@link #getJNDIEnvironmentRefType} to be defined.
@param oldValue the old value
@param oldValueXML true if the old value was set by XML
@param newValue the new value
@param elementName the annotation element name
@param defaultValue the default value as specified in the annotation
@return the merged value
@throws InjectionConfigurationException if an error occurs | [
"Merges",
"the",
"value",
"of",
"an",
"integer",
"annotation",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L922-L944 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.mergeAnnotationValue | protected <T> T mergeAnnotationValue(T oldValue,
boolean oldValueXML,
T newValue,
String elementName,
T defaultValue) throws InjectionConfigurationException {
if (newValue.equals(defaultValue) || oldValueXML) { // d663356
return oldValue;
}
if (oldValue == null ? isComplete() : !newValue.equals(oldValue)) {
mergeError(oldValue, newValue, false, elementName, false, elementName);
return oldValue;
}
return newValue;
} | java | protected <T> T mergeAnnotationValue(T oldValue,
boolean oldValueXML,
T newValue,
String elementName,
T defaultValue) throws InjectionConfigurationException {
if (newValue.equals(defaultValue) || oldValueXML) { // d663356
return oldValue;
}
if (oldValue == null ? isComplete() : !newValue.equals(oldValue)) {
mergeError(oldValue, newValue, false, elementName, false, elementName);
return oldValue;
}
return newValue;
} | [
"protected",
"<",
"T",
">",
"T",
"mergeAnnotationValue",
"(",
"T",
"oldValue",
",",
"boolean",
"oldValueXML",
",",
"T",
"newValue",
",",
"String",
"elementName",
",",
"T",
"defaultValue",
")",
"throws",
"InjectionConfigurationException",
"{",
"if",
"(",
"newValue",
".",
"equals",
"(",
"defaultValue",
")",
"||",
"oldValueXML",
")",
"{",
"// d663356",
"return",
"oldValue",
";",
"}",
"if",
"(",
"oldValue",
"==",
"null",
"?",
"isComplete",
"(",
")",
":",
"!",
"newValue",
".",
"equals",
"(",
"oldValue",
")",
")",
"{",
"mergeError",
"(",
"oldValue",
",",
"newValue",
",",
"false",
",",
"elementName",
",",
"false",
",",
"elementName",
")",
";",
"return",
"oldValue",
";",
"}",
"return",
"newValue",
";",
"}"
] | Merges the value of a String or Enum annotation value.
<p>If an error occurs, {@link #mergeError} will be called, which
requires {@link #getJNDIEnvironmentRefType} to be defined.
@param oldValue the old value
@param oldValueXML true if the old value was set by XML
@param newValue the new value
@param elementName the annotation element name
@param defaultValue the default value as specified in the annotation
@return the merged value
@throws InjectionConfigurationException if an error occurs | [
"Merges",
"the",
"value",
"of",
"a",
"String",
"or",
"Enum",
"annotation",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L960-L975 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.mergeXMLValue | protected <T> T mergeXMLValue(T oldValue,
T newValue,
String elementName,
String key,
Map<T, String> valueNames) throws InjectionConfigurationException {
if (newValue == null) {
return oldValue;
}
if (oldValue != null && !newValue.equals(oldValue)) {
Object oldValueName = valueNames == null ? oldValue : valueNames.get(oldValue);
Object newValueName = valueNames == null ? newValue : valueNames.get(newValue);
mergeError(oldValueName, newValueName, true, elementName, false, key);
return oldValue;
}
return newValue;
} | java | protected <T> T mergeXMLValue(T oldValue,
T newValue,
String elementName,
String key,
Map<T, String> valueNames) throws InjectionConfigurationException {
if (newValue == null) {
return oldValue;
}
if (oldValue != null && !newValue.equals(oldValue)) {
Object oldValueName = valueNames == null ? oldValue : valueNames.get(oldValue);
Object newValueName = valueNames == null ? newValue : valueNames.get(newValue);
mergeError(oldValueName, newValueName, true, elementName, false, key);
return oldValue;
}
return newValue;
} | [
"protected",
"<",
"T",
">",
"T",
"mergeXMLValue",
"(",
"T",
"oldValue",
",",
"T",
"newValue",
",",
"String",
"elementName",
",",
"String",
"key",
",",
"Map",
"<",
"T",
",",
"String",
">",
"valueNames",
")",
"throws",
"InjectionConfigurationException",
"{",
"if",
"(",
"newValue",
"==",
"null",
")",
"{",
"return",
"oldValue",
";",
"}",
"if",
"(",
"oldValue",
"!=",
"null",
"&&",
"!",
"newValue",
".",
"equals",
"(",
"oldValue",
")",
")",
"{",
"Object",
"oldValueName",
"=",
"valueNames",
"==",
"null",
"?",
"oldValue",
":",
"valueNames",
".",
"get",
"(",
"oldValue",
")",
";",
"Object",
"newValueName",
"=",
"valueNames",
"==",
"null",
"?",
"newValue",
":",
"valueNames",
".",
"get",
"(",
"newValue",
")",
";",
"mergeError",
"(",
"oldValueName",
",",
"newValueName",
",",
"true",
",",
"elementName",
",",
"false",
",",
"key",
")",
";",
"return",
"oldValue",
";",
"}",
"return",
"newValue",
";",
"}"
] | Merges a value specified in XML.
<p>If an error occurs, {@link #mergeError} will be called, which
requires {@link #getJNDIEnvironmentRefType} to be defined.
@param oldValue the old value
@param newValue the new value
@param elementName the name of the XML element containing the value
@param key the optional key to be passed to {@link #mergeError}
@param valueNames the names of possible old and new values to be used
for error messages, or null if the values themselves should
be used when reporting errors
@return the merged value
@throws InjectionConfigurationException if an error occurs | [
"Merges",
"a",
"value",
"specified",
"in",
"XML",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1075-L1092 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.mergeXMLProperties | protected Map<String, String> mergeXMLProperties(Map<String, String> oldProperties,
Set<String> oldXMLProperties,
List<Property> properties) throws InjectionConfigurationException {
if (!properties.isEmpty()) {
if (oldProperties == null) {
oldProperties = new HashMap<String, String>();
}
for (Property property : properties) {
String name = property.getName();
String newValue = property.getValue();
Object oldValue = oldProperties.put(name, newValue);
if (oldValue != null && !newValue.equals(oldValue)) {
mergeError(oldValue, newValue, true, name + " property", true, name);
continue;
}
oldXMLProperties.add(name);
}
}
return oldProperties;
} | java | protected Map<String, String> mergeXMLProperties(Map<String, String> oldProperties,
Set<String> oldXMLProperties,
List<Property> properties) throws InjectionConfigurationException {
if (!properties.isEmpty()) {
if (oldProperties == null) {
oldProperties = new HashMap<String, String>();
}
for (Property property : properties) {
String name = property.getName();
String newValue = property.getValue();
Object oldValue = oldProperties.put(name, newValue);
if (oldValue != null && !newValue.equals(oldValue)) {
mergeError(oldValue, newValue, true, name + " property", true, name);
continue;
}
oldXMLProperties.add(name);
}
}
return oldProperties;
} | [
"protected",
"Map",
"<",
"String",
",",
"String",
">",
"mergeXMLProperties",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"oldProperties",
",",
"Set",
"<",
"String",
">",
"oldXMLProperties",
",",
"List",
"<",
"Property",
">",
"properties",
")",
"throws",
"InjectionConfigurationException",
"{",
"if",
"(",
"!",
"properties",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"oldProperties",
"==",
"null",
")",
"{",
"oldProperties",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"}",
"for",
"(",
"Property",
"property",
":",
"properties",
")",
"{",
"String",
"name",
"=",
"property",
".",
"getName",
"(",
")",
";",
"String",
"newValue",
"=",
"property",
".",
"getValue",
"(",
")",
";",
"Object",
"oldValue",
"=",
"oldProperties",
".",
"put",
"(",
"name",
",",
"newValue",
")",
";",
"if",
"(",
"oldValue",
"!=",
"null",
"&&",
"!",
"newValue",
".",
"equals",
"(",
"oldValue",
")",
")",
"{",
"mergeError",
"(",
"oldValue",
",",
"newValue",
",",
"true",
",",
"name",
"+",
"\" property\"",
",",
"true",
",",
"name",
")",
";",
"continue",
";",
"}",
"oldXMLProperties",
".",
"add",
"(",
"name",
")",
";",
"}",
"}",
"return",
"oldProperties",
";",
"}"
] | Merges the properties specified in XML.
<p>If an error occurs, {@link #mergeError} will be called, which
requires {@link #getJNDIEnvironmentRefType} to be defined.
@param oldProperties the old properties, or null if uninitialized
@param oldXMLPropertyNames the old property names set by XML to be updated
@param newProperties the new properties
@return the old properties updated as necessary
@throws InjectionConfigurationException if an error occurs | [
"Merges",
"the",
"properties",
"specified",
"in",
"XML",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1106-L1129 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.addOrRemoveProperty | protected static <K, V> void addOrRemoveProperty(Map<K, V> props, K key, V value)
{
if (value == null) {
// Generic properties have already been added to the map. Remove them
// so they aren't confused with the builtin properties.
props.remove(key);
} else {
props.put(key, value);
}
} | java | protected static <K, V> void addOrRemoveProperty(Map<K, V> props, K key, V value)
{
if (value == null) {
// Generic properties have already been added to the map. Remove them
// so they aren't confused with the builtin properties.
props.remove(key);
} else {
props.put(key, value);
}
} | [
"protected",
"static",
"<",
"K",
",",
"V",
">",
"void",
"addOrRemoveProperty",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"props",
",",
"K",
"key",
",",
"V",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"// Generic properties have already been added to the map. Remove them",
"// so they aren't confused with the builtin properties.",
"props",
".",
"remove",
"(",
"key",
")",
";",
"}",
"else",
"{",
"props",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"}"
] | Add the specified property if the value is non-null, or remove it from
the map if it is null.
@param props the properties to update
@param key the key
@param value the value | [
"Add",
"the",
"specified",
"property",
"if",
"the",
"value",
"is",
"non",
"-",
"null",
"or",
"remove",
"it",
"from",
"the",
"map",
"if",
"it",
"is",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1203-L1212 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.createDefinitionReference | public Reference createDefinitionReference(String bindingName, String type, Map<String, Object> properties) throws InjectionException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Map<String, Object> traceProps = properties;
if (traceProps.containsKey("password")) {
traceProps = new HashMap<String, Object>(properties);
traceProps.put("password", "********");
}
Tr.entry(tc, "createDefinitionReference: bindingName=" + bindingName + ", type=" + type, traceProps);
}
Reference ref;
try {
InternalInjectionEngine injectionEngine = (InternalInjectionEngine) InjectionEngineAccessor.getInstance();
ref = injectionEngine.createDefinitionReference(ivNameSpaceConfig, ivInjectionScope, getJndiName(), bindingName, type, properties);
} catch (Exception ex) {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "createDefinitionReference", ex);
throw new InjectionException(ex);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "createDefinitionReference", ref);
return ref;
} | java | public Reference createDefinitionReference(String bindingName, String type, Map<String, Object> properties) throws InjectionException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Map<String, Object> traceProps = properties;
if (traceProps.containsKey("password")) {
traceProps = new HashMap<String, Object>(properties);
traceProps.put("password", "********");
}
Tr.entry(tc, "createDefinitionReference: bindingName=" + bindingName + ", type=" + type, traceProps);
}
Reference ref;
try {
InternalInjectionEngine injectionEngine = (InternalInjectionEngine) InjectionEngineAccessor.getInstance();
ref = injectionEngine.createDefinitionReference(ivNameSpaceConfig, ivInjectionScope, getJndiName(), bindingName, type, properties);
} catch (Exception ex) {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "createDefinitionReference", ex);
throw new InjectionException(ex);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "createDefinitionReference", ref);
return ref;
} | [
"public",
"Reference",
"createDefinitionReference",
"(",
"String",
"bindingName",
",",
"String",
"type",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"throws",
"InjectionException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"traceProps",
"=",
"properties",
";",
"if",
"(",
"traceProps",
".",
"containsKey",
"(",
"\"password\"",
")",
")",
"{",
"traceProps",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
"properties",
")",
";",
"traceProps",
".",
"put",
"(",
"\"password\"",
",",
"\"********\"",
")",
";",
"}",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"createDefinitionReference: bindingName=\"",
"+",
"bindingName",
"+",
"\", type=\"",
"+",
"type",
",",
"traceProps",
")",
";",
"}",
"Reference",
"ref",
";",
"try",
"{",
"InternalInjectionEngine",
"injectionEngine",
"=",
"(",
"InternalInjectionEngine",
")",
"InjectionEngineAccessor",
".",
"getInstance",
"(",
")",
";",
"ref",
"=",
"injectionEngine",
".",
"createDefinitionReference",
"(",
"ivNameSpaceConfig",
",",
"ivInjectionScope",
",",
"getJndiName",
"(",
")",
",",
"bindingName",
",",
"type",
",",
"properties",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"createDefinitionReference\"",
",",
"ex",
")",
";",
"throw",
"new",
"InjectionException",
"(",
"ex",
")",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"createDefinitionReference\"",
",",
"ref",
")",
";",
"return",
"ref",
";",
"}"
] | Create a Reference to a resource definition.
@param bindingName the binding name, or null if none
@param type the resource type
@param properties the resource-specific properties
@return the resource definition Reference | [
"Create",
"a",
"Reference",
"to",
"a",
"resource",
"definition",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1222-L1247 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.setObjects | public void setObjects(Object injectionObject, Reference bindingObject)
throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "setObjects", injectionObject, bindingObjectToString(bindingObject));
ivInjectedObject = injectionObject; // d392996.3
if (bindingObject != null)
{
ivBindingObject = bindingObject;
ivObjectFactoryClassName = bindingObject.getFactoryClassName(); // F48603.4
if (ivObjectFactoryClassName == null) // F54050
{
throw new IllegalArgumentException("expected non-null getFactoryClassName");
}
}
else
{
ivBindingObject = injectionObject;
}
} | java | public void setObjects(Object injectionObject, Reference bindingObject)
throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "setObjects", injectionObject, bindingObjectToString(bindingObject));
ivInjectedObject = injectionObject; // d392996.3
if (bindingObject != null)
{
ivBindingObject = bindingObject;
ivObjectFactoryClassName = bindingObject.getFactoryClassName(); // F48603.4
if (ivObjectFactoryClassName == null) // F54050
{
throw new IllegalArgumentException("expected non-null getFactoryClassName");
}
}
else
{
ivBindingObject = injectionObject;
}
} | [
"public",
"void",
"setObjects",
"(",
"Object",
"injectionObject",
",",
"Reference",
"bindingObject",
")",
"throws",
"InjectionException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setObjects\"",
",",
"injectionObject",
",",
"bindingObjectToString",
"(",
"bindingObject",
")",
")",
";",
"ivInjectedObject",
"=",
"injectionObject",
";",
"// d392996.3",
"if",
"(",
"bindingObject",
"!=",
"null",
")",
"{",
"ivBindingObject",
"=",
"bindingObject",
";",
"ivObjectFactoryClassName",
"=",
"bindingObject",
".",
"getFactoryClassName",
"(",
")",
";",
"// F48603.4",
"if",
"(",
"ivObjectFactoryClassName",
"==",
"null",
")",
"// F54050",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"expected non-null getFactoryClassName\"",
")",
";",
"}",
"}",
"else",
"{",
"ivBindingObject",
"=",
"injectionObject",
";",
"}",
"}"
] | Sets the object to use for injection and the Reference to use for
binding. Usually, the injection object is null.
@param injectionObject the object to inject, or null if the object should
be obtained from the binding object instead
@param bindingObject the object to bind, or null if injectionObject
should be bound directly if is non-null
@throws InjectionException if a problem occurs while creating
the instance to be injected | [
"Sets",
"the",
"object",
"to",
"use",
"for",
"injection",
"and",
"the",
"Reference",
"to",
"use",
"for",
"binding",
".",
"Usually",
"the",
"injection",
"object",
"is",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1283-L1305 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.setReferenceObject | public void setReferenceObject(Reference bindingObject,
Class<? extends ObjectFactory> objectFactory)
throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "setReferenceObject", bindingObjectToString(bindingObject), objectFactory);
ivInjectedObject = null;
ivBindingObject = bindingObject;
ivObjectFactoryClass = objectFactory; // F48603.4
ivObjectFactoryClassName = objectFactory.getName(); // F54050
} | java | public void setReferenceObject(Reference bindingObject,
Class<? extends ObjectFactory> objectFactory)
throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "setReferenceObject", bindingObjectToString(bindingObject), objectFactory);
ivInjectedObject = null;
ivBindingObject = bindingObject;
ivObjectFactoryClass = objectFactory; // F48603.4
ivObjectFactoryClassName = objectFactory.getName(); // F54050
} | [
"public",
"void",
"setReferenceObject",
"(",
"Reference",
"bindingObject",
",",
"Class",
"<",
"?",
"extends",
"ObjectFactory",
">",
"objectFactory",
")",
"throws",
"InjectionException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"setReferenceObject\"",
",",
"bindingObjectToString",
"(",
"bindingObject",
")",
",",
"objectFactory",
")",
";",
"ivInjectedObject",
"=",
"null",
";",
"ivBindingObject",
"=",
"bindingObject",
";",
"ivObjectFactoryClass",
"=",
"objectFactory",
";",
"// F48603.4",
"ivObjectFactoryClassName",
"=",
"objectFactory",
".",
"getName",
"(",
")",
";",
"// F54050",
"}"
] | F623-841.1 | [
"F623",
"-",
"841",
".",
"1"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1328-L1340 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.getInjectionObjectInstance | protected Object getInjectionObjectInstance(Object targetObject,
InjectionTargetContext targetContext)
throws Exception
{
ObjectFactory objectFactory = ivObjectFactory; // volatile-read
InjectionObjectFactory injObjFactory = ivInjectionObjectFactory;
if (objectFactory == null)
{
try
{
InternalInjectionEngine ie = InjectionEngineAccessor.getInternalInstance();
objectFactory = ie.getObjectFactory(ivObjectFactoryClassName, ivObjectFactoryClass); // F54050
if (objectFactory instanceof InjectionObjectFactory) // F49213.1
{
injObjFactory = (InjectionObjectFactory) objectFactory;
ivInjectionObjectFactory = injObjFactory;
}
ivObjectFactory = objectFactory; // volatile-write
} catch (Throwable ex)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getInjectionObjectInstance", ex);
Tr.error(tc, "OBJECT_FACTORY_CLASS_FAILED_TO_LOAD_CWNEN0024E", ivObjectFactoryClassName);
throw new InjectionException(ex.toString(), ex);
}
}
if (injObjFactory != null) // F49213.1
{
return injObjFactory.getInjectionObjectInstance((Reference) getBindingObject(),
targetObject, targetContext);
}
return objectFactory.getObjectInstance(getBindingObject(), null, null, null);
} | java | protected Object getInjectionObjectInstance(Object targetObject,
InjectionTargetContext targetContext)
throws Exception
{
ObjectFactory objectFactory = ivObjectFactory; // volatile-read
InjectionObjectFactory injObjFactory = ivInjectionObjectFactory;
if (objectFactory == null)
{
try
{
InternalInjectionEngine ie = InjectionEngineAccessor.getInternalInstance();
objectFactory = ie.getObjectFactory(ivObjectFactoryClassName, ivObjectFactoryClass); // F54050
if (objectFactory instanceof InjectionObjectFactory) // F49213.1
{
injObjFactory = (InjectionObjectFactory) objectFactory;
ivInjectionObjectFactory = injObjFactory;
}
ivObjectFactory = objectFactory; // volatile-write
} catch (Throwable ex)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getInjectionObjectInstance", ex);
Tr.error(tc, "OBJECT_FACTORY_CLASS_FAILED_TO_LOAD_CWNEN0024E", ivObjectFactoryClassName);
throw new InjectionException(ex.toString(), ex);
}
}
if (injObjFactory != null) // F49213.1
{
return injObjFactory.getInjectionObjectInstance((Reference) getBindingObject(),
targetObject, targetContext);
}
return objectFactory.getObjectInstance(getBindingObject(), null, null, null);
} | [
"protected",
"Object",
"getInjectionObjectInstance",
"(",
"Object",
"targetObject",
",",
"InjectionTargetContext",
"targetContext",
")",
"throws",
"Exception",
"{",
"ObjectFactory",
"objectFactory",
"=",
"ivObjectFactory",
";",
"// volatile-read",
"InjectionObjectFactory",
"injObjFactory",
"=",
"ivInjectionObjectFactory",
";",
"if",
"(",
"objectFactory",
"==",
"null",
")",
"{",
"try",
"{",
"InternalInjectionEngine",
"ie",
"=",
"InjectionEngineAccessor",
".",
"getInternalInstance",
"(",
")",
";",
"objectFactory",
"=",
"ie",
".",
"getObjectFactory",
"(",
"ivObjectFactoryClassName",
",",
"ivObjectFactoryClass",
")",
";",
"// F54050",
"if",
"(",
"objectFactory",
"instanceof",
"InjectionObjectFactory",
")",
"// F49213.1",
"{",
"injObjFactory",
"=",
"(",
"InjectionObjectFactory",
")",
"objectFactory",
";",
"ivInjectionObjectFactory",
"=",
"injObjFactory",
";",
"}",
"ivObjectFactory",
"=",
"objectFactory",
";",
"// volatile-write",
"}",
"catch",
"(",
"Throwable",
"ex",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getInjectionObjectInstance\"",
",",
"ex",
")",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"OBJECT_FACTORY_CLASS_FAILED_TO_LOAD_CWNEN0024E\"",
",",
"ivObjectFactoryClassName",
")",
";",
"throw",
"new",
"InjectionException",
"(",
"ex",
".",
"toString",
"(",
")",
",",
"ex",
")",
";",
"}",
"}",
"if",
"(",
"injObjFactory",
"!=",
"null",
")",
"// F49213.1",
"{",
"return",
"injObjFactory",
".",
"getInjectionObjectInstance",
"(",
"(",
"Reference",
")",
"getBindingObject",
"(",
")",
",",
"targetObject",
",",
"targetContext",
")",
";",
"}",
"return",
"objectFactory",
".",
"getObjectInstance",
"(",
"getBindingObject",
"(",
")",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}"
] | F48603.4 | [
"F48603",
".",
"4"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1519-L1553 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.setJndiName | public final void setJndiName(String jndiName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() && jndiName.length() != 0)
Tr.debug(tc, "setJndiName: " + jndiName);
// Starting with Java EE 6, reference names may now start with java: and
// then global, app, module, or comp. 'env' is optional, but recommended.
// The set jndiName will always be the 'short' name, to make it consistent
// to prior releases. "java:comp/" without the optional 'env' subcontext
// will be treated specially and will be the full name. d662985.2
ivJndiName = InjectionScope.normalize(jndiName); // d726563
} | java | public final void setJndiName(String jndiName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() && jndiName.length() != 0)
Tr.debug(tc, "setJndiName: " + jndiName);
// Starting with Java EE 6, reference names may now start with java: and
// then global, app, module, or comp. 'env' is optional, but recommended.
// The set jndiName will always be the 'short' name, to make it consistent
// to prior releases. "java:comp/" without the optional 'env' subcontext
// will be treated specially and will be the full name. d662985.2
ivJndiName = InjectionScope.normalize(jndiName); // d726563
} | [
"public",
"final",
"void",
"setJndiName",
"(",
"String",
"jndiName",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
"&&",
"jndiName",
".",
"length",
"(",
")",
"!=",
"0",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setJndiName: \"",
"+",
"jndiName",
")",
";",
"// Starting with Java EE 6, reference names may now start with java: and",
"// then global, app, module, or comp. 'env' is optional, but recommended.",
"// The set jndiName will always be the 'short' name, to make it consistent",
"// to prior releases. \"java:comp/\" without the optional 'env' subcontext",
"// will be treated specially and will be the full name. d662985.2",
"ivJndiName",
"=",
"InjectionScope",
".",
"normalize",
"(",
"jndiName",
")",
";",
"// d726563",
"}"
] | d367834.14 Ends | [
"d367834",
".",
"14",
"Ends"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1614-L1625 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.setInjectionClassType | public void setInjectionClassType(Class<?> injectionClassType) throws InjectionException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setInjectionClassType: " + injectionClassType);
// if the injection class type hasn't been set yet ( null from XML or
// Object from annotations, the default) then set it.
if (ivInjectionClassType == null ||
ivInjectionClassType == Object.class)
{
ivInjectionClassType = injectionClassType;
}
// If the specified class is a sublcass of the current setting, then
// replace it, otherwise insure it is compatible
else
{
if (ivInjectionClassType.isAssignableFrom(injectionClassType))
{
ivInjectionClassType = injectionClassType;
}
else
{
if (!injectionClassType.isAssignableFrom(ivInjectionClassType))
{
// TODO : Currently this warning will be present for most
// primitives... need to improve this method to
// properly handle primitives, and throw an exception here!
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "WARNING: Class " + injectionClassType +
" is not assignable from " + ivInjectionClassType);
}
}
}
} | java | public void setInjectionClassType(Class<?> injectionClassType) throws InjectionException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setInjectionClassType: " + injectionClassType);
// if the injection class type hasn't been set yet ( null from XML or
// Object from annotations, the default) then set it.
if (ivInjectionClassType == null ||
ivInjectionClassType == Object.class)
{
ivInjectionClassType = injectionClassType;
}
// If the specified class is a sublcass of the current setting, then
// replace it, otherwise insure it is compatible
else
{
if (ivInjectionClassType.isAssignableFrom(injectionClassType))
{
ivInjectionClassType = injectionClassType;
}
else
{
if (!injectionClassType.isAssignableFrom(ivInjectionClassType))
{
// TODO : Currently this warning will be present for most
// primitives... need to improve this method to
// properly handle primitives, and throw an exception here!
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "WARNING: Class " + injectionClassType +
" is not assignable from " + ivInjectionClassType);
}
}
}
} | [
"public",
"void",
"setInjectionClassType",
"(",
"Class",
"<",
"?",
">",
"injectionClassType",
")",
"throws",
"InjectionException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setInjectionClassType: \"",
"+",
"injectionClassType",
")",
";",
"// if the injection class type hasn't been set yet ( null from XML or",
"// Object from annotations, the default) then set it.",
"if",
"(",
"ivInjectionClassType",
"==",
"null",
"||",
"ivInjectionClassType",
"==",
"Object",
".",
"class",
")",
"{",
"ivInjectionClassType",
"=",
"injectionClassType",
";",
"}",
"// If the specified class is a sublcass of the current setting, then",
"// replace it, otherwise insure it is compatible",
"else",
"{",
"if",
"(",
"ivInjectionClassType",
".",
"isAssignableFrom",
"(",
"injectionClassType",
")",
")",
"{",
"ivInjectionClassType",
"=",
"injectionClassType",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"injectionClassType",
".",
"isAssignableFrom",
"(",
"ivInjectionClassType",
")",
")",
"{",
"// TODO : Currently this warning will be present for most",
"// primitives... need to improve this method to",
"// properly handle primitives, and throw an exception here!",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"WARNING: Class \"",
"+",
"injectionClassType",
"+",
"\" is not assignable from \"",
"+",
"ivInjectionClassType",
")",
";",
"}",
"}",
"}",
"}"
] | Set the InjectionClassType to be most fine grained injection target Class type.
For instance, if there are three injection classes
named Object,Cart,myCart where each extends the prior, the setInjectionClassType
will set the class to be myCart.
@param injectionClassType type of the object association with reference
@throws InjectionException if a problem occurs while creating
the instance to be injected | [
"Set",
"the",
"InjectionClassType",
"to",
"be",
"most",
"fine",
"grained",
"injection",
"target",
"Class",
"type",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1658-L1692 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.setInjectionClassTypeName | public void setInjectionClassTypeName(String name) // F743-32443
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setInjectionClassType: " + name);
if (ivInjectionClassTypeName != null)
{
throw new IllegalStateException("duplicate reference data for " + getJndiName());
}
ivInjectionClassTypeName = name;
} | java | public void setInjectionClassTypeName(String name) // F743-32443
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setInjectionClassType: " + name);
if (ivInjectionClassTypeName != null)
{
throw new IllegalStateException("duplicate reference data for " + getJndiName());
}
ivInjectionClassTypeName = name;
} | [
"public",
"void",
"setInjectionClassTypeName",
"(",
"String",
"name",
")",
"// F743-32443",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setInjectionClassType: \"",
"+",
"name",
")",
";",
"if",
"(",
"ivInjectionClassTypeName",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"duplicate reference data for \"",
"+",
"getJndiName",
"(",
")",
")",
";",
"}",
"ivInjectionClassTypeName",
"=",
"name",
";",
"}"
] | Sets the injection class type name. When class names are specified in
XML rather than annotation, sub-classes must call this method or override
getInjectionClassTypeName in order to support callers of the injection
engine that do not have a class loader.
@param name the type name of the referenced object | [
"Sets",
"the",
"injection",
"class",
"type",
"name",
".",
"When",
"class",
"names",
"are",
"specified",
"in",
"XML",
"rather",
"than",
"annotation",
"sub",
"-",
"classes",
"must",
"call",
"this",
"method",
"or",
"override",
"getInjectionClassTypeName",
"in",
"order",
"to",
"support",
"callers",
"of",
"the",
"injection",
"engine",
"that",
"do",
"not",
"have",
"a",
"class",
"loader",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1702-L1713 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.isClassesCompatible | public static boolean isClassesCompatible(Class<?> memberClass,
Class<?> injectClass)
{
// If the class of the field or method is the injection
// type or a parent of it, then the injection may occur. d433391
if (memberClass.isAssignableFrom(injectClass))
return true;
// TODO : Remove this hack when EJB injection is working properly
// Currently for EJB injection from XML, the 'member' class is
// is always set to 'Object'. d433391
if (injectClass.isAssignableFrom(memberClass))
return true;
// Otherwise, check to see if either is a primitive, and if so,
// verify that the types are compatible.
// TODO : this needs to handle where the primitive types are different
// but may still be compatible... or one is an Object that
// may be autoboxed to a primitive ..like Integer -> short
return getPrimitiveClass(memberClass) == getPrimitiveClass(injectClass);
} | java | public static boolean isClassesCompatible(Class<?> memberClass,
Class<?> injectClass)
{
// If the class of the field or method is the injection
// type or a parent of it, then the injection may occur. d433391
if (memberClass.isAssignableFrom(injectClass))
return true;
// TODO : Remove this hack when EJB injection is working properly
// Currently for EJB injection from XML, the 'member' class is
// is always set to 'Object'. d433391
if (injectClass.isAssignableFrom(memberClass))
return true;
// Otherwise, check to see if either is a primitive, and if so,
// verify that the types are compatible.
// TODO : this needs to handle where the primitive types are different
// but may still be compatible... or one is an Object that
// may be autoboxed to a primitive ..like Integer -> short
return getPrimitiveClass(memberClass) == getPrimitiveClass(injectClass);
} | [
"public",
"static",
"boolean",
"isClassesCompatible",
"(",
"Class",
"<",
"?",
">",
"memberClass",
",",
"Class",
"<",
"?",
">",
"injectClass",
")",
"{",
"// If the class of the field or method is the injection",
"// type or a parent of it, then the injection may occur. d433391",
"if",
"(",
"memberClass",
".",
"isAssignableFrom",
"(",
"injectClass",
")",
")",
"return",
"true",
";",
"// TODO : Remove this hack when EJB injection is working properly",
"// Currently for EJB injection from XML, the 'member' class is",
"// is always set to 'Object'. d433391",
"if",
"(",
"injectClass",
".",
"isAssignableFrom",
"(",
"memberClass",
")",
")",
"return",
"true",
";",
"// Otherwise, check to see if either is a primitive, and if so,",
"// verify that the types are compatible.",
"// TODO : this needs to handle where the primitive types are different",
"// but may still be compatible... or one is an Object that",
"// may be autoboxed to a primitive ..like Integer -> short",
"return",
"getPrimitiveClass",
"(",
"memberClass",
")",
"==",
"getPrimitiveClass",
"(",
"injectClass",
")",
";",
"}"
] | Test if the input two classes are auto-boxing compatible.
@param memberClass Class type of the method or field
@param injectClass Class type of object being injected | [
"Test",
"if",
"the",
"input",
"two",
"classes",
"are",
"auto",
"-",
"boxing",
"compatible",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1869-L1889 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.mostSpecificClass | public static Class<?> mostSpecificClass(Class<?> classOne,
Class<?> classTwo)
{
if (classOne.isAssignableFrom(classTwo)) {
return classTwo; // d479669
}
else if (classTwo.isAssignableFrom(classOne)) {
return classOne; // d479669
}
return null;
} | java | public static Class<?> mostSpecificClass(Class<?> classOne,
Class<?> classTwo)
{
if (classOne.isAssignableFrom(classTwo)) {
return classTwo; // d479669
}
else if (classTwo.isAssignableFrom(classOne)) {
return classOne; // d479669
}
return null;
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"mostSpecificClass",
"(",
"Class",
"<",
"?",
">",
"classOne",
",",
"Class",
"<",
"?",
">",
"classTwo",
")",
"{",
"if",
"(",
"classOne",
".",
"isAssignableFrom",
"(",
"classTwo",
")",
")",
"{",
"return",
"classTwo",
";",
"// d479669",
"}",
"else",
"if",
"(",
"classTwo",
".",
"isAssignableFrom",
"(",
"classOne",
")",
")",
"{",
"return",
"classOne",
";",
"// d479669",
"}",
"return",
"null",
";",
"}"
] | Returns the most most specific class to the caller. If the two
classes are not compatible a null is returned.
@param classOne Class type of the method or field
@param classTwo Class type of object being injected | [
"Returns",
"the",
"most",
"most",
"specific",
"class",
"to",
"the",
"caller",
".",
"If",
"the",
"two",
"classes",
"are",
"not",
"compatible",
"a",
"null",
"is",
"returned",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1898-L1909 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.toStringSecure | public static String toStringSecure(Annotation ann) {
Class<?> annType = ann.annotationType();
StringBuilder sb = new StringBuilder();
sb.append('@').append(annType.getName()).append('(');
boolean any = false;
for (Method m : annType.getMethods()) {
Object defaultValue = m.getDefaultValue();
if (defaultValue != null) {
String name = m.getName();
Object value;
try {
value = m.invoke(ann);
if (name.equals("password") && !defaultValue.equals(value)) {
value = "********";
} else if (value instanceof Object[]) {
value = Arrays.toString((Object[]) value);
} else {
value = String.valueOf(value);
}
} catch (Throwable t) {
value = "<" + t + ">";
}
if (any) {
sb.append(", ");
} else {
any = true;
}
sb.append(name).append('=').append(value);
}
}
return sb.append(')').toString();
} | java | public static String toStringSecure(Annotation ann) {
Class<?> annType = ann.annotationType();
StringBuilder sb = new StringBuilder();
sb.append('@').append(annType.getName()).append('(');
boolean any = false;
for (Method m : annType.getMethods()) {
Object defaultValue = m.getDefaultValue();
if (defaultValue != null) {
String name = m.getName();
Object value;
try {
value = m.invoke(ann);
if (name.equals("password") && !defaultValue.equals(value)) {
value = "********";
} else if (value instanceof Object[]) {
value = Arrays.toString((Object[]) value);
} else {
value = String.valueOf(value);
}
} catch (Throwable t) {
value = "<" + t + ">";
}
if (any) {
sb.append(", ");
} else {
any = true;
}
sb.append(name).append('=').append(value);
}
}
return sb.append(')').toString();
} | [
"public",
"static",
"String",
"toStringSecure",
"(",
"Annotation",
"ann",
")",
"{",
"Class",
"<",
"?",
">",
"annType",
"=",
"ann",
".",
"annotationType",
"(",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"annType",
".",
"getName",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"boolean",
"any",
"=",
"false",
";",
"for",
"(",
"Method",
"m",
":",
"annType",
".",
"getMethods",
"(",
")",
")",
"{",
"Object",
"defaultValue",
"=",
"m",
".",
"getDefaultValue",
"(",
")",
";",
"if",
"(",
"defaultValue",
"!=",
"null",
")",
"{",
"String",
"name",
"=",
"m",
".",
"getName",
"(",
")",
";",
"Object",
"value",
";",
"try",
"{",
"value",
"=",
"m",
".",
"invoke",
"(",
"ann",
")",
";",
"if",
"(",
"name",
".",
"equals",
"(",
"\"password\"",
")",
"&&",
"!",
"defaultValue",
".",
"equals",
"(",
"value",
")",
")",
"{",
"value",
"=",
"\"********\"",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"Object",
"[",
"]",
")",
"{",
"value",
"=",
"Arrays",
".",
"toString",
"(",
"(",
"Object",
"[",
"]",
")",
"value",
")",
";",
"}",
"else",
"{",
"value",
"=",
"String",
".",
"valueOf",
"(",
"value",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"value",
"=",
"\"<\"",
"+",
"t",
"+",
"\">\"",
";",
"}",
"if",
"(",
"any",
")",
"{",
"sb",
".",
"append",
"(",
"\", \"",
")",
";",
"}",
"else",
"{",
"any",
"=",
"true",
";",
"}",
"sb",
".",
"append",
"(",
"name",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"value",
")",
";",
"}",
"}",
"return",
"sb",
".",
"append",
"(",
"'",
"'",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Convert an annotation to a string, but mask members named password.
@param ann the annotation
@return the string representation of the annotation | [
"Convert",
"an",
"annotation",
"to",
"a",
"string",
"but",
"mask",
"members",
"named",
"password",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L2139-L2176 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/CacheHashMap.java | CacheHashMap.overQualLastAccessTimeUpdate | @Override
@FFDCIgnore(Exception.class) //manually logged
protected int overQualLastAccessTimeUpdate(BackedSession sess, long nowTime) {
final boolean trace = TraceComponent.isAnyTracingEnabled();
String id = sess.getId();
int updateCount;
try {
if (trace && tc.isDebugEnabled())
tcInvoke(tcSessionMetaCache, "get", id);
synchronized (sess) {
ArrayList<?> oldValue = sessionMetaCache.get(id);
if (trace && tc.isDebugEnabled())
tcReturn(tcSessionMetaCache, "get", oldValue);
SessionInfo sessionInfo = oldValue == null ? null : new SessionInfo(oldValue).clone();
long curAccessTime = sess.getCurrentAccessTime();
if (sessionInfo == null || sessionInfo.getLastAccess() != curAccessTime) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "session current access time: " + curAccessTime);
updateCount = 0;
} else if (sessionInfo.getLastAccess() >= nowTime) { // avoid setting last access when the cache already has a later time
updateCount = 1; // be consistent with Statement.executeUpdate which returns 1 when the row matches but no changes are made
} else {
sessionInfo.setLastAccess(nowTime);
ArrayList<?> newValue = sessionInfo.getArrayList();
if (trace && tc.isDebugEnabled())
tcInvoke(tcSessionMetaCache, "replace", id, oldValue, newValue);
boolean replaced = sessionMetaCache.replace(id, oldValue, newValue);
if (trace && tc.isDebugEnabled())
tcReturn(tcSessionMetaCache, "replace", replaced);
if (replaced) {
sess.updateLastAccessTime(nowTime);
updateCount = 1;
} else {
updateCount = 0;
}
}
}
} catch(Exception ex) {
FFDCFilter.processException(ex, "com.ibm.ws.session.store.cache.CacheHashMap.overQualLastAccessTimeUpdate", "859", this, new Object[] { sess });
Tr.error(tc, "ERROR_CACHE_ACCESS", ex);
throw new RuntimeException(Tr.formatMessage(tc, "INTERNAL_SERVER_ERROR"));
}
return updateCount;
} | java | @Override
@FFDCIgnore(Exception.class) //manually logged
protected int overQualLastAccessTimeUpdate(BackedSession sess, long nowTime) {
final boolean trace = TraceComponent.isAnyTracingEnabled();
String id = sess.getId();
int updateCount;
try {
if (trace && tc.isDebugEnabled())
tcInvoke(tcSessionMetaCache, "get", id);
synchronized (sess) {
ArrayList<?> oldValue = sessionMetaCache.get(id);
if (trace && tc.isDebugEnabled())
tcReturn(tcSessionMetaCache, "get", oldValue);
SessionInfo sessionInfo = oldValue == null ? null : new SessionInfo(oldValue).clone();
long curAccessTime = sess.getCurrentAccessTime();
if (sessionInfo == null || sessionInfo.getLastAccess() != curAccessTime) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "session current access time: " + curAccessTime);
updateCount = 0;
} else if (sessionInfo.getLastAccess() >= nowTime) { // avoid setting last access when the cache already has a later time
updateCount = 1; // be consistent with Statement.executeUpdate which returns 1 when the row matches but no changes are made
} else {
sessionInfo.setLastAccess(nowTime);
ArrayList<?> newValue = sessionInfo.getArrayList();
if (trace && tc.isDebugEnabled())
tcInvoke(tcSessionMetaCache, "replace", id, oldValue, newValue);
boolean replaced = sessionMetaCache.replace(id, oldValue, newValue);
if (trace && tc.isDebugEnabled())
tcReturn(tcSessionMetaCache, "replace", replaced);
if (replaced) {
sess.updateLastAccessTime(nowTime);
updateCount = 1;
} else {
updateCount = 0;
}
}
}
} catch(Exception ex) {
FFDCFilter.processException(ex, "com.ibm.ws.session.store.cache.CacheHashMap.overQualLastAccessTimeUpdate", "859", this, new Object[] { sess });
Tr.error(tc, "ERROR_CACHE_ACCESS", ex);
throw new RuntimeException(Tr.formatMessage(tc, "INTERNAL_SERVER_ERROR"));
}
return updateCount;
} | [
"@",
"Override",
"@",
"FFDCIgnore",
"(",
"Exception",
".",
"class",
")",
"//manually logged",
"protected",
"int",
"overQualLastAccessTimeUpdate",
"(",
"BackedSession",
"sess",
",",
"long",
"nowTime",
")",
"{",
"final",
"boolean",
"trace",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"String",
"id",
"=",
"sess",
".",
"getId",
"(",
")",
";",
"int",
"updateCount",
";",
"try",
"{",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"tcInvoke",
"(",
"tcSessionMetaCache",
",",
"\"get\"",
",",
"id",
")",
";",
"synchronized",
"(",
"sess",
")",
"{",
"ArrayList",
"<",
"?",
">",
"oldValue",
"=",
"sessionMetaCache",
".",
"get",
"(",
"id",
")",
";",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"tcReturn",
"(",
"tcSessionMetaCache",
",",
"\"get\"",
",",
"oldValue",
")",
";",
"SessionInfo",
"sessionInfo",
"=",
"oldValue",
"==",
"null",
"?",
"null",
":",
"new",
"SessionInfo",
"(",
"oldValue",
")",
".",
"clone",
"(",
")",
";",
"long",
"curAccessTime",
"=",
"sess",
".",
"getCurrentAccessTime",
"(",
")",
";",
"if",
"(",
"sessionInfo",
"==",
"null",
"||",
"sessionInfo",
".",
"getLastAccess",
"(",
")",
"!=",
"curAccessTime",
")",
"{",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"session current access time: \"",
"+",
"curAccessTime",
")",
";",
"updateCount",
"=",
"0",
";",
"}",
"else",
"if",
"(",
"sessionInfo",
".",
"getLastAccess",
"(",
")",
">=",
"nowTime",
")",
"{",
"// avoid setting last access when the cache already has a later time",
"updateCount",
"=",
"1",
";",
"// be consistent with Statement.executeUpdate which returns 1 when the row matches but no changes are made",
"}",
"else",
"{",
"sessionInfo",
".",
"setLastAccess",
"(",
"nowTime",
")",
";",
"ArrayList",
"<",
"?",
">",
"newValue",
"=",
"sessionInfo",
".",
"getArrayList",
"(",
")",
";",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"tcInvoke",
"(",
"tcSessionMetaCache",
",",
"\"replace\"",
",",
"id",
",",
"oldValue",
",",
"newValue",
")",
";",
"boolean",
"replaced",
"=",
"sessionMetaCache",
".",
"replace",
"(",
"id",
",",
"oldValue",
",",
"newValue",
")",
";",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"tcReturn",
"(",
"tcSessionMetaCache",
",",
"\"replace\"",
",",
"replaced",
")",
";",
"if",
"(",
"replaced",
")",
"{",
"sess",
".",
"updateLastAccessTime",
"(",
"nowTime",
")",
";",
"updateCount",
"=",
"1",
";",
"}",
"else",
"{",
"updateCount",
"=",
"0",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.session.store.cache.CacheHashMap.overQualLastAccessTimeUpdate\"",
",",
"\"859\"",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"sess",
"}",
")",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"ERROR_CACHE_ACCESS\"",
",",
"ex",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"INTERNAL_SERVER_ERROR\"",
")",
")",
";",
"}",
"return",
"updateCount",
";",
"}"
] | Attempts to update the last access time ensuring the old value matches.
This verifies that the copy we have in cache is still valid.
@see com.ibm.ws.session.store.common.BackedHashMap#overQualLastAccessTimeUpdate(com.ibm.ws.session.store.common.BackedSession, long) | [
"Attempts",
"to",
"update",
"the",
"last",
"access",
"time",
"ensuring",
"the",
"old",
"value",
"matches",
".",
"This",
"verifies",
"that",
"the",
"copy",
"we",
"have",
"in",
"cache",
"is",
"still",
"valid",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/CacheHashMap.java#L829-L884 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java | MediaTypeHeaderProvider.typeToString | @Trivial
public static String typeToString(MediaType type, List<String> ignoreParams) {
if (type == null) {
throw new IllegalArgumentException("MediaType parameter is null");
}
StringBuilder sb = new StringBuilder();
sb.append(type.getType()).append('/').append(type.getSubtype());
Map<String, String> params = type.getParameters();
if (params != null) {
for (Iterator<Map.Entry<String, String>> iter = params.entrySet().iterator();
iter.hasNext();) {
Map.Entry<String, String> entry = iter.next();
if (ignoreParams != null && ignoreParams.contains(entry.getKey())) {
continue;
}
sb.append(';').append(entry.getKey()).append('=').append(entry.getValue());
}
}
return sb.toString();
} | java | @Trivial
public static String typeToString(MediaType type, List<String> ignoreParams) {
if (type == null) {
throw new IllegalArgumentException("MediaType parameter is null");
}
StringBuilder sb = new StringBuilder();
sb.append(type.getType()).append('/').append(type.getSubtype());
Map<String, String> params = type.getParameters();
if (params != null) {
for (Iterator<Map.Entry<String, String>> iter = params.entrySet().iterator();
iter.hasNext();) {
Map.Entry<String, String> entry = iter.next();
if (ignoreParams != null && ignoreParams.contains(entry.getKey())) {
continue;
}
sb.append(';').append(entry.getKey()).append('=').append(entry.getValue());
}
}
return sb.toString();
} | [
"@",
"Trivial",
"public",
"static",
"String",
"typeToString",
"(",
"MediaType",
"type",
",",
"List",
"<",
"String",
">",
"ignoreParams",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"MediaType parameter is null\"",
")",
";",
"}",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"type",
".",
"getType",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"type",
".",
"getSubtype",
"(",
")",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"type",
".",
"getParameters",
"(",
")",
";",
"if",
"(",
"params",
"!=",
"null",
")",
"{",
"for",
"(",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"iter",
"=",
"params",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
"=",
"iter",
".",
"next",
"(",
")",
";",
"if",
"(",
"ignoreParams",
"!=",
"null",
"&&",
"ignoreParams",
".",
"contains",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
")",
"{",
"continue",
";",
"}",
"sb",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | to the implementation | [
"to",
"the",
"implementation"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java#L147-L168 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/CompHandshakeFactory.java | CompHandshakeFactory.createHandshakeInstance | private static void createHandshakeInstance() throws Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createHandshakeInstance");
try {
instance = Class.forName(MfpConstants.COMP_HANDSHAKE_CLASS).newInstance();
} catch (Exception e) {
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.CompHandshakeFactory.createHandshakeInstance", "88");
SibTr.error(tc, "UNABLE_TO_CREATE_COMPHANDSHAKE_CWSIF0051", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createHandshakeInstance");
} | java | private static void createHandshakeInstance() throws Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createHandshakeInstance");
try {
instance = Class.forName(MfpConstants.COMP_HANDSHAKE_CLASS).newInstance();
} catch (Exception e) {
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.CompHandshakeFactory.createHandshakeInstance", "88");
SibTr.error(tc, "UNABLE_TO_CREATE_COMPHANDSHAKE_CWSIF0051", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createHandshakeInstance");
} | [
"private",
"static",
"void",
"createHandshakeInstance",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createHandshakeInstance\"",
")",
";",
"try",
"{",
"instance",
"=",
"Class",
".",
"forName",
"(",
"MfpConstants",
".",
"COMP_HANDSHAKE_CLASS",
")",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.mfp.CompHandshakeFactory.createHandshakeInstance\"",
",",
"\"88\"",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"UNABLE_TO_CREATE_COMPHANDSHAKE_CWSIF0051\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createHandshakeInstance\"",
")",
";",
"}"
] | Create the singleton ComponentHandshake instance.
@exception Exception The method rethrows any Exception caught during
creaton of the singleton object. | [
"Create",
"the",
"singleton",
"ComponentHandshake",
"instance",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/CompHandshakeFactory.java#L67-L77 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFactoryDataImpl.java | ChannelFactoryDataImpl.setProperties | synchronized void setProperties(Map<Object, Object> m) throws ChannelFactoryPropertyIgnoredException {
this.myProperties = m;
if (cf != null) {
cf.updateProperties(m);
}
} | java | synchronized void setProperties(Map<Object, Object> m) throws ChannelFactoryPropertyIgnoredException {
this.myProperties = m;
if (cf != null) {
cf.updateProperties(m);
}
} | [
"synchronized",
"void",
"setProperties",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
"m",
")",
"throws",
"ChannelFactoryPropertyIgnoredException",
"{",
"this",
".",
"myProperties",
"=",
"m",
";",
"if",
"(",
"cf",
"!=",
"null",
")",
"{",
"cf",
".",
"updateProperties",
"(",
"m",
")",
";",
"}",
"}"
] | internally set the properties associated with this object
@param m
@throws ChannelFactoryPropertyIgnoredException | [
"internally",
"set",
"the",
"properties",
"associated",
"with",
"this",
"object"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFactoryDataImpl.java#L104-L110 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFactoryDataImpl.java | ChannelFactoryDataImpl.setProperty | synchronized void setProperty(Object key, Object value) throws ChannelFactoryPropertyIgnoredException {
if (null == key) {
throw new ChannelFactoryPropertyIgnoredException("Ignored channel factory property key of null");
}
if (myProperties == null) {
this.myProperties = new HashMap<Object, Object>();
}
this.myProperties.put(key, value);
if (cf != null) {
cf.updateProperties(myProperties);
}
} | java | synchronized void setProperty(Object key, Object value) throws ChannelFactoryPropertyIgnoredException {
if (null == key) {
throw new ChannelFactoryPropertyIgnoredException("Ignored channel factory property key of null");
}
if (myProperties == null) {
this.myProperties = new HashMap<Object, Object>();
}
this.myProperties.put(key, value);
if (cf != null) {
cf.updateProperties(myProperties);
}
} | [
"synchronized",
"void",
"setProperty",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"throws",
"ChannelFactoryPropertyIgnoredException",
"{",
"if",
"(",
"null",
"==",
"key",
")",
"{",
"throw",
"new",
"ChannelFactoryPropertyIgnoredException",
"(",
"\"Ignored channel factory property key of null\"",
")",
";",
"}",
"if",
"(",
"myProperties",
"==",
"null",
")",
"{",
"this",
".",
"myProperties",
"=",
"new",
"HashMap",
"<",
"Object",
",",
"Object",
">",
"(",
")",
";",
"}",
"this",
".",
"myProperties",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"if",
"(",
"cf",
"!=",
"null",
")",
"{",
"cf",
".",
"updateProperties",
"(",
"myProperties",
")",
";",
"}",
"}"
] | Iternally set a property associated with this object
@param key
@param value
@throws ChannelFactoryPropertyIgnoredException | [
"Iternally",
"set",
"a",
"property",
"associated",
"with",
"this",
"object"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFactoryDataImpl.java#L119-L130 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFactoryDataImpl.java | ChannelFactoryDataImpl.setChannelFactory | synchronized void setChannelFactory(ChannelFactory factory) throws ChannelFactoryException {
if (factory != null && cf != null) {
throw new ChannelFactoryException("ChannelFactory already exists");
}
this.cf = factory;
} | java | synchronized void setChannelFactory(ChannelFactory factory) throws ChannelFactoryException {
if (factory != null && cf != null) {
throw new ChannelFactoryException("ChannelFactory already exists");
}
this.cf = factory;
} | [
"synchronized",
"void",
"setChannelFactory",
"(",
"ChannelFactory",
"factory",
")",
"throws",
"ChannelFactoryException",
"{",
"if",
"(",
"factory",
"!=",
"null",
"&&",
"cf",
"!=",
"null",
")",
"{",
"throw",
"new",
"ChannelFactoryException",
"(",
"\"ChannelFactory already exists\"",
")",
";",
"}",
"this",
".",
"cf",
"=",
"factory",
";",
"}"
] | Internally set the channel factory in this data object.
@param factory
@throws ChannelFactoryException | [
"Internally",
"set",
"the",
"channel",
"factory",
"in",
"this",
"data",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFactoryDataImpl.java#L147-L152 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.inbound.security/src/com/ibm/ws/jca/security/internal/SecWorkContextHandler.java | SecWorkContextHandler.dissociate | public void dissociate() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "dissociate");
}
if (WSSecurityHelper.isServerSecurityEnabled()) {
J2CSecurityHelper.removeRunAsSubject();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "dissociate");
}
} | java | public void dissociate() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "dissociate");
}
if (WSSecurityHelper.isServerSecurityEnabled()) {
J2CSecurityHelper.removeRunAsSubject();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "dissociate");
}
} | [
"public",
"void",
"dissociate",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"dissociate\"",
")",
";",
"}",
"if",
"(",
"WSSecurityHelper",
".",
"isServerSecurityEnabled",
"(",
")",
")",
"{",
"J2CSecurityHelper",
".",
"removeRunAsSubject",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"dissociate\"",
")",
";",
"}",
"}"
] | This method is called by the WorkProxy class to dissociate the inflown
SecurityContext from the workmanager thread after it has run the work
By the time this method is called, the WSSubject.doAs method call would
have exited and the runAs subject would be dissociated. So all that is
left to do here is to clear the ThreadLocal variable that is set with
the runAs subject in the associate method.
@return void | [
"This",
"method",
"is",
"called",
"by",
"the",
"WorkProxy",
"class",
"to",
"dissociate",
"the",
"inflown",
"SecurityContext",
"from",
"the",
"workmanager",
"thread",
"after",
"it",
"has",
"run",
"the",
"work",
"By",
"the",
"time",
"this",
"method",
"is",
"called",
"the",
"WSSubject",
".",
"doAs",
"method",
"call",
"would",
"have",
"exited",
"and",
"the",
"runAs",
"subject",
"would",
"be",
"dissociated",
".",
"So",
"all",
"that",
"is",
"left",
"to",
"do",
"here",
"is",
"to",
"clear",
"the",
"ThreadLocal",
"variable",
"that",
"is",
"set",
"with",
"the",
"runAs",
"subject",
"in",
"the",
"associate",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.inbound.security/src/com/ibm/ws/jca/security/internal/SecWorkContextHandler.java#L252-L262 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/BatchStatusValidator.java | BatchStatusValidator.validateStatusAtInstanceRestart | public static void validateStatusAtInstanceRestart(long jobInstanceId, Properties restartJobParameters) throws JobRestartException, JobExecutionAlreadyCompleteException {
IPersistenceManagerService iPers = ServicesManagerStaticAnchor.getServicesManager().getPersistenceManagerService();
WSJobInstance jobInstance = iPers.getJobInstance(jobInstanceId);
Helper helper = new Helper(jobInstance, restartJobParameters);
if (!StringUtils.isEmpty(jobInstance.getJobXml())) {
helper.validateRestartableFalseJobsDoNotRestart();
}
helper.validateJobInstanceFailedOrStopped();
} | java | public static void validateStatusAtInstanceRestart(long jobInstanceId, Properties restartJobParameters) throws JobRestartException, JobExecutionAlreadyCompleteException {
IPersistenceManagerService iPers = ServicesManagerStaticAnchor.getServicesManager().getPersistenceManagerService();
WSJobInstance jobInstance = iPers.getJobInstance(jobInstanceId);
Helper helper = new Helper(jobInstance, restartJobParameters);
if (!StringUtils.isEmpty(jobInstance.getJobXml())) {
helper.validateRestartableFalseJobsDoNotRestart();
}
helper.validateJobInstanceFailedOrStopped();
} | [
"public",
"static",
"void",
"validateStatusAtInstanceRestart",
"(",
"long",
"jobInstanceId",
",",
"Properties",
"restartJobParameters",
")",
"throws",
"JobRestartException",
",",
"JobExecutionAlreadyCompleteException",
"{",
"IPersistenceManagerService",
"iPers",
"=",
"ServicesManagerStaticAnchor",
".",
"getServicesManager",
"(",
")",
".",
"getPersistenceManagerService",
"(",
")",
";",
"WSJobInstance",
"jobInstance",
"=",
"iPers",
".",
"getJobInstance",
"(",
"jobInstanceId",
")",
";",
"Helper",
"helper",
"=",
"new",
"Helper",
"(",
"jobInstance",
",",
"restartJobParameters",
")",
";",
"if",
"(",
"!",
"StringUtils",
".",
"isEmpty",
"(",
"jobInstance",
".",
"getJobXml",
"(",
")",
")",
")",
"{",
"helper",
".",
"validateRestartableFalseJobsDoNotRestart",
"(",
")",
";",
"}",
"helper",
".",
"validateJobInstanceFailedOrStopped",
"(",
")",
";",
"}"
] | validates job is restart-able,
validates the jobInstance is in failed or stopped | [
"validates",
"job",
"is",
"restart",
"-",
"able",
"validates",
"the",
"jobInstance",
"is",
"in",
"failed",
"or",
"stopped"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/BatchStatusValidator.java#L48-L58 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/DataItem.java | DataItem.write | protected void write(WriteableLogRecord logRecord)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "write", new Object[]{logRecord, this});
// Retrieve the data stored within this data item. This will either come from
// the cached in memory copy or retrieved from disk.
byte[] data = this.getData();
if (tc.isDebugEnabled()) Tr.debug(tc, "Writing '" + data.length + "' bytes " + RLSUtils.toHexString(data,RLSUtils.MAX_DISPLAY_BYTES));
if (tc.isDebugEnabled()) Tr.debug(tc, "Writing length field");
logRecord.putInt(data.length);
// If this data item is using the file backed storage method then we need
// record details of the mapped storage buffer and offset within that buffer
// where the data has been placed. If this is the first write call then the
// information would currently be cached in memory. After this call has
// executed further access will require the getData method to go to disk.
// If this is a subsequent write call then the getData method will retrieve
// the information from the current mapped byte buffer and position and
// write it to the new mapped byte buffer and position. It will then cache
// the new location details.
if (_storageMode == MultiScopeRecoveryLog.FILE_BACKED)
{
if (tc.isDebugEnabled()) Tr.debug(tc, "Updaing data location references");
_filePosition = logRecord.position();
_logRecord = logRecord;
_data = null;
}
if (tc.isDebugEnabled()) Tr.debug(tc, "Writing data field");
logRecord.put(data);
if (!_written)
{
// This is the first time since creation of this object or reset of its internal
// data (SingleData class only, setData method) that the write method has been
// called. We know that the parent recoverable unit section is accounting for
// this data items payload in its unwritten data size. Accordingly we need to
// direct it to update this value.
_rus.payloadWritten(_dataSize + HEADER_SIZE);
}
_written = true;
if (tc.isEntryEnabled()) Tr.exit(tc, "write");
} | java | protected void write(WriteableLogRecord logRecord)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "write", new Object[]{logRecord, this});
// Retrieve the data stored within this data item. This will either come from
// the cached in memory copy or retrieved from disk.
byte[] data = this.getData();
if (tc.isDebugEnabled()) Tr.debug(tc, "Writing '" + data.length + "' bytes " + RLSUtils.toHexString(data,RLSUtils.MAX_DISPLAY_BYTES));
if (tc.isDebugEnabled()) Tr.debug(tc, "Writing length field");
logRecord.putInt(data.length);
// If this data item is using the file backed storage method then we need
// record details of the mapped storage buffer and offset within that buffer
// where the data has been placed. If this is the first write call then the
// information would currently be cached in memory. After this call has
// executed further access will require the getData method to go to disk.
// If this is a subsequent write call then the getData method will retrieve
// the information from the current mapped byte buffer and position and
// write it to the new mapped byte buffer and position. It will then cache
// the new location details.
if (_storageMode == MultiScopeRecoveryLog.FILE_BACKED)
{
if (tc.isDebugEnabled()) Tr.debug(tc, "Updaing data location references");
_filePosition = logRecord.position();
_logRecord = logRecord;
_data = null;
}
if (tc.isDebugEnabled()) Tr.debug(tc, "Writing data field");
logRecord.put(data);
if (!_written)
{
// This is the first time since creation of this object or reset of its internal
// data (SingleData class only, setData method) that the write method has been
// called. We know that the parent recoverable unit section is accounting for
// this data items payload in its unwritten data size. Accordingly we need to
// direct it to update this value.
_rus.payloadWritten(_dataSize + HEADER_SIZE);
}
_written = true;
if (tc.isEntryEnabled()) Tr.exit(tc, "write");
} | [
"protected",
"void",
"write",
"(",
"WriteableLogRecord",
"logRecord",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"write\"",
",",
"new",
"Object",
"[",
"]",
"{",
"logRecord",
",",
"this",
"}",
")",
";",
"// Retrieve the data stored within this data item. This will either come from",
"// the cached in memory copy or retrieved from disk.",
"byte",
"[",
"]",
"data",
"=",
"this",
".",
"getData",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Writing '\"",
"+",
"data",
".",
"length",
"+",
"\"' bytes \"",
"+",
"RLSUtils",
".",
"toHexString",
"(",
"data",
",",
"RLSUtils",
".",
"MAX_DISPLAY_BYTES",
")",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Writing length field\"",
")",
";",
"logRecord",
".",
"putInt",
"(",
"data",
".",
"length",
")",
";",
"// If this data item is using the file backed storage method then we need",
"// record details of the mapped storage buffer and offset within that buffer",
"// where the data has been placed. If this is the first write call then the",
"// information would currently be cached in memory. After this call has",
"// executed further access will require the getData method to go to disk.",
"// If this is a subsequent write call then the getData method will retrieve",
"// the information from the current mapped byte buffer and position and",
"// write it to the new mapped byte buffer and position. It will then cache",
"// the new location details.",
"if",
"(",
"_storageMode",
"==",
"MultiScopeRecoveryLog",
".",
"FILE_BACKED",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Updaing data location references\"",
")",
";",
"_filePosition",
"=",
"logRecord",
".",
"position",
"(",
")",
";",
"_logRecord",
"=",
"logRecord",
";",
"_data",
"=",
"null",
";",
"}",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Writing data field\"",
")",
";",
"logRecord",
".",
"put",
"(",
"data",
")",
";",
"if",
"(",
"!",
"_written",
")",
"{",
"// This is the first time since creation of this object or reset of its internal",
"// data (SingleData class only, setData method) that the write method has been",
"// called. We know that the parent recoverable unit section is accounting for",
"// this data items payload in its unwritten data size. Accordingly we need to",
"// direct it to update this value.",
"_rus",
".",
"payloadWritten",
"(",
"_dataSize",
"+",
"HEADER_SIZE",
")",
";",
"}",
"_written",
"=",
"true",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"write\"",
")",
";",
"}"
] | Instructs this DataItem to write its data to the given WriteableLogRecord.
The write involves writing the length of the data as an int followed by
the data itself. The data is written at the log record's current position.
@param logRecord The WriteableLogRecord to write the enapsulated data to. | [
"Instructs",
"this",
"DataItem",
"to",
"write",
"its",
"data",
"to",
"the",
"given",
"WriteableLogRecord",
".",
"The",
"write",
"involves",
"writing",
"the",
"length",
"of",
"the",
"data",
"as",
"an",
"int",
"followed",
"by",
"the",
"data",
"itself",
".",
"The",
"data",
"is",
"written",
"at",
"the",
"log",
"record",
"s",
"current",
"position",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/DataItem.java#L187-L233 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/DataItem.java | DataItem.getData | protected byte[] getData()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getData", this);
byte[] data = _data;
if (data != null)
{
// There is data cached in memory. Simply use this directly.
if (tc.isDebugEnabled()) Tr.debug(tc, "Cached data located");
}
else
{
if (_storageMode == MultiScopeRecoveryLog.FILE_BACKED)
{
// There is no data cached in memory - it must be retrieved from disk.
if (tc.isDebugEnabled()) Tr.debug(tc, "No cached data located. Attempting data retreival");
// If there is no data cached in memory and we are operating in file
// backed mode then retireve the data from disk.
if (_filePosition != UNWRITTEN)
{
if (tc.isDebugEnabled()) Tr.debug(tc, "Retrieving " + _dataSize + " bytes of data @ position " + _filePosition);
_logRecord.position(_filePosition);
data = new byte[_dataSize];
_logRecord.get(data);
}
else
{
// The data should have been stored on disk but the file position was not set. Return null
// to the caller and allow them to handle this failure.
if (tc.isDebugEnabled()) Tr.debug(tc, "Unable to retrieve data as file position is not set");
}
}
else
{
// The data should have been cached in memory but was not found Return null to the caller and
// allow them to handle this failure.
if (tc.isDebugEnabled()) Tr.debug(tc, "No cached data located");
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "getData", new Object[]{new Integer(data.length),RLSUtils.toHexString(data,RLSUtils.MAX_DISPLAY_BYTES)});
return data;
} | java | protected byte[] getData()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getData", this);
byte[] data = _data;
if (data != null)
{
// There is data cached in memory. Simply use this directly.
if (tc.isDebugEnabled()) Tr.debug(tc, "Cached data located");
}
else
{
if (_storageMode == MultiScopeRecoveryLog.FILE_BACKED)
{
// There is no data cached in memory - it must be retrieved from disk.
if (tc.isDebugEnabled()) Tr.debug(tc, "No cached data located. Attempting data retreival");
// If there is no data cached in memory and we are operating in file
// backed mode then retireve the data from disk.
if (_filePosition != UNWRITTEN)
{
if (tc.isDebugEnabled()) Tr.debug(tc, "Retrieving " + _dataSize + " bytes of data @ position " + _filePosition);
_logRecord.position(_filePosition);
data = new byte[_dataSize];
_logRecord.get(data);
}
else
{
// The data should have been stored on disk but the file position was not set. Return null
// to the caller and allow them to handle this failure.
if (tc.isDebugEnabled()) Tr.debug(tc, "Unable to retrieve data as file position is not set");
}
}
else
{
// The data should have been cached in memory but was not found Return null to the caller and
// allow them to handle this failure.
if (tc.isDebugEnabled()) Tr.debug(tc, "No cached data located");
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "getData", new Object[]{new Integer(data.length),RLSUtils.toHexString(data,RLSUtils.MAX_DISPLAY_BYTES)});
return data;
} | [
"protected",
"byte",
"[",
"]",
"getData",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getData\"",
",",
"this",
")",
";",
"byte",
"[",
"]",
"data",
"=",
"_data",
";",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"// There is data cached in memory. Simply use this directly.",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Cached data located\"",
")",
";",
"}",
"else",
"{",
"if",
"(",
"_storageMode",
"==",
"MultiScopeRecoveryLog",
".",
"FILE_BACKED",
")",
"{",
"// There is no data cached in memory - it must be retrieved from disk.",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"No cached data located. Attempting data retreival\"",
")",
";",
"// If there is no data cached in memory and we are operating in file",
"// backed mode then retireve the data from disk.",
"if",
"(",
"_filePosition",
"!=",
"UNWRITTEN",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Retrieving \"",
"+",
"_dataSize",
"+",
"\" bytes of data @ position \"",
"+",
"_filePosition",
")",
";",
"_logRecord",
".",
"position",
"(",
"_filePosition",
")",
";",
"data",
"=",
"new",
"byte",
"[",
"_dataSize",
"]",
";",
"_logRecord",
".",
"get",
"(",
"data",
")",
";",
"}",
"else",
"{",
"// The data should have been stored on disk but the file position was not set. Return null",
"// to the caller and allow them to handle this failure.",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Unable to retrieve data as file position is not set\"",
")",
";",
"}",
"}",
"else",
"{",
"// The data should have been cached in memory but was not found Return null to the caller and ",
"// allow them to handle this failure.",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"No cached data located\"",
")",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getData\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Integer",
"(",
"data",
".",
"length",
")",
",",
"RLSUtils",
".",
"toHexString",
"(",
"data",
",",
"RLSUtils",
".",
"MAX_DISPLAY_BYTES",
")",
"}",
")",
";",
"return",
"data",
";",
"}"
] | Returns the data encapsulated by this DataItem instance. If this DataItem
is memory back the in memory copy of the data is always returned. If the
DataItem is file backed and it has been written to disk the data is
retrieved from disk and then returned.
@return This DataItem instance's data | [
"Returns",
"the",
"data",
"encapsulated",
"by",
"this",
"DataItem",
"instance",
".",
"If",
"this",
"DataItem",
"is",
"memory",
"back",
"the",
"in",
"memory",
"copy",
"of",
"the",
"data",
"is",
"always",
"returned",
".",
"If",
"the",
"DataItem",
"is",
"file",
"backed",
"and",
"it",
"has",
"been",
"written",
"to",
"disk",
"the",
"data",
"is",
"retrieved",
"from",
"disk",
"and",
"then",
"returned",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/DataItem.java#L244-L288 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security.impl/src/com/ibm/ws/security/intfc/internal/WSSecurityServiceImpl.java | WSSecurityServiceImpl.getActiveUserRegistry | private UserRegistry getActiveUserRegistry() throws WSSecurityException {
final String METHOD = "getUserRegistry";
UserRegistry activeUserRegistry = null;
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, METHOD + " securityServiceRef " + securityServiceRef);
}
SecurityService ss = securityServiceRef.getService();
if (ss == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, METHOD + " No SecurityService, returning null");
}
} else {
UserRegistryService urs = ss.getUserRegistryService();
if (urs == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, METHOD + " No UserRegistryService, returning null");
}
} else {
if (urs.isUserRegistryConfigured()) {
com.ibm.ws.security.registry.UserRegistry userRegistry = urs.getUserRegistry();
activeUserRegistry = urs.getExternalUserRegistry(userRegistry);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, METHOD + " Security enabled but no registry configured");
}
}
}
}
} catch (RegistryException e) {
String msg = "getUserRegistryWrapper failed due to an internal error: " + e.getMessage();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, msg, e);
}
throw new WSSecurityException(msg, e);
}
return activeUserRegistry;
} | java | private UserRegistry getActiveUserRegistry() throws WSSecurityException {
final String METHOD = "getUserRegistry";
UserRegistry activeUserRegistry = null;
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, METHOD + " securityServiceRef " + securityServiceRef);
}
SecurityService ss = securityServiceRef.getService();
if (ss == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, METHOD + " No SecurityService, returning null");
}
} else {
UserRegistryService urs = ss.getUserRegistryService();
if (urs == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, METHOD + " No UserRegistryService, returning null");
}
} else {
if (urs.isUserRegistryConfigured()) {
com.ibm.ws.security.registry.UserRegistry userRegistry = urs.getUserRegistry();
activeUserRegistry = urs.getExternalUserRegistry(userRegistry);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, METHOD + " Security enabled but no registry configured");
}
}
}
}
} catch (RegistryException e) {
String msg = "getUserRegistryWrapper failed due to an internal error: " + e.getMessage();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, msg, e);
}
throw new WSSecurityException(msg, e);
}
return activeUserRegistry;
} | [
"private",
"UserRegistry",
"getActiveUserRegistry",
"(",
")",
"throws",
"WSSecurityException",
"{",
"final",
"String",
"METHOD",
"=",
"\"getUserRegistry\"",
";",
"UserRegistry",
"activeUserRegistry",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHOD",
"+",
"\" securityServiceRef \"",
"+",
"securityServiceRef",
")",
";",
"}",
"SecurityService",
"ss",
"=",
"securityServiceRef",
".",
"getService",
"(",
")",
";",
"if",
"(",
"ss",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHOD",
"+",
"\" No SecurityService, returning null\"",
")",
";",
"}",
"}",
"else",
"{",
"UserRegistryService",
"urs",
"=",
"ss",
".",
"getUserRegistryService",
"(",
")",
";",
"if",
"(",
"urs",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHOD",
"+",
"\" No UserRegistryService, returning null\"",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"urs",
".",
"isUserRegistryConfigured",
"(",
")",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"security",
".",
"registry",
".",
"UserRegistry",
"userRegistry",
"=",
"urs",
".",
"getUserRegistry",
"(",
")",
";",
"activeUserRegistry",
"=",
"urs",
".",
"getExternalUserRegistry",
"(",
"userRegistry",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHOD",
"+",
"\" Security enabled but no registry configured\"",
")",
";",
"}",
"}",
"}",
"}",
"}",
"catch",
"(",
"RegistryException",
"e",
")",
"{",
"String",
"msg",
"=",
"\"getUserRegistryWrapper failed due to an internal error: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"msg",
",",
"e",
")",
";",
"}",
"throw",
"new",
"WSSecurityException",
"(",
"msg",
",",
"e",
")",
";",
"}",
"return",
"activeUserRegistry",
";",
"}"
] | Returns the active UserRegistry. If the active user registry is an instance of
com.ibm.ws.security.registry.UserRegistry, then it will be wrapped. Otherwise,
if the active user registry is an instance of CustomUserRegistryWrapper, then the
underlying com.ibm.websphere.security.UserRegistry will be returned.
@return UserRegistry the active user registry.
@throws WSSecurityException | [
"Returns",
"the",
"active",
"UserRegistry",
".",
"If",
"the",
"active",
"user",
"registry",
"is",
"an",
"instance",
"of",
"com",
".",
"ibm",
".",
"ws",
".",
"security",
".",
"registry",
".",
"UserRegistry",
"then",
"it",
"will",
"be",
"wrapped",
".",
"Otherwise",
"if",
"the",
"active",
"user",
"registry",
"is",
"an",
"instance",
"of",
"CustomUserRegistryWrapper",
"then",
"the",
"underlying",
"com",
".",
"ibm",
".",
"websphere",
".",
"security",
".",
"UserRegistry",
"will",
"be",
"returned",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security.impl/src/com/ibm/ws/security/intfc/internal/WSSecurityServiceImpl.java#L156-L193 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/SessionBeanO.java | SessionBeanO.getUserTransaction | @Override
public synchronized UserTransaction getUserTransaction()
{
// d367572.1 start
if (state == PRE_CREATE)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Incorrect state: " + getStateName(state));
throw new IllegalStateException(getStateName(state));
}
// d367572.1 end
return UserTransactionWrapper.INSTANCE; // d631349
} | java | @Override
public synchronized UserTransaction getUserTransaction()
{
// d367572.1 start
if (state == PRE_CREATE)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Incorrect state: " + getStateName(state));
throw new IllegalStateException(getStateName(state));
}
// d367572.1 end
return UserTransactionWrapper.INSTANCE; // d631349
} | [
"@",
"Override",
"public",
"synchronized",
"UserTransaction",
"getUserTransaction",
"(",
")",
"{",
"// d367572.1 start",
"if",
"(",
"state",
"==",
"PRE_CREATE",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Incorrect state: \"",
"+",
"getStateName",
"(",
"state",
")",
")",
";",
"throw",
"new",
"IllegalStateException",
"(",
"getStateName",
"(",
"state",
")",
")",
";",
"}",
"// d367572.1 end",
"return",
"UserTransactionWrapper",
".",
"INSTANCE",
";",
"// d631349",
"}"
] | Get user transaction object that bean can use to demarcate
transactions. | [
"Get",
"user",
"transaction",
"object",
"that",
"bean",
"can",
"use",
"to",
"demarcate",
"transactions",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/SessionBeanO.java#L221-L235 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/SessionBeanO.java | SessionBeanO.getContextData | @Override
public Map<String, Object> getContextData()
{
// Calling getContextData is not allowed from setSessionContext.
if (state == PRE_CREATE || state == DESTROYED)
{
IllegalStateException ise;
ise = new IllegalStateException("SessionBean: getContextData " +
"not allowed from state = " +
getStateName(state));
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getContextData: " + ise);
throw ise;
}
return super.getContextData();
} | java | @Override
public Map<String, Object> getContextData()
{
// Calling getContextData is not allowed from setSessionContext.
if (state == PRE_CREATE || state == DESTROYED)
{
IllegalStateException ise;
ise = new IllegalStateException("SessionBean: getContextData " +
"not allowed from state = " +
getStateName(state));
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getContextData: " + ise);
throw ise;
}
return super.getContextData();
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getContextData",
"(",
")",
"{",
"// Calling getContextData is not allowed from setSessionContext.",
"if",
"(",
"state",
"==",
"PRE_CREATE",
"||",
"state",
"==",
"DESTROYED",
")",
"{",
"IllegalStateException",
"ise",
";",
"ise",
"=",
"new",
"IllegalStateException",
"(",
"\"SessionBean: getContextData \"",
"+",
"\"not allowed from state = \"",
"+",
"getStateName",
"(",
"state",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getContextData: \"",
"+",
"ise",
")",
";",
"throw",
"ise",
";",
"}",
"return",
"super",
".",
"getContextData",
"(",
")",
";",
"}"
] | F743-21028 | [
"F743",
"-",
"21028"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/SessionBeanO.java#L243-L261 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/SessionBeanO.java | SessionBeanO.canBeRemoved | protected void canBeRemoved()
throws RemoveException
{
ContainerTx tx = container.getCurrentContainerTx();//d171654
//-------------------------------------------------------------
// If there is no current transaction then we are removing a
// TX_BEAN_MANAGED session bean outside of a transaction which
// is correct.
//-------------------------------------------------------------
if (tx == null)
{
return;
}
// Stateful beans cannot be removed in a global transaction,
// unless this is an EJB 3.0 business method designated as a
// removemethod d451675
if (tx.isTransactionGlobal() &&
tx.ivRemoveBeanO != this)
{
throw new RemoveException("Cannot remove session bean " +
"within a transaction.");
}
} | java | protected void canBeRemoved()
throws RemoveException
{
ContainerTx tx = container.getCurrentContainerTx();//d171654
//-------------------------------------------------------------
// If there is no current transaction then we are removing a
// TX_BEAN_MANAGED session bean outside of a transaction which
// is correct.
//-------------------------------------------------------------
if (tx == null)
{
return;
}
// Stateful beans cannot be removed in a global transaction,
// unless this is an EJB 3.0 business method designated as a
// removemethod d451675
if (tx.isTransactionGlobal() &&
tx.ivRemoveBeanO != this)
{
throw new RemoveException("Cannot remove session bean " +
"within a transaction.");
}
} | [
"protected",
"void",
"canBeRemoved",
"(",
")",
"throws",
"RemoveException",
"{",
"ContainerTx",
"tx",
"=",
"container",
".",
"getCurrentContainerTx",
"(",
")",
";",
"//d171654",
"//-------------------------------------------------------------",
"// If there is no current transaction then we are removing a",
"// TX_BEAN_MANAGED session bean outside of a transaction which",
"// is correct.",
"//-------------------------------------------------------------",
"if",
"(",
"tx",
"==",
"null",
")",
"{",
"return",
";",
"}",
"// Stateful beans cannot be removed in a global transaction,",
"// unless this is an EJB 3.0 business method designated as a",
"// removemethod d451675",
"if",
"(",
"tx",
".",
"isTransactionGlobal",
"(",
")",
"&&",
"tx",
".",
"ivRemoveBeanO",
"!=",
"this",
")",
"{",
"throw",
"new",
"RemoveException",
"(",
"\"Cannot remove session bean \"",
"+",
"\"within a transaction.\"",
")",
";",
"}",
"}"
] | Checks if beanO can be removed. Throws RemoveException if
cannot be removed. | [
"Checks",
"if",
"beanO",
"can",
"be",
"removed",
".",
"Throws",
"RemoveException",
"if",
"cannot",
"be",
"removed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/SessionBeanO.java#L267-L293 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.toKey | @Trivial
private static String toKey(String name, String filter, SearchControls cons) {
int length = name.length() + filter.length() + 100;
StringBuffer key = new StringBuffer(length);
key.append(name);
key.append("|");
key.append(filter);
key.append("|");
key.append(cons.getSearchScope());
key.append("|");
key.append(cons.getCountLimit());
key.append("|");
key.append(cons.getTimeLimit());
String[] attrIds = cons.getReturningAttributes();
if (attrIds != null) {
for (int i = 0; i < attrIds.length; i++) {
key.append("|");
key.append(attrIds[i]);
}
}
return key.toString();
} | java | @Trivial
private static String toKey(String name, String filter, SearchControls cons) {
int length = name.length() + filter.length() + 100;
StringBuffer key = new StringBuffer(length);
key.append(name);
key.append("|");
key.append(filter);
key.append("|");
key.append(cons.getSearchScope());
key.append("|");
key.append(cons.getCountLimit());
key.append("|");
key.append(cons.getTimeLimit());
String[] attrIds = cons.getReturningAttributes();
if (attrIds != null) {
for (int i = 0; i < attrIds.length; i++) {
key.append("|");
key.append(attrIds[i]);
}
}
return key.toString();
} | [
"@",
"Trivial",
"private",
"static",
"String",
"toKey",
"(",
"String",
"name",
",",
"String",
"filter",
",",
"SearchControls",
"cons",
")",
"{",
"int",
"length",
"=",
"name",
".",
"length",
"(",
")",
"+",
"filter",
".",
"length",
"(",
")",
"+",
"100",
";",
"StringBuffer",
"key",
"=",
"new",
"StringBuffer",
"(",
"length",
")",
";",
"key",
".",
"append",
"(",
"name",
")",
";",
"key",
".",
"append",
"(",
"\"|\"",
")",
";",
"key",
".",
"append",
"(",
"filter",
")",
";",
"key",
".",
"append",
"(",
"\"|\"",
")",
";",
"key",
".",
"append",
"(",
"cons",
".",
"getSearchScope",
"(",
")",
")",
";",
"key",
".",
"append",
"(",
"\"|\"",
")",
";",
"key",
".",
"append",
"(",
"cons",
".",
"getCountLimit",
"(",
")",
")",
";",
"key",
".",
"append",
"(",
"\"|\"",
")",
";",
"key",
".",
"append",
"(",
"cons",
".",
"getTimeLimit",
"(",
")",
")",
";",
"String",
"[",
"]",
"attrIds",
"=",
"cons",
".",
"getReturningAttributes",
"(",
")",
";",
"if",
"(",
"attrIds",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"attrIds",
".",
"length",
";",
"i",
"++",
")",
"{",
"key",
".",
"append",
"(",
"\"|\"",
")",
";",
"key",
".",
"append",
"(",
"attrIds",
"[",
"i",
"]",
")",
";",
"}",
"}",
"return",
"key",
".",
"toString",
"(",
")",
";",
"}"
] | Returns a hash key for the name|filter|cons tuple used in the search
query-results cache.
@param name The name of the object from which to retrieve attributes.
@param filter the filter used in the search.
@param cons The search controls used in the search.
@throws NamingException If a naming exception is encountered. | [
"Returns",
"a",
"hash",
"key",
"for",
"the",
"name|filter|cons",
"tuple",
"used",
"in",
"the",
"search",
"query",
"-",
"results",
"cache",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L209-L231 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.toKey | @Trivial
private static String toKey(String name, String filterExpr, Object[] filterArgs, SearchControls cons) {
int length = name.length() + filterExpr.length() + filterArgs.length + 200;
StringBuffer key = new StringBuffer(length);
key.append(name);
key.append("|");
key.append(filterExpr);
String[] attrIds = cons.getReturningAttributes();
for (int i = 0; i < filterArgs.length; i++) {
key.append("|");
key.append(filterArgs[i]);
}
if (attrIds != null) {
for (int i = 0; i < attrIds.length; i++) {
key.append("|");
key.append(attrIds[i]);
}
}
return key.toString();
} | java | @Trivial
private static String toKey(String name, String filterExpr, Object[] filterArgs, SearchControls cons) {
int length = name.length() + filterExpr.length() + filterArgs.length + 200;
StringBuffer key = new StringBuffer(length);
key.append(name);
key.append("|");
key.append(filterExpr);
String[] attrIds = cons.getReturningAttributes();
for (int i = 0; i < filterArgs.length; i++) {
key.append("|");
key.append(filterArgs[i]);
}
if (attrIds != null) {
for (int i = 0; i < attrIds.length; i++) {
key.append("|");
key.append(attrIds[i]);
}
}
return key.toString();
} | [
"@",
"Trivial",
"private",
"static",
"String",
"toKey",
"(",
"String",
"name",
",",
"String",
"filterExpr",
",",
"Object",
"[",
"]",
"filterArgs",
",",
"SearchControls",
"cons",
")",
"{",
"int",
"length",
"=",
"name",
".",
"length",
"(",
")",
"+",
"filterExpr",
".",
"length",
"(",
")",
"+",
"filterArgs",
".",
"length",
"+",
"200",
";",
"StringBuffer",
"key",
"=",
"new",
"StringBuffer",
"(",
"length",
")",
";",
"key",
".",
"append",
"(",
"name",
")",
";",
"key",
".",
"append",
"(",
"\"|\"",
")",
";",
"key",
".",
"append",
"(",
"filterExpr",
")",
";",
"String",
"[",
"]",
"attrIds",
"=",
"cons",
".",
"getReturningAttributes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"filterArgs",
".",
"length",
";",
"i",
"++",
")",
"{",
"key",
".",
"append",
"(",
"\"|\"",
")",
";",
"key",
".",
"append",
"(",
"filterArgs",
"[",
"i",
"]",
")",
";",
"}",
"if",
"(",
"attrIds",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"attrIds",
".",
"length",
";",
"i",
"++",
")",
"{",
"key",
".",
"append",
"(",
"\"|\"",
")",
";",
"key",
".",
"append",
"(",
"attrIds",
"[",
"i",
"]",
")",
";",
"}",
"}",
"return",
"key",
".",
"toString",
"(",
")",
";",
"}"
] | Returns a hash key for the name|filterExpr|filterArgs|cons tuple used in the search
query-results cache.
@param name The name of the context or object to search
@param filterExpr the filter expression used in the search.
@param filterArgs the filter arguments used in the search.
@param cons The search controls used in the search.
@throws NamingException If a naming exception is encountered. | [
"Returns",
"a",
"hash",
"key",
"for",
"the",
"name|filterExpr|filterArgs|cons",
"tuple",
"used",
"in",
"the",
"search",
"query",
"-",
"results",
"cache",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L243-L262 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.getNameParser | public NameParser getNameParser() throws WIMException {
if (iNameParser == null) {
TimedDirContext ctx = iContextManager.getDirContext();
try {
try {
iNameParser = ctx.getNameParser("");
} catch (NamingException e) {
if (!ContextManager.isConnectionException(e)) {
throw e;
}
ctx = iContextManager.reCreateDirContext(ctx, e.toString());
iNameParser = ctx.getNameParser("");
}
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)), e);
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} finally {
iContextManager.releaseDirContext(ctx);
}
}
return iNameParser;
} | java | public NameParser getNameParser() throws WIMException {
if (iNameParser == null) {
TimedDirContext ctx = iContextManager.getDirContext();
try {
try {
iNameParser = ctx.getNameParser("");
} catch (NamingException e) {
if (!ContextManager.isConnectionException(e)) {
throw e;
}
ctx = iContextManager.reCreateDirContext(ctx, e.toString());
iNameParser = ctx.getNameParser("");
}
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)), e);
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} finally {
iContextManager.releaseDirContext(ctx);
}
}
return iNameParser;
} | [
"public",
"NameParser",
"getNameParser",
"(",
")",
"throws",
"WIMException",
"{",
"if",
"(",
"iNameParser",
"==",
"null",
")",
"{",
"TimedDirContext",
"ctx",
"=",
"iContextManager",
".",
"getDirContext",
"(",
")",
";",
"try",
"{",
"try",
"{",
"iNameParser",
"=",
"ctx",
".",
"getNameParser",
"(",
"\"\"",
")",
";",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"if",
"(",
"!",
"ContextManager",
".",
"isConnectionException",
"(",
"e",
")",
")",
"{",
"throw",
"e",
";",
"}",
"ctx",
"=",
"iContextManager",
".",
"reCreateDirContext",
"(",
"ctx",
",",
"e",
".",
"toString",
"(",
")",
")",
";",
"iNameParser",
"=",
"ctx",
".",
"getNameParser",
"(",
"\"\"",
")",
";",
"}",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"WIMMessageHelper",
".",
"generateMsgParms",
"(",
"e",
".",
"toString",
"(",
"true",
")",
")",
",",
"e",
")",
";",
"throw",
"new",
"WIMSystemException",
"(",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"msg",
",",
"e",
")",
";",
"}",
"finally",
"{",
"iContextManager",
".",
"releaseDirContext",
"(",
"ctx",
")",
";",
"}",
"}",
"return",
"iNameParser",
";",
"}"
] | Retrieves the parser associated with the root context.
@return The {@link NameParser}.
@throws WIMException If the {@link NameParser} could not be queried from the LDAP server. | [
"Retrieves",
"the",
"parser",
"associated",
"with",
"the",
"root",
"context",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L270-L291 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.initializeCaches | private void initializeCaches(Map<String, Object> configProps) {
final String METHODNAME = "initializeCaches(DataObject)";
/*
* initialize the cache pool names
*/
iAttrsCacheName = iReposId + "/" + iAttrsCacheName;
iSearchResultsCacheName = iReposId + "/" + iSearchResultsCacheName;
List<Map<String, Object>> cacheConfigs = Nester.nest(CACHE_CONFIG, configProps);
Map<String, Object> attrCacheConfig = null;
Map<String, Object> searchResultsCacheConfig = null;
if (!cacheConfigs.isEmpty()) {
Map<String, Object> cacheConfig = cacheConfigs.get(0);
Map<String, List<Map<String, Object>>> cacheInfo = Nester.nest(cacheConfig, ATTRIBUTES_CACHE_CONFIG, SEARCH_CACHE_CONFIG);
List<Map<String, Object>> attrList = cacheInfo.get(ATTRIBUTES_CACHE_CONFIG);
if (!attrList.isEmpty()) {
attrCacheConfig = attrList.get(0);
}
List<Map<String, Object>> searchList = cacheInfo.get(SEARCH_CACHE_CONFIG);
if (!searchList.isEmpty()) {
searchResultsCacheConfig = searchList.get(0);
}
if (attrCacheConfig != null) {
iAttrsCacheEnabled = (Boolean) attrCacheConfig.get(CONFIG_PROP_ENABLED);
if (iAttrsCacheEnabled) {
// Initialize the Attributes Cache size
iAttrsCacheSize = (Integer) attrCacheConfig.get(CONFIG_PROP_CACHE_SIZE);
iAttrsCacheTimeOut = (Long) attrCacheConfig.get(CONFIG_PROP_CACHE_TIME_OUT);
iAttrsSizeLmit = (Integer) attrCacheConfig.get(CONFIG_PROP_ATTRIBUTE_SIZE_LIMIT);
/*
* TODO:: Cache Distribution is not yet needed.
* String cacheDistPolicy = attrCacheConfig.getString(CONFIG_PROP_CACHE_DIST_POLICY);
* if (cacheDistPolicy != null) {
* iAttrsCacheDistPolicy = LdapHelper.getCacheDistPolicyInt(cacheDistPolicy);
* }
*/
}
}
if (searchResultsCacheConfig != null) {
iSearchResultsCacheEnabled = (Boolean) searchResultsCacheConfig.get(CONFIG_PROP_ENABLED);
if (iSearchResultsCacheEnabled) {
// Initialize the Search Results Cache size
iSearchResultsCacheSize = (Integer) searchResultsCacheConfig.get(CONFIG_PROP_CACHE_SIZE);
iSearchResultsCacheTimeOut = (Long) searchResultsCacheConfig.get(CONFIG_PROP_CACHE_TIME_OUT);
iSearchResultSizeLmit = (Integer) searchResultsCacheConfig.get(CONFIG_PROP_SEARCH_RESULTS_SIZE_LIMIT);
/*
* TODO:: Cache Distribution is not yet needed.
* String cacheDistPolicy = searchResultsCacheConfig.getProperties().get(ConfigConstants.CONFIG_PROP_CACHE_DIST_POLICY);
* if (cacheDistPolicy != null) {
* iSearchResultsCacheDistPolicy = LdapHelper.getCacheDistPolicyInt(cacheDistPolicy);
* }
*/
}
}
}
if (iAttrsCacheEnabled) {
createAttributesCache();
if (iAttrsCache == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Attributes Cache: " + iAttrsCacheName + " is not available because cache is not available yet.");
}
}
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Attributes Cache: " + iAttrsCacheName + " is disabled.");
}
}
if (iSearchResultsCacheEnabled) {
createSearchResultsCache();
if (iSearchResultsCache == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Search Results Cache: " + iSearchResultsCacheName + " is not available because cache is not available yet.");
}
}
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Search Results Cache: " + iSearchResultsCacheName + " is disabled.");
}
}
} | java | private void initializeCaches(Map<String, Object> configProps) {
final String METHODNAME = "initializeCaches(DataObject)";
/*
* initialize the cache pool names
*/
iAttrsCacheName = iReposId + "/" + iAttrsCacheName;
iSearchResultsCacheName = iReposId + "/" + iSearchResultsCacheName;
List<Map<String, Object>> cacheConfigs = Nester.nest(CACHE_CONFIG, configProps);
Map<String, Object> attrCacheConfig = null;
Map<String, Object> searchResultsCacheConfig = null;
if (!cacheConfigs.isEmpty()) {
Map<String, Object> cacheConfig = cacheConfigs.get(0);
Map<String, List<Map<String, Object>>> cacheInfo = Nester.nest(cacheConfig, ATTRIBUTES_CACHE_CONFIG, SEARCH_CACHE_CONFIG);
List<Map<String, Object>> attrList = cacheInfo.get(ATTRIBUTES_CACHE_CONFIG);
if (!attrList.isEmpty()) {
attrCacheConfig = attrList.get(0);
}
List<Map<String, Object>> searchList = cacheInfo.get(SEARCH_CACHE_CONFIG);
if (!searchList.isEmpty()) {
searchResultsCacheConfig = searchList.get(0);
}
if (attrCacheConfig != null) {
iAttrsCacheEnabled = (Boolean) attrCacheConfig.get(CONFIG_PROP_ENABLED);
if (iAttrsCacheEnabled) {
// Initialize the Attributes Cache size
iAttrsCacheSize = (Integer) attrCacheConfig.get(CONFIG_PROP_CACHE_SIZE);
iAttrsCacheTimeOut = (Long) attrCacheConfig.get(CONFIG_PROP_CACHE_TIME_OUT);
iAttrsSizeLmit = (Integer) attrCacheConfig.get(CONFIG_PROP_ATTRIBUTE_SIZE_LIMIT);
/*
* TODO:: Cache Distribution is not yet needed.
* String cacheDistPolicy = attrCacheConfig.getString(CONFIG_PROP_CACHE_DIST_POLICY);
* if (cacheDistPolicy != null) {
* iAttrsCacheDistPolicy = LdapHelper.getCacheDistPolicyInt(cacheDistPolicy);
* }
*/
}
}
if (searchResultsCacheConfig != null) {
iSearchResultsCacheEnabled = (Boolean) searchResultsCacheConfig.get(CONFIG_PROP_ENABLED);
if (iSearchResultsCacheEnabled) {
// Initialize the Search Results Cache size
iSearchResultsCacheSize = (Integer) searchResultsCacheConfig.get(CONFIG_PROP_CACHE_SIZE);
iSearchResultsCacheTimeOut = (Long) searchResultsCacheConfig.get(CONFIG_PROP_CACHE_TIME_OUT);
iSearchResultSizeLmit = (Integer) searchResultsCacheConfig.get(CONFIG_PROP_SEARCH_RESULTS_SIZE_LIMIT);
/*
* TODO:: Cache Distribution is not yet needed.
* String cacheDistPolicy = searchResultsCacheConfig.getProperties().get(ConfigConstants.CONFIG_PROP_CACHE_DIST_POLICY);
* if (cacheDistPolicy != null) {
* iSearchResultsCacheDistPolicy = LdapHelper.getCacheDistPolicyInt(cacheDistPolicy);
* }
*/
}
}
}
if (iAttrsCacheEnabled) {
createAttributesCache();
if (iAttrsCache == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Attributes Cache: " + iAttrsCacheName + " is not available because cache is not available yet.");
}
}
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Attributes Cache: " + iAttrsCacheName + " is disabled.");
}
}
if (iSearchResultsCacheEnabled) {
createSearchResultsCache();
if (iSearchResultsCache == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Search Results Cache: " + iSearchResultsCacheName + " is not available because cache is not available yet.");
}
}
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Search Results Cache: " + iSearchResultsCacheName + " is disabled.");
}
}
} | [
"private",
"void",
"initializeCaches",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"configProps",
")",
"{",
"final",
"String",
"METHODNAME",
"=",
"\"initializeCaches(DataObject)\"",
";",
"/*\n * initialize the cache pool names\n */",
"iAttrsCacheName",
"=",
"iReposId",
"+",
"\"/\"",
"+",
"iAttrsCacheName",
";",
"iSearchResultsCacheName",
"=",
"iReposId",
"+",
"\"/\"",
"+",
"iSearchResultsCacheName",
";",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"cacheConfigs",
"=",
"Nester",
".",
"nest",
"(",
"CACHE_CONFIG",
",",
"configProps",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"attrCacheConfig",
"=",
"null",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"searchResultsCacheConfig",
"=",
"null",
";",
"if",
"(",
"!",
"cacheConfigs",
".",
"isEmpty",
"(",
")",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"cacheConfig",
"=",
"cacheConfigs",
".",
"get",
"(",
"0",
")",
";",
"Map",
"<",
"String",
",",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
">",
"cacheInfo",
"=",
"Nester",
".",
"nest",
"(",
"cacheConfig",
",",
"ATTRIBUTES_CACHE_CONFIG",
",",
"SEARCH_CACHE_CONFIG",
")",
";",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"attrList",
"=",
"cacheInfo",
".",
"get",
"(",
"ATTRIBUTES_CACHE_CONFIG",
")",
";",
"if",
"(",
"!",
"attrList",
".",
"isEmpty",
"(",
")",
")",
"{",
"attrCacheConfig",
"=",
"attrList",
".",
"get",
"(",
"0",
")",
";",
"}",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"searchList",
"=",
"cacheInfo",
".",
"get",
"(",
"SEARCH_CACHE_CONFIG",
")",
";",
"if",
"(",
"!",
"searchList",
".",
"isEmpty",
"(",
")",
")",
"{",
"searchResultsCacheConfig",
"=",
"searchList",
".",
"get",
"(",
"0",
")",
";",
"}",
"if",
"(",
"attrCacheConfig",
"!=",
"null",
")",
"{",
"iAttrsCacheEnabled",
"=",
"(",
"Boolean",
")",
"attrCacheConfig",
".",
"get",
"(",
"CONFIG_PROP_ENABLED",
")",
";",
"if",
"(",
"iAttrsCacheEnabled",
")",
"{",
"// Initialize the Attributes Cache size",
"iAttrsCacheSize",
"=",
"(",
"Integer",
")",
"attrCacheConfig",
".",
"get",
"(",
"CONFIG_PROP_CACHE_SIZE",
")",
";",
"iAttrsCacheTimeOut",
"=",
"(",
"Long",
")",
"attrCacheConfig",
".",
"get",
"(",
"CONFIG_PROP_CACHE_TIME_OUT",
")",
";",
"iAttrsSizeLmit",
"=",
"(",
"Integer",
")",
"attrCacheConfig",
".",
"get",
"(",
"CONFIG_PROP_ATTRIBUTE_SIZE_LIMIT",
")",
";",
"/*\n * TODO:: Cache Distribution is not yet needed.\n * String cacheDistPolicy = attrCacheConfig.getString(CONFIG_PROP_CACHE_DIST_POLICY);\n * if (cacheDistPolicy != null) {\n * iAttrsCacheDistPolicy = LdapHelper.getCacheDistPolicyInt(cacheDistPolicy);\n * }\n */",
"}",
"}",
"if",
"(",
"searchResultsCacheConfig",
"!=",
"null",
")",
"{",
"iSearchResultsCacheEnabled",
"=",
"(",
"Boolean",
")",
"searchResultsCacheConfig",
".",
"get",
"(",
"CONFIG_PROP_ENABLED",
")",
";",
"if",
"(",
"iSearchResultsCacheEnabled",
")",
"{",
"// Initialize the Search Results Cache size",
"iSearchResultsCacheSize",
"=",
"(",
"Integer",
")",
"searchResultsCacheConfig",
".",
"get",
"(",
"CONFIG_PROP_CACHE_SIZE",
")",
";",
"iSearchResultsCacheTimeOut",
"=",
"(",
"Long",
")",
"searchResultsCacheConfig",
".",
"get",
"(",
"CONFIG_PROP_CACHE_TIME_OUT",
")",
";",
"iSearchResultSizeLmit",
"=",
"(",
"Integer",
")",
"searchResultsCacheConfig",
".",
"get",
"(",
"CONFIG_PROP_SEARCH_RESULTS_SIZE_LIMIT",
")",
";",
"/*\n * TODO:: Cache Distribution is not yet needed.\n * String cacheDistPolicy = searchResultsCacheConfig.getProperties().get(ConfigConstants.CONFIG_PROP_CACHE_DIST_POLICY);\n * if (cacheDistPolicy != null) {\n * iSearchResultsCacheDistPolicy = LdapHelper.getCacheDistPolicyInt(cacheDistPolicy);\n * }\n */",
"}",
"}",
"}",
"if",
"(",
"iAttrsCacheEnabled",
")",
"{",
"createAttributesCache",
"(",
")",
";",
"if",
"(",
"iAttrsCache",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" Attributes Cache: \"",
"+",
"iAttrsCacheName",
"+",
"\" is not available because cache is not available yet.\"",
")",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" Attributes Cache: \"",
"+",
"iAttrsCacheName",
"+",
"\" is disabled.\"",
")",
";",
"}",
"}",
"if",
"(",
"iSearchResultsCacheEnabled",
")",
"{",
"createSearchResultsCache",
"(",
")",
";",
"if",
"(",
"iSearchResultsCache",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" Search Results Cache: \"",
"+",
"iSearchResultsCacheName",
"+",
"\" is not available because cache is not available yet.\"",
")",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" Search Results Cache: \"",
"+",
"iSearchResultsCacheName",
"+",
"\" is disabled.\"",
")",
";",
"}",
"}",
"}"
] | Initialize search and attribute caches.
@param configProps Configuration properties for the component. | [
"Initialize",
"search",
"and",
"attribute",
"caches",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L517-L602 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.createSearchResultsCache | private void createSearchResultsCache() {
final String METHODNAME = "createSearchResultsCache";
if (iSearchResultsCacheEnabled) {
if (FactoryManager.getCacheUtil().isCacheAvailable()) {
iSearchResultsCache = FactoryManager.getCacheUtil().initialize("SearchResultsCache", iSearchResultsCacheSize, iSearchResultsCacheSize, iSearchResultsCacheTimeOut);
if (iSearchResultsCache != null) {
if (tc.isDebugEnabled()) {
StringBuilder strBuf = new StringBuilder(METHODNAME);
strBuf.append(" \nSearch Results Cache: ").append(iSearchResultsCacheName).append(" is enabled:\n");
strBuf.append("\tCacheSize: ").append(iSearchResultsCacheSize).append("\n");
strBuf.append("\tCacheTimeOut: ").append(iSearchResultsCacheTimeOut).append("\n");
strBuf.append("\tCacheResultSizeLimit: ").append(iSearchResultSizeLmit).append("\n");
Tr.debug(tc, strBuf.toString());
}
}
}
}
} | java | private void createSearchResultsCache() {
final String METHODNAME = "createSearchResultsCache";
if (iSearchResultsCacheEnabled) {
if (FactoryManager.getCacheUtil().isCacheAvailable()) {
iSearchResultsCache = FactoryManager.getCacheUtil().initialize("SearchResultsCache", iSearchResultsCacheSize, iSearchResultsCacheSize, iSearchResultsCacheTimeOut);
if (iSearchResultsCache != null) {
if (tc.isDebugEnabled()) {
StringBuilder strBuf = new StringBuilder(METHODNAME);
strBuf.append(" \nSearch Results Cache: ").append(iSearchResultsCacheName).append(" is enabled:\n");
strBuf.append("\tCacheSize: ").append(iSearchResultsCacheSize).append("\n");
strBuf.append("\tCacheTimeOut: ").append(iSearchResultsCacheTimeOut).append("\n");
strBuf.append("\tCacheResultSizeLimit: ").append(iSearchResultSizeLmit).append("\n");
Tr.debug(tc, strBuf.toString());
}
}
}
}
} | [
"private",
"void",
"createSearchResultsCache",
"(",
")",
"{",
"final",
"String",
"METHODNAME",
"=",
"\"createSearchResultsCache\"",
";",
"if",
"(",
"iSearchResultsCacheEnabled",
")",
"{",
"if",
"(",
"FactoryManager",
".",
"getCacheUtil",
"(",
")",
".",
"isCacheAvailable",
"(",
")",
")",
"{",
"iSearchResultsCache",
"=",
"FactoryManager",
".",
"getCacheUtil",
"(",
")",
".",
"initialize",
"(",
"\"SearchResultsCache\"",
",",
"iSearchResultsCacheSize",
",",
"iSearchResultsCacheSize",
",",
"iSearchResultsCacheTimeOut",
")",
";",
"if",
"(",
"iSearchResultsCache",
"!=",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"StringBuilder",
"strBuf",
"=",
"new",
"StringBuilder",
"(",
"METHODNAME",
")",
";",
"strBuf",
".",
"append",
"(",
"\" \\nSearch Results Cache: \"",
")",
".",
"append",
"(",
"iSearchResultsCacheName",
")",
".",
"append",
"(",
"\" is enabled:\\n\"",
")",
";",
"strBuf",
".",
"append",
"(",
"\"\\tCacheSize: \"",
")",
".",
"append",
"(",
"iSearchResultsCacheSize",
")",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"strBuf",
".",
"append",
"(",
"\"\\tCacheTimeOut: \"",
")",
".",
"append",
"(",
"iSearchResultsCacheTimeOut",
")",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"strBuf",
".",
"append",
"(",
"\"\\tCacheResultSizeLimit: \"",
")",
".",
"append",
"(",
"iSearchResultSizeLmit",
")",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"strBuf",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | Method to create the search results cache, if configured. | [
"Method",
"to",
"create",
"the",
"search",
"results",
"cache",
"if",
"configured",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L607-L625 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.createAttributesCache | private void createAttributesCache() {
final String METHODNAME = "createAttributesCache";
if (iAttrsCacheEnabled) {
if (FactoryManager.getCacheUtil().isCacheAvailable()) {
iAttrsCache = FactoryManager.getCacheUtil().initialize("AttributesCache", iAttrsCacheSize, iAttrsCacheSize, iAttrsCacheTimeOut);
if (iAttrsCache != null) {
if (tc.isDebugEnabled()) {
StringBuilder strBuf = new StringBuilder(METHODNAME);
strBuf.append(" \nAttributes Cache: ").append(iAttrsCacheName).append(" is enabled:\n");
strBuf.append("\tCacheSize: ").append(iAttrsCacheSize).append("\n");
strBuf.append("\tCacheTimeOut: ").append(iAttrsCacheTimeOut).append("\n");
strBuf.append("\tCacheSizeLimit: ").append(iAttrsSizeLmit).append("\n");
Tr.debug(tc, strBuf.toString());
}
}
}
}
} | java | private void createAttributesCache() {
final String METHODNAME = "createAttributesCache";
if (iAttrsCacheEnabled) {
if (FactoryManager.getCacheUtil().isCacheAvailable()) {
iAttrsCache = FactoryManager.getCacheUtil().initialize("AttributesCache", iAttrsCacheSize, iAttrsCacheSize, iAttrsCacheTimeOut);
if (iAttrsCache != null) {
if (tc.isDebugEnabled()) {
StringBuilder strBuf = new StringBuilder(METHODNAME);
strBuf.append(" \nAttributes Cache: ").append(iAttrsCacheName).append(" is enabled:\n");
strBuf.append("\tCacheSize: ").append(iAttrsCacheSize).append("\n");
strBuf.append("\tCacheTimeOut: ").append(iAttrsCacheTimeOut).append("\n");
strBuf.append("\tCacheSizeLimit: ").append(iAttrsSizeLmit).append("\n");
Tr.debug(tc, strBuf.toString());
}
}
}
}
} | [
"private",
"void",
"createAttributesCache",
"(",
")",
"{",
"final",
"String",
"METHODNAME",
"=",
"\"createAttributesCache\"",
";",
"if",
"(",
"iAttrsCacheEnabled",
")",
"{",
"if",
"(",
"FactoryManager",
".",
"getCacheUtil",
"(",
")",
".",
"isCacheAvailable",
"(",
")",
")",
"{",
"iAttrsCache",
"=",
"FactoryManager",
".",
"getCacheUtil",
"(",
")",
".",
"initialize",
"(",
"\"AttributesCache\"",
",",
"iAttrsCacheSize",
",",
"iAttrsCacheSize",
",",
"iAttrsCacheTimeOut",
")",
";",
"if",
"(",
"iAttrsCache",
"!=",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"StringBuilder",
"strBuf",
"=",
"new",
"StringBuilder",
"(",
"METHODNAME",
")",
";",
"strBuf",
".",
"append",
"(",
"\" \\nAttributes Cache: \"",
")",
".",
"append",
"(",
"iAttrsCacheName",
")",
".",
"append",
"(",
"\" is enabled:\\n\"",
")",
";",
"strBuf",
".",
"append",
"(",
"\"\\tCacheSize: \"",
")",
".",
"append",
"(",
"iAttrsCacheSize",
")",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"strBuf",
".",
"append",
"(",
"\"\\tCacheTimeOut: \"",
")",
".",
"append",
"(",
"iAttrsCacheTimeOut",
")",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"strBuf",
".",
"append",
"(",
"\"\\tCacheSizeLimit: \"",
")",
".",
"append",
"(",
"iAttrsSizeLmit",
")",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"strBuf",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | Method to create the attributes cache, if configured. | [
"Method",
"to",
"create",
"the",
"attributes",
"cache",
"if",
"configured",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L630-L648 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.invalidateAttributes | public void invalidateAttributes(String DN, String extId, String uniqueName) {
final String METHODNAME = "invalidateAttributes(String, String, String)";
if (getAttributesCache() != null) {
if (DN != null) {
getAttributesCache().invalidate(toKey(DN));
}
if (extId != null) {
getAttributesCache().invalidate(extId);
}
if (uniqueName != null) {
getAttributesCache().invalidate(toKey(uniqueName));
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " " + iAttrsCacheName + " size: " + getAttributesCache().size());
}
}
} | java | public void invalidateAttributes(String DN, String extId, String uniqueName) {
final String METHODNAME = "invalidateAttributes(String, String, String)";
if (getAttributesCache() != null) {
if (DN != null) {
getAttributesCache().invalidate(toKey(DN));
}
if (extId != null) {
getAttributesCache().invalidate(extId);
}
if (uniqueName != null) {
getAttributesCache().invalidate(toKey(uniqueName));
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " " + iAttrsCacheName + " size: " + getAttributesCache().size());
}
}
} | [
"public",
"void",
"invalidateAttributes",
"(",
"String",
"DN",
",",
"String",
"extId",
",",
"String",
"uniqueName",
")",
"{",
"final",
"String",
"METHODNAME",
"=",
"\"invalidateAttributes(String, String, String)\"",
";",
"if",
"(",
"getAttributesCache",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"DN",
"!=",
"null",
")",
"{",
"getAttributesCache",
"(",
")",
".",
"invalidate",
"(",
"toKey",
"(",
"DN",
")",
")",
";",
"}",
"if",
"(",
"extId",
"!=",
"null",
")",
"{",
"getAttributesCache",
"(",
")",
".",
"invalidate",
"(",
"extId",
")",
";",
"}",
"if",
"(",
"uniqueName",
"!=",
"null",
")",
"{",
"getAttributesCache",
"(",
")",
".",
"invalidate",
"(",
"toKey",
"(",
"uniqueName",
")",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" \"",
"+",
"iAttrsCacheName",
"+",
"\" size: \"",
"+",
"getAttributesCache",
"(",
")",
".",
"size",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Method to invalidate the specified entry from the attributes cache. One or all
parameters can be set in a single call. If all parameters are null, then this
operation no-ops.
@param DN The distinguished name of the entity to invalidate attributes on.
@param extId The external ID of the entity to invalidate attributes on.
@param uniqueName The unique name of the entity to invalidate attributes on. | [
"Method",
"to",
"invalidate",
"the",
"specified",
"entry",
"from",
"the",
"attributes",
"cache",
".",
"One",
"or",
"all",
"parameters",
"can",
"be",
"set",
"in",
"a",
"single",
"call",
".",
"If",
"all",
"parameters",
"are",
"null",
"then",
"this",
"operation",
"no",
"-",
"ops",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L683-L703 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.getEntityByIdentifier | public LdapEntry getEntityByIdentifier(IdentifierType id, List<String> inEntityTypes, List<String> propNames, boolean getMbrshipAttr,
boolean getMbrAttr) throws WIMException {
return getEntityByIdentifier(id.getExternalName(), id.getExternalId(), id.getUniqueName(),
inEntityTypes, propNames, getMbrshipAttr, getMbrAttr);
} | java | public LdapEntry getEntityByIdentifier(IdentifierType id, List<String> inEntityTypes, List<String> propNames, boolean getMbrshipAttr,
boolean getMbrAttr) throws WIMException {
return getEntityByIdentifier(id.getExternalName(), id.getExternalId(), id.getUniqueName(),
inEntityTypes, propNames, getMbrshipAttr, getMbrAttr);
} | [
"public",
"LdapEntry",
"getEntityByIdentifier",
"(",
"IdentifierType",
"id",
",",
"List",
"<",
"String",
">",
"inEntityTypes",
",",
"List",
"<",
"String",
">",
"propNames",
",",
"boolean",
"getMbrshipAttr",
",",
"boolean",
"getMbrAttr",
")",
"throws",
"WIMException",
"{",
"return",
"getEntityByIdentifier",
"(",
"id",
".",
"getExternalName",
"(",
")",
",",
"id",
".",
"getExternalId",
"(",
")",
",",
"id",
".",
"getUniqueName",
"(",
")",
",",
"inEntityTypes",
",",
"propNames",
",",
"getMbrshipAttr",
",",
"getMbrAttr",
")",
";",
"}"
] | Get an LDAP entity by an identifier.
@param id An {@link IdentifierType} entity.
@param inEntityTypes The acceptable entity types to look up.
@param propNames The property names to return in the LdapEntry.
@param getMbrshipAttr Whether to return the membership attribute.
@param getMbrAttr Whether to return the member attribute.
@return The {@link LdapEntry} corresponding to the identifier.
@throws WIMException If there was an error retrieving the LDAP entity. | [
"Get",
"an",
"LDAP",
"entity",
"by",
"an",
"identifier",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L759-L763 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.getEntityByIdentifier | public LdapEntry getEntityByIdentifier(String dn, String extId, String uniqueName, List<String> inEntityTypes,
List<String> propNames, boolean getMbrshipAttr, boolean getMbrAttr) throws WIMException {
String[] attrIds = iLdapConfigMgr.getAttributeNames(inEntityTypes, propNames, getMbrshipAttr, getMbrAttr);
Attributes attrs = null;
if (dn == null && !iLdapConfigMgr.needTranslateRDN()) {
dn = iLdapConfigMgr.switchToLdapNode(uniqueName);
}
// Changed the order of the if-else ladder. Please check against tWAS code for the original order
if (dn != null) {
attrs = checkAttributesCache(dn, attrIds);
} else if (extId != null) {
if (iLdapConfigMgr.isAnyExtIdDN()) {
dn = LdapHelper.getValidDN(extId);
if (dn != null) {
attrs = checkAttributesCache(dn, attrIds);
} else if (uniqueName != null) {
attrs = getAttributesByUniqueName(uniqueName, attrIds, inEntityTypes);
dn = LdapHelper.getDNFromAttributes(attrs);
} else {
String msg = Tr.formatMessage(tc, WIMMessageKey.ENTITY_NOT_FOUND, WIMMessageHelper.generateMsgParms(null));
throw new EntityNotFoundException(WIMMessageKey.ENTITY_NOT_FOUND, msg);
}
} else {
attrs = getAttributesByUniqueName(extId, attrIds, inEntityTypes);
dn = LdapHelper.getDNFromAttributes(attrs);
}
} else if (uniqueName != null) {
attrs = getAttributesByUniqueName(uniqueName, attrIds, inEntityTypes);
dn = LdapHelper.getDNFromAttributes(attrs);
} else {
String msg = Tr.formatMessage(tc, WIMMessageKey.ENTITY_NOT_FOUND, WIMMessageHelper.generateMsgParms(null));
throw new EntityNotFoundException(WIMMessageKey.ENTITY_NOT_FOUND, msg);
}
String entityType = iLdapConfigMgr.getEntityType(attrs, uniqueName, dn, extId, inEntityTypes);
uniqueName = getUniqueName(dn, entityType, attrs);
if (extId == null) {
extId = iLdapConfigMgr.getExtIdFromAttributes(dn, entityType, attrs);
}
LdapEntry ldapEntry = new LdapEntry(dn, extId, uniqueName, entityType, attrs);
return ldapEntry;
} | java | public LdapEntry getEntityByIdentifier(String dn, String extId, String uniqueName, List<String> inEntityTypes,
List<String> propNames, boolean getMbrshipAttr, boolean getMbrAttr) throws WIMException {
String[] attrIds = iLdapConfigMgr.getAttributeNames(inEntityTypes, propNames, getMbrshipAttr, getMbrAttr);
Attributes attrs = null;
if (dn == null && !iLdapConfigMgr.needTranslateRDN()) {
dn = iLdapConfigMgr.switchToLdapNode(uniqueName);
}
// Changed the order of the if-else ladder. Please check against tWAS code for the original order
if (dn != null) {
attrs = checkAttributesCache(dn, attrIds);
} else if (extId != null) {
if (iLdapConfigMgr.isAnyExtIdDN()) {
dn = LdapHelper.getValidDN(extId);
if (dn != null) {
attrs = checkAttributesCache(dn, attrIds);
} else if (uniqueName != null) {
attrs = getAttributesByUniqueName(uniqueName, attrIds, inEntityTypes);
dn = LdapHelper.getDNFromAttributes(attrs);
} else {
String msg = Tr.formatMessage(tc, WIMMessageKey.ENTITY_NOT_FOUND, WIMMessageHelper.generateMsgParms(null));
throw new EntityNotFoundException(WIMMessageKey.ENTITY_NOT_FOUND, msg);
}
} else {
attrs = getAttributesByUniqueName(extId, attrIds, inEntityTypes);
dn = LdapHelper.getDNFromAttributes(attrs);
}
} else if (uniqueName != null) {
attrs = getAttributesByUniqueName(uniqueName, attrIds, inEntityTypes);
dn = LdapHelper.getDNFromAttributes(attrs);
} else {
String msg = Tr.formatMessage(tc, WIMMessageKey.ENTITY_NOT_FOUND, WIMMessageHelper.generateMsgParms(null));
throw new EntityNotFoundException(WIMMessageKey.ENTITY_NOT_FOUND, msg);
}
String entityType = iLdapConfigMgr.getEntityType(attrs, uniqueName, dn, extId, inEntityTypes);
uniqueName = getUniqueName(dn, entityType, attrs);
if (extId == null) {
extId = iLdapConfigMgr.getExtIdFromAttributes(dn, entityType, attrs);
}
LdapEntry ldapEntry = new LdapEntry(dn, extId, uniqueName, entityType, attrs);
return ldapEntry;
} | [
"public",
"LdapEntry",
"getEntityByIdentifier",
"(",
"String",
"dn",
",",
"String",
"extId",
",",
"String",
"uniqueName",
",",
"List",
"<",
"String",
">",
"inEntityTypes",
",",
"List",
"<",
"String",
">",
"propNames",
",",
"boolean",
"getMbrshipAttr",
",",
"boolean",
"getMbrAttr",
")",
"throws",
"WIMException",
"{",
"String",
"[",
"]",
"attrIds",
"=",
"iLdapConfigMgr",
".",
"getAttributeNames",
"(",
"inEntityTypes",
",",
"propNames",
",",
"getMbrshipAttr",
",",
"getMbrAttr",
")",
";",
"Attributes",
"attrs",
"=",
"null",
";",
"if",
"(",
"dn",
"==",
"null",
"&&",
"!",
"iLdapConfigMgr",
".",
"needTranslateRDN",
"(",
")",
")",
"{",
"dn",
"=",
"iLdapConfigMgr",
".",
"switchToLdapNode",
"(",
"uniqueName",
")",
";",
"}",
"// Changed the order of the if-else ladder. Please check against tWAS code for the original order",
"if",
"(",
"dn",
"!=",
"null",
")",
"{",
"attrs",
"=",
"checkAttributesCache",
"(",
"dn",
",",
"attrIds",
")",
";",
"}",
"else",
"if",
"(",
"extId",
"!=",
"null",
")",
"{",
"if",
"(",
"iLdapConfigMgr",
".",
"isAnyExtIdDN",
"(",
")",
")",
"{",
"dn",
"=",
"LdapHelper",
".",
"getValidDN",
"(",
"extId",
")",
";",
"if",
"(",
"dn",
"!=",
"null",
")",
"{",
"attrs",
"=",
"checkAttributesCache",
"(",
"dn",
",",
"attrIds",
")",
";",
"}",
"else",
"if",
"(",
"uniqueName",
"!=",
"null",
")",
"{",
"attrs",
"=",
"getAttributesByUniqueName",
"(",
"uniqueName",
",",
"attrIds",
",",
"inEntityTypes",
")",
";",
"dn",
"=",
"LdapHelper",
".",
"getDNFromAttributes",
"(",
"attrs",
")",
";",
"}",
"else",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"WIMMessageKey",
".",
"ENTITY_NOT_FOUND",
",",
"WIMMessageHelper",
".",
"generateMsgParms",
"(",
"null",
")",
")",
";",
"throw",
"new",
"EntityNotFoundException",
"(",
"WIMMessageKey",
".",
"ENTITY_NOT_FOUND",
",",
"msg",
")",
";",
"}",
"}",
"else",
"{",
"attrs",
"=",
"getAttributesByUniqueName",
"(",
"extId",
",",
"attrIds",
",",
"inEntityTypes",
")",
";",
"dn",
"=",
"LdapHelper",
".",
"getDNFromAttributes",
"(",
"attrs",
")",
";",
"}",
"}",
"else",
"if",
"(",
"uniqueName",
"!=",
"null",
")",
"{",
"attrs",
"=",
"getAttributesByUniqueName",
"(",
"uniqueName",
",",
"attrIds",
",",
"inEntityTypes",
")",
";",
"dn",
"=",
"LdapHelper",
".",
"getDNFromAttributes",
"(",
"attrs",
")",
";",
"}",
"else",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"WIMMessageKey",
".",
"ENTITY_NOT_FOUND",
",",
"WIMMessageHelper",
".",
"generateMsgParms",
"(",
"null",
")",
")",
";",
"throw",
"new",
"EntityNotFoundException",
"(",
"WIMMessageKey",
".",
"ENTITY_NOT_FOUND",
",",
"msg",
")",
";",
"}",
"String",
"entityType",
"=",
"iLdapConfigMgr",
".",
"getEntityType",
"(",
"attrs",
",",
"uniqueName",
",",
"dn",
",",
"extId",
",",
"inEntityTypes",
")",
";",
"uniqueName",
"=",
"getUniqueName",
"(",
"dn",
",",
"entityType",
",",
"attrs",
")",
";",
"if",
"(",
"extId",
"==",
"null",
")",
"{",
"extId",
"=",
"iLdapConfigMgr",
".",
"getExtIdFromAttributes",
"(",
"dn",
",",
"entityType",
",",
"attrs",
")",
";",
"}",
"LdapEntry",
"ldapEntry",
"=",
"new",
"LdapEntry",
"(",
"dn",
",",
"extId",
",",
"uniqueName",
",",
"entityType",
",",
"attrs",
")",
";",
"return",
"ldapEntry",
";",
"}"
] | Get an LDAP entity by an identifier. One of 'dn', 'extId' or 'uniqueName' must be non-null.
@param dn The distinguished name for the entity.
@param extId The external name for the entity.
@param uniqueName The unique name for the entity.
@param inEntityTypes The acceptable entity types to look up.
@param propNames The property names to return in the LdapEntry.
@param getMbrshipAttr Whether to return the membership attribute.
@param getMbrAttr Whether to return the member attribute.
@return The {@link LdapEntry} corresponding to the identifier.
@throws WIMException If there was an error retrieving the LDAP entity. | [
"Get",
"an",
"LDAP",
"entity",
"by",
"an",
"identifier",
".",
"One",
"of",
"dn",
"extId",
"or",
"uniqueName",
"must",
"be",
"non",
"-",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L778-L820 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.getUniqueName | private String getUniqueName(String dn, String entityType, Attributes attrs) throws WIMException {
final String METHODNAME = "getUniqueName";
String uniqueName = null;
dn = iLdapConfigMgr.switchToNode(dn);
if (iLdapConfigMgr.needTranslateRDN() && iLdapConfigMgr.needTranslateRDN(entityType)) {
try {
if (entityType != null) {
LdapEntity ldapEntity = iLdapConfigMgr.getLdapEntity(entityType);
if (ldapEntity != null) {
String[] rdnName = LdapHelper.getRDNAttributes(dn);
String[][] rdnWIMProps = ldapEntity.getWIMRDNProperties();
String[][] rdnWIMAttrs = ldapEntity.getWIMRDNAttributes();
String[][] rdnAttrs = ldapEntity.getRDNAttributes();
Attribute[] rdnAttributes = new Attribute[rdnWIMProps.length];
String[] rdnAttrValues = new String[rdnWIMProps.length];
for (int i = 0; i < rdnAttrs.length; i++) {
String[] rdnAttr = rdnAttrs[i];
boolean isRDN = true;
for (int j = 0; j < rdnAttr.length; j++) {
if (!rdnAttr[j].equalsIgnoreCase(rdnName[j])) {
isRDN = false;
}
}
if (isRDN) {
String[] rdnWIMProp = rdnWIMProps[i];
String[] rdnWIMAttr = rdnWIMAttrs[i];
boolean retrieveRDNs = false;
if (attrs == null) {
retrieveRDNs = true;
} else {
for (int k = 0; k < rdnWIMAttr.length; k++) {
if (attrs.get(rdnWIMAttr[k]) == null) {
retrieveRDNs = true;
break;
}
}
}
if (retrieveRDNs) {
attrs = getAttributes(dn, rdnWIMAttr);
}
for (int k = 0; k < rdnWIMAttr.length; k++) {
rdnAttributes[k] = attrs.get(rdnWIMAttr[k]);
if (rdnAttributes[k] != null) {
rdnAttrValues[k] = (String) rdnAttributes[k].get();
}
}
uniqueName = LdapHelper.replaceRDN(dn, rdnWIMProp, rdnAttrValues);
}
}
}
}
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
}
}
if (uniqueName == null) {
uniqueName = dn;
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Translated uniqueName: " + uniqueName);
}
}
return uniqueName;
} | java | private String getUniqueName(String dn, String entityType, Attributes attrs) throws WIMException {
final String METHODNAME = "getUniqueName";
String uniqueName = null;
dn = iLdapConfigMgr.switchToNode(dn);
if (iLdapConfigMgr.needTranslateRDN() && iLdapConfigMgr.needTranslateRDN(entityType)) {
try {
if (entityType != null) {
LdapEntity ldapEntity = iLdapConfigMgr.getLdapEntity(entityType);
if (ldapEntity != null) {
String[] rdnName = LdapHelper.getRDNAttributes(dn);
String[][] rdnWIMProps = ldapEntity.getWIMRDNProperties();
String[][] rdnWIMAttrs = ldapEntity.getWIMRDNAttributes();
String[][] rdnAttrs = ldapEntity.getRDNAttributes();
Attribute[] rdnAttributes = new Attribute[rdnWIMProps.length];
String[] rdnAttrValues = new String[rdnWIMProps.length];
for (int i = 0; i < rdnAttrs.length; i++) {
String[] rdnAttr = rdnAttrs[i];
boolean isRDN = true;
for (int j = 0; j < rdnAttr.length; j++) {
if (!rdnAttr[j].equalsIgnoreCase(rdnName[j])) {
isRDN = false;
}
}
if (isRDN) {
String[] rdnWIMProp = rdnWIMProps[i];
String[] rdnWIMAttr = rdnWIMAttrs[i];
boolean retrieveRDNs = false;
if (attrs == null) {
retrieveRDNs = true;
} else {
for (int k = 0; k < rdnWIMAttr.length; k++) {
if (attrs.get(rdnWIMAttr[k]) == null) {
retrieveRDNs = true;
break;
}
}
}
if (retrieveRDNs) {
attrs = getAttributes(dn, rdnWIMAttr);
}
for (int k = 0; k < rdnWIMAttr.length; k++) {
rdnAttributes[k] = attrs.get(rdnWIMAttr[k]);
if (rdnAttributes[k] != null) {
rdnAttrValues[k] = (String) rdnAttributes[k].get();
}
}
uniqueName = LdapHelper.replaceRDN(dn, rdnWIMProp, rdnAttrValues);
}
}
}
}
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
}
}
if (uniqueName == null) {
uniqueName = dn;
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Translated uniqueName: " + uniqueName);
}
}
return uniqueName;
} | [
"private",
"String",
"getUniqueName",
"(",
"String",
"dn",
",",
"String",
"entityType",
",",
"Attributes",
"attrs",
")",
"throws",
"WIMException",
"{",
"final",
"String",
"METHODNAME",
"=",
"\"getUniqueName\"",
";",
"String",
"uniqueName",
"=",
"null",
";",
"dn",
"=",
"iLdapConfigMgr",
".",
"switchToNode",
"(",
"dn",
")",
";",
"if",
"(",
"iLdapConfigMgr",
".",
"needTranslateRDN",
"(",
")",
"&&",
"iLdapConfigMgr",
".",
"needTranslateRDN",
"(",
"entityType",
")",
")",
"{",
"try",
"{",
"if",
"(",
"entityType",
"!=",
"null",
")",
"{",
"LdapEntity",
"ldapEntity",
"=",
"iLdapConfigMgr",
".",
"getLdapEntity",
"(",
"entityType",
")",
";",
"if",
"(",
"ldapEntity",
"!=",
"null",
")",
"{",
"String",
"[",
"]",
"rdnName",
"=",
"LdapHelper",
".",
"getRDNAttributes",
"(",
"dn",
")",
";",
"String",
"[",
"]",
"[",
"]",
"rdnWIMProps",
"=",
"ldapEntity",
".",
"getWIMRDNProperties",
"(",
")",
";",
"String",
"[",
"]",
"[",
"]",
"rdnWIMAttrs",
"=",
"ldapEntity",
".",
"getWIMRDNAttributes",
"(",
")",
";",
"String",
"[",
"]",
"[",
"]",
"rdnAttrs",
"=",
"ldapEntity",
".",
"getRDNAttributes",
"(",
")",
";",
"Attribute",
"[",
"]",
"rdnAttributes",
"=",
"new",
"Attribute",
"[",
"rdnWIMProps",
".",
"length",
"]",
";",
"String",
"[",
"]",
"rdnAttrValues",
"=",
"new",
"String",
"[",
"rdnWIMProps",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rdnAttrs",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"[",
"]",
"rdnAttr",
"=",
"rdnAttrs",
"[",
"i",
"]",
";",
"boolean",
"isRDN",
"=",
"true",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"rdnAttr",
".",
"length",
";",
"j",
"++",
")",
"{",
"if",
"(",
"!",
"rdnAttr",
"[",
"j",
"]",
".",
"equalsIgnoreCase",
"(",
"rdnName",
"[",
"j",
"]",
")",
")",
"{",
"isRDN",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"isRDN",
")",
"{",
"String",
"[",
"]",
"rdnWIMProp",
"=",
"rdnWIMProps",
"[",
"i",
"]",
";",
"String",
"[",
"]",
"rdnWIMAttr",
"=",
"rdnWIMAttrs",
"[",
"i",
"]",
";",
"boolean",
"retrieveRDNs",
"=",
"false",
";",
"if",
"(",
"attrs",
"==",
"null",
")",
"{",
"retrieveRDNs",
"=",
"true",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"rdnWIMAttr",
".",
"length",
";",
"k",
"++",
")",
"{",
"if",
"(",
"attrs",
".",
"get",
"(",
"rdnWIMAttr",
"[",
"k",
"]",
")",
"==",
"null",
")",
"{",
"retrieveRDNs",
"=",
"true",
";",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"retrieveRDNs",
")",
"{",
"attrs",
"=",
"getAttributes",
"(",
"dn",
",",
"rdnWIMAttr",
")",
";",
"}",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"rdnWIMAttr",
".",
"length",
";",
"k",
"++",
")",
"{",
"rdnAttributes",
"[",
"k",
"]",
"=",
"attrs",
".",
"get",
"(",
"rdnWIMAttr",
"[",
"k",
"]",
")",
";",
"if",
"(",
"rdnAttributes",
"[",
"k",
"]",
"!=",
"null",
")",
"{",
"rdnAttrValues",
"[",
"k",
"]",
"=",
"(",
"String",
")",
"rdnAttributes",
"[",
"k",
"]",
".",
"get",
"(",
")",
";",
"}",
"}",
"uniqueName",
"=",
"LdapHelper",
".",
"replaceRDN",
"(",
"dn",
",",
"rdnWIMProp",
",",
"rdnAttrValues",
")",
";",
"}",
"}",
"}",
"}",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"WIMMessageHelper",
".",
"generateMsgParms",
"(",
"e",
".",
"toString",
"(",
"true",
")",
")",
")",
";",
"throw",
"new",
"WIMSystemException",
"(",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"msg",
",",
"e",
")",
";",
"}",
"}",
"if",
"(",
"uniqueName",
"==",
"null",
")",
"{",
"uniqueName",
"=",
"dn",
";",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" Translated uniqueName: \"",
"+",
"uniqueName",
")",
";",
"}",
"}",
"return",
"uniqueName",
";",
"}"
] | Get the unique name for the specified distinguished name.
@param dn The distinguished name.
@param entityType The entity type for the distinguished name.
@param attrs The attributes for the entity.
@return The unique name.
@throws WIMException If there was an error retrieving portions of the unique name. | [
"Get",
"the",
"unique",
"name",
"for",
"the",
"specified",
"distinguished",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L831-L895 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.getAttributes | @FFDCIgnore({ NamingException.class, NameNotFoundException.class })
private Attributes getAttributes(String name, String[] attrIds) throws WIMException {
Attributes attributes = null;
if (iLdapConfigMgr.getUseEncodingInSearchExpression() != null)
name = LdapHelper.encodeAttribute(name, iLdapConfigMgr.getUseEncodingInSearchExpression());
if (iAttrRangeStep > 0) {
attributes = getRangeAttributes(name, attrIds);
} else {
TimedDirContext ctx = iContextManager.getDirContext();
try {
try {
if (attrIds.length > 0) {
attributes = ctx.getAttributes(new LdapName(name), attrIds);
} else {
attributes = new BasicAttributes();
}
} catch (NamingException e) {
if (!ContextManager.isConnectionException(e)) {
throw e;
}
ctx = iContextManager.reCreateDirContext(ctx, e.toString());
if (attrIds.length > 0) {
attributes = ctx.getAttributes(new LdapName(name), attrIds);
} else {
attributes = new BasicAttributes();
}
}
} catch (NameNotFoundException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.LDAP_ENTRY_NOT_FOUND, WIMMessageHelper.generateMsgParms(name, e.toString(true)));
throw new EntityNotFoundException(WIMMessageKey.LDAP_ENTRY_NOT_FOUND, msg, e);
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} finally {
iContextManager.releaseDirContext(ctx);
}
}
return attributes;
} | java | @FFDCIgnore({ NamingException.class, NameNotFoundException.class })
private Attributes getAttributes(String name, String[] attrIds) throws WIMException {
Attributes attributes = null;
if (iLdapConfigMgr.getUseEncodingInSearchExpression() != null)
name = LdapHelper.encodeAttribute(name, iLdapConfigMgr.getUseEncodingInSearchExpression());
if (iAttrRangeStep > 0) {
attributes = getRangeAttributes(name, attrIds);
} else {
TimedDirContext ctx = iContextManager.getDirContext();
try {
try {
if (attrIds.length > 0) {
attributes = ctx.getAttributes(new LdapName(name), attrIds);
} else {
attributes = new BasicAttributes();
}
} catch (NamingException e) {
if (!ContextManager.isConnectionException(e)) {
throw e;
}
ctx = iContextManager.reCreateDirContext(ctx, e.toString());
if (attrIds.length > 0) {
attributes = ctx.getAttributes(new LdapName(name), attrIds);
} else {
attributes = new BasicAttributes();
}
}
} catch (NameNotFoundException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.LDAP_ENTRY_NOT_FOUND, WIMMessageHelper.generateMsgParms(name, e.toString(true)));
throw new EntityNotFoundException(WIMMessageKey.LDAP_ENTRY_NOT_FOUND, msg, e);
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} finally {
iContextManager.releaseDirContext(ctx);
}
}
return attributes;
} | [
"@",
"FFDCIgnore",
"(",
"{",
"NamingException",
".",
"class",
",",
"NameNotFoundException",
".",
"class",
"}",
")",
"private",
"Attributes",
"getAttributes",
"(",
"String",
"name",
",",
"String",
"[",
"]",
"attrIds",
")",
"throws",
"WIMException",
"{",
"Attributes",
"attributes",
"=",
"null",
";",
"if",
"(",
"iLdapConfigMgr",
".",
"getUseEncodingInSearchExpression",
"(",
")",
"!=",
"null",
")",
"name",
"=",
"LdapHelper",
".",
"encodeAttribute",
"(",
"name",
",",
"iLdapConfigMgr",
".",
"getUseEncodingInSearchExpression",
"(",
")",
")",
";",
"if",
"(",
"iAttrRangeStep",
">",
"0",
")",
"{",
"attributes",
"=",
"getRangeAttributes",
"(",
"name",
",",
"attrIds",
")",
";",
"}",
"else",
"{",
"TimedDirContext",
"ctx",
"=",
"iContextManager",
".",
"getDirContext",
"(",
")",
";",
"try",
"{",
"try",
"{",
"if",
"(",
"attrIds",
".",
"length",
">",
"0",
")",
"{",
"attributes",
"=",
"ctx",
".",
"getAttributes",
"(",
"new",
"LdapName",
"(",
"name",
")",
",",
"attrIds",
")",
";",
"}",
"else",
"{",
"attributes",
"=",
"new",
"BasicAttributes",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"if",
"(",
"!",
"ContextManager",
".",
"isConnectionException",
"(",
"e",
")",
")",
"{",
"throw",
"e",
";",
"}",
"ctx",
"=",
"iContextManager",
".",
"reCreateDirContext",
"(",
"ctx",
",",
"e",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"attrIds",
".",
"length",
">",
"0",
")",
"{",
"attributes",
"=",
"ctx",
".",
"getAttributes",
"(",
"new",
"LdapName",
"(",
"name",
")",
",",
"attrIds",
")",
";",
"}",
"else",
"{",
"attributes",
"=",
"new",
"BasicAttributes",
"(",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"NameNotFoundException",
"e",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"WIMMessageKey",
".",
"LDAP_ENTRY_NOT_FOUND",
",",
"WIMMessageHelper",
".",
"generateMsgParms",
"(",
"name",
",",
"e",
".",
"toString",
"(",
"true",
")",
")",
")",
";",
"throw",
"new",
"EntityNotFoundException",
"(",
"WIMMessageKey",
".",
"LDAP_ENTRY_NOT_FOUND",
",",
"msg",
",",
"e",
")",
";",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"WIMMessageHelper",
".",
"generateMsgParms",
"(",
"e",
".",
"toString",
"(",
"true",
")",
")",
")",
";",
"throw",
"new",
"WIMSystemException",
"(",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"msg",
",",
"e",
")",
";",
"}",
"finally",
"{",
"iContextManager",
".",
"releaseDirContext",
"(",
"ctx",
")",
";",
"}",
"}",
"return",
"attributes",
";",
"}"
] | Get the specified attributes for the distinguished name.
@param name The distinguished name.
@param attrIds The attribute IDs to retrieve.
@return The {@link Attributes} instance.
@throws WIMException If there was an error retrieving the attributes from the LDAP server. | [
"Get",
"the",
"specified",
"attributes",
"for",
"the",
"distinguished",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L905-L945 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.checkAttributesCache | public Attributes checkAttributesCache(String name, String[] attrIds) throws WIMException {
final String METHODNAME = "checkAttributesCache";
Attributes attributes = null;
// If attribute cache is available, look up cache first
if (getAttributesCache() != null) {
String key = toKey(name);
Object cached = getAttributesCache().get(key);
// Cache entry found
if (cached != null && (cached instanceof Attributes)) {
List<String> missAttrIdList = new ArrayList<String>(attrIds.length);
Attributes cachedAttrs = (Attributes) cached;
attributes = new BasicAttributes(true);
for (int i = 0; i < attrIds.length; i++) {
Attribute attr = LdapHelper.getIngoreCaseAttribute(cachedAttrs, attrIds[i]);
if (attr != null) {
attributes.put(attr);
} else {
missAttrIdList.add(attrIds[i]);
}
}
// If no missed attributes, nothing need to do.
// Otherwise, retrieve missed attributes and add back to cache
if (missAttrIdList.size() > 0) {
String[] missAttrIds = missAttrIdList.toArray(new String[0]);
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Miss cache: " + key + " " + WIMTraceHelper.printObjectArray(missAttrIds));
}
Attributes missAttrs = getAttributes(name, missAttrIds);
// Add missed attributes to attributes.
addAttributes(missAttrs, attributes);
// Add missed attributes to cache.
updateAttributesCache(key, missAttrs, cachedAttrs, missAttrIds);
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Hit cache: " + key);
}
}
}
// No cache entry, call LDAP to retrieve all request attributes.
else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Miss cache: " + key);
}
attributes = getAttributes(name, attrIds);
// Add attributes to cache.
updateAttributesCache(key, attributes, null, attrIds);
}
} else {
// Attribute cache is not available, directly call LDAP server
attributes = getAttributes(name, attrIds);
}
return attributes;
} | java | public Attributes checkAttributesCache(String name, String[] attrIds) throws WIMException {
final String METHODNAME = "checkAttributesCache";
Attributes attributes = null;
// If attribute cache is available, look up cache first
if (getAttributesCache() != null) {
String key = toKey(name);
Object cached = getAttributesCache().get(key);
// Cache entry found
if (cached != null && (cached instanceof Attributes)) {
List<String> missAttrIdList = new ArrayList<String>(attrIds.length);
Attributes cachedAttrs = (Attributes) cached;
attributes = new BasicAttributes(true);
for (int i = 0; i < attrIds.length; i++) {
Attribute attr = LdapHelper.getIngoreCaseAttribute(cachedAttrs, attrIds[i]);
if (attr != null) {
attributes.put(attr);
} else {
missAttrIdList.add(attrIds[i]);
}
}
// If no missed attributes, nothing need to do.
// Otherwise, retrieve missed attributes and add back to cache
if (missAttrIdList.size() > 0) {
String[] missAttrIds = missAttrIdList.toArray(new String[0]);
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Miss cache: " + key + " " + WIMTraceHelper.printObjectArray(missAttrIds));
}
Attributes missAttrs = getAttributes(name, missAttrIds);
// Add missed attributes to attributes.
addAttributes(missAttrs, attributes);
// Add missed attributes to cache.
updateAttributesCache(key, missAttrs, cachedAttrs, missAttrIds);
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Hit cache: " + key);
}
}
}
// No cache entry, call LDAP to retrieve all request attributes.
else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Miss cache: " + key);
}
attributes = getAttributes(name, attrIds);
// Add attributes to cache.
updateAttributesCache(key, attributes, null, attrIds);
}
} else {
// Attribute cache is not available, directly call LDAP server
attributes = getAttributes(name, attrIds);
}
return attributes;
} | [
"public",
"Attributes",
"checkAttributesCache",
"(",
"String",
"name",
",",
"String",
"[",
"]",
"attrIds",
")",
"throws",
"WIMException",
"{",
"final",
"String",
"METHODNAME",
"=",
"\"checkAttributesCache\"",
";",
"Attributes",
"attributes",
"=",
"null",
";",
"// If attribute cache is available, look up cache first",
"if",
"(",
"getAttributesCache",
"(",
")",
"!=",
"null",
")",
"{",
"String",
"key",
"=",
"toKey",
"(",
"name",
")",
";",
"Object",
"cached",
"=",
"getAttributesCache",
"(",
")",
".",
"get",
"(",
"key",
")",
";",
"// Cache entry found",
"if",
"(",
"cached",
"!=",
"null",
"&&",
"(",
"cached",
"instanceof",
"Attributes",
")",
")",
"{",
"List",
"<",
"String",
">",
"missAttrIdList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"attrIds",
".",
"length",
")",
";",
"Attributes",
"cachedAttrs",
"=",
"(",
"Attributes",
")",
"cached",
";",
"attributes",
"=",
"new",
"BasicAttributes",
"(",
"true",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"attrIds",
".",
"length",
";",
"i",
"++",
")",
"{",
"Attribute",
"attr",
"=",
"LdapHelper",
".",
"getIngoreCaseAttribute",
"(",
"cachedAttrs",
",",
"attrIds",
"[",
"i",
"]",
")",
";",
"if",
"(",
"attr",
"!=",
"null",
")",
"{",
"attributes",
".",
"put",
"(",
"attr",
")",
";",
"}",
"else",
"{",
"missAttrIdList",
".",
"add",
"(",
"attrIds",
"[",
"i",
"]",
")",
";",
"}",
"}",
"// If no missed attributes, nothing need to do.",
"// Otherwise, retrieve missed attributes and add back to cache",
"if",
"(",
"missAttrIdList",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"String",
"[",
"]",
"missAttrIds",
"=",
"missAttrIdList",
".",
"toArray",
"(",
"new",
"String",
"[",
"0",
"]",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" Miss cache: \"",
"+",
"key",
"+",
"\" \"",
"+",
"WIMTraceHelper",
".",
"printObjectArray",
"(",
"missAttrIds",
")",
")",
";",
"}",
"Attributes",
"missAttrs",
"=",
"getAttributes",
"(",
"name",
",",
"missAttrIds",
")",
";",
"// Add missed attributes to attributes.",
"addAttributes",
"(",
"missAttrs",
",",
"attributes",
")",
";",
"// Add missed attributes to cache.",
"updateAttributesCache",
"(",
"key",
",",
"missAttrs",
",",
"cachedAttrs",
",",
"missAttrIds",
")",
";",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" Hit cache: \"",
"+",
"key",
")",
";",
"}",
"}",
"}",
"// No cache entry, call LDAP to retrieve all request attributes.",
"else",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" Miss cache: \"",
"+",
"key",
")",
";",
"}",
"attributes",
"=",
"getAttributes",
"(",
"name",
",",
"attrIds",
")",
";",
"// Add attributes to cache.",
"updateAttributesCache",
"(",
"key",
",",
"attributes",
",",
"null",
",",
"attrIds",
")",
";",
"}",
"}",
"else",
"{",
"// Attribute cache is not available, directly call LDAP server",
"attributes",
"=",
"getAttributes",
"(",
"name",
",",
"attrIds",
")",
";",
"}",
"return",
"attributes",
";",
"}"
] | Check the attributes cache for the attributes on the distinguished name.
If any of the attributes are missing, a call to the LDAP server will be made to retrieve them.
@param name The distinguished name to look up the attributes in the cache for.
@param attrIds The attributes to retrieve.
@return The {@link Attributes}.
@throws WIMException If a call to the LDAP server was necessary and failed. | [
"Check",
"the",
"attributes",
"cache",
"for",
"the",
"attributes",
"on",
"the",
"distinguished",
"name",
".",
"If",
"any",
"of",
"the",
"attributes",
"are",
"missing",
"a",
"call",
"to",
"the",
"LDAP",
"server",
"will",
"be",
"made",
"to",
"retrieve",
"them",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L993-L1048 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.updateAttributesCache | private void updateAttributesCache(String uniqueNameKey, String dn, Attributes newAttrs, String[] attrIds) {
final String METHODNAME = "updateAttributesCache(key,dn,newAttrs)";
/*
* Add uniqueName to DN mapping to cache
*/
getAttributesCache().put(uniqueNameKey, dn, 1, iAttrsCacheTimeOut, 0, null);
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Update " + iAttrsCacheName + "(size: "
+ getAttributesCache().size() + ")\n" + uniqueNameKey + ": " + dn);
}
/*
* Add the DN to Attributes mapping to the cache.
*/
String dnKey = toKey(dn);
Object cached = getAttributesCache().get(dnKey);
Attributes cachedAttrs = null;
if (cached != null && cached instanceof Attributes) {
cachedAttrs = (Attributes) cached;
}
updateAttributesCache(dnKey, newAttrs, cachedAttrs, attrIds);
} | java | private void updateAttributesCache(String uniqueNameKey, String dn, Attributes newAttrs, String[] attrIds) {
final String METHODNAME = "updateAttributesCache(key,dn,newAttrs)";
/*
* Add uniqueName to DN mapping to cache
*/
getAttributesCache().put(uniqueNameKey, dn, 1, iAttrsCacheTimeOut, 0, null);
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Update " + iAttrsCacheName + "(size: "
+ getAttributesCache().size() + ")\n" + uniqueNameKey + ": " + dn);
}
/*
* Add the DN to Attributes mapping to the cache.
*/
String dnKey = toKey(dn);
Object cached = getAttributesCache().get(dnKey);
Attributes cachedAttrs = null;
if (cached != null && cached instanceof Attributes) {
cachedAttrs = (Attributes) cached;
}
updateAttributesCache(dnKey, newAttrs, cachedAttrs, attrIds);
} | [
"private",
"void",
"updateAttributesCache",
"(",
"String",
"uniqueNameKey",
",",
"String",
"dn",
",",
"Attributes",
"newAttrs",
",",
"String",
"[",
"]",
"attrIds",
")",
"{",
"final",
"String",
"METHODNAME",
"=",
"\"updateAttributesCache(key,dn,newAttrs)\"",
";",
"/*\n * Add uniqueName to DN mapping to cache\n */",
"getAttributesCache",
"(",
")",
".",
"put",
"(",
"uniqueNameKey",
",",
"dn",
",",
"1",
",",
"iAttrsCacheTimeOut",
",",
"0",
",",
"null",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" Update \"",
"+",
"iAttrsCacheName",
"+",
"\"(size: \"",
"+",
"getAttributesCache",
"(",
")",
".",
"size",
"(",
")",
"+",
"\")\\n\"",
"+",
"uniqueNameKey",
"+",
"\": \"",
"+",
"dn",
")",
";",
"}",
"/*\n * Add the DN to Attributes mapping to the cache.\n */",
"String",
"dnKey",
"=",
"toKey",
"(",
"dn",
")",
";",
"Object",
"cached",
"=",
"getAttributesCache",
"(",
")",
".",
"get",
"(",
"dnKey",
")",
";",
"Attributes",
"cachedAttrs",
"=",
"null",
";",
"if",
"(",
"cached",
"!=",
"null",
"&&",
"cached",
"instanceof",
"Attributes",
")",
"{",
"cachedAttrs",
"=",
"(",
"Attributes",
")",
"cached",
";",
"}",
"updateAttributesCache",
"(",
"dnKey",
",",
"newAttrs",
",",
"cachedAttrs",
",",
"attrIds",
")",
";",
"}"
] | Update the attributes cache by adding a mapping of the unique name to distinguished name
and mapping the distinguished name to the updated attributes.
@param uniqueNameKey The unique name to map the distinguished name to.
@param dn The distinguished name to map to the unique name. This will also be used to map
the attributes to.
@param newAttrs The new attributes.
@param attrIds The attribute IDs. | [
"Update",
"the",
"attributes",
"cache",
"by",
"adding",
"a",
"mapping",
"of",
"the",
"unique",
"name",
"to",
"distinguished",
"name",
"and",
"mapping",
"the",
"distinguished",
"name",
"to",
"the",
"updated",
"attributes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L1073-L1095 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.updateAttributesCache | private void updateAttributesCache(String key, Attributes missAttrs, Attributes cachedAttrs, String[] missAttrIds) {
final String METHODNAME = "updateAttributesCache(key,missAttrs,cachedAttrs,missAttrIds)";
if (missAttrIds != null) {
boolean newattr = false; // differentiate between a new entry and an entry we'll update so we change the cache correctly and maintain the creation TTL.
if (missAttrIds.length > 0) {
if (cachedAttrs != null) {
cachedAttrs = (Attributes) cachedAttrs.clone();
} else {
cachedAttrs = new BasicAttributes(true);
newattr = true;
}
for (int i = 0; i < missAttrIds.length; i++) {
boolean findAttr = false;
for (NamingEnumeration<?> neu = missAttrs.getAll(); neu.hasMoreElements();) {
Attribute attr = (Attribute) neu.nextElement();
if (attr.getID().equalsIgnoreCase(missAttrIds[i])) {
findAttr = true;
// If the size of the attributes is larger than the
// limit, do not cache it.
if (!(iAttrsSizeLmit > 0 && attr.size() > iAttrsSizeLmit)) {
cachedAttrs.put(attr);
}
break;
} else {
int pos = attr.getID().indexOf(";");
if (pos > 0 && missAttrIds[i].equalsIgnoreCase(attr.getID().substring(0, pos))) {
findAttr = true;
// If the size of the attributes is larger than
// the limit, do not cache it.
if (!(iAttrsSizeLmit > 0 && attr.size() > iAttrsSizeLmit)) {
cachedAttrs.put(attr);
}
break;
}
}
}
if (!findAttr) {
Attribute nullAttr = new BasicAttribute(missAttrIds[i], null);
cachedAttrs.put(nullAttr);
}
}
if (newattr) { // only set the the TTL if we're putting in a new entry
getAttributesCache().put(key, cachedAttrs, 1, iAttrsCacheTimeOut, 0, null);
} else {
getAttributesCache().put(key, cachedAttrs);
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Update " + iAttrsCacheName + "(size: " + getAttributesCache().size() + " newEntry: " + newattr + ")\n" + key
+ ": " + cachedAttrs);
}
}
} else {
updateAttributesCache(key, missAttrs, cachedAttrs);
}
} | java | private void updateAttributesCache(String key, Attributes missAttrs, Attributes cachedAttrs, String[] missAttrIds) {
final String METHODNAME = "updateAttributesCache(key,missAttrs,cachedAttrs,missAttrIds)";
if (missAttrIds != null) {
boolean newattr = false; // differentiate between a new entry and an entry we'll update so we change the cache correctly and maintain the creation TTL.
if (missAttrIds.length > 0) {
if (cachedAttrs != null) {
cachedAttrs = (Attributes) cachedAttrs.clone();
} else {
cachedAttrs = new BasicAttributes(true);
newattr = true;
}
for (int i = 0; i < missAttrIds.length; i++) {
boolean findAttr = false;
for (NamingEnumeration<?> neu = missAttrs.getAll(); neu.hasMoreElements();) {
Attribute attr = (Attribute) neu.nextElement();
if (attr.getID().equalsIgnoreCase(missAttrIds[i])) {
findAttr = true;
// If the size of the attributes is larger than the
// limit, do not cache it.
if (!(iAttrsSizeLmit > 0 && attr.size() > iAttrsSizeLmit)) {
cachedAttrs.put(attr);
}
break;
} else {
int pos = attr.getID().indexOf(";");
if (pos > 0 && missAttrIds[i].equalsIgnoreCase(attr.getID().substring(0, pos))) {
findAttr = true;
// If the size of the attributes is larger than
// the limit, do not cache it.
if (!(iAttrsSizeLmit > 0 && attr.size() > iAttrsSizeLmit)) {
cachedAttrs.put(attr);
}
break;
}
}
}
if (!findAttr) {
Attribute nullAttr = new BasicAttribute(missAttrIds[i], null);
cachedAttrs.put(nullAttr);
}
}
if (newattr) { // only set the the TTL if we're putting in a new entry
getAttributesCache().put(key, cachedAttrs, 1, iAttrsCacheTimeOut, 0, null);
} else {
getAttributesCache().put(key, cachedAttrs);
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Update " + iAttrsCacheName + "(size: " + getAttributesCache().size() + " newEntry: " + newattr + ")\n" + key
+ ": " + cachedAttrs);
}
}
} else {
updateAttributesCache(key, missAttrs, cachedAttrs);
}
} | [
"private",
"void",
"updateAttributesCache",
"(",
"String",
"key",
",",
"Attributes",
"missAttrs",
",",
"Attributes",
"cachedAttrs",
",",
"String",
"[",
"]",
"missAttrIds",
")",
"{",
"final",
"String",
"METHODNAME",
"=",
"\"updateAttributesCache(key,missAttrs,cachedAttrs,missAttrIds)\"",
";",
"if",
"(",
"missAttrIds",
"!=",
"null",
")",
"{",
"boolean",
"newattr",
"=",
"false",
";",
"// differentiate between a new entry and an entry we'll update so we change the cache correctly and maintain the creation TTL.",
"if",
"(",
"missAttrIds",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"cachedAttrs",
"!=",
"null",
")",
"{",
"cachedAttrs",
"=",
"(",
"Attributes",
")",
"cachedAttrs",
".",
"clone",
"(",
")",
";",
"}",
"else",
"{",
"cachedAttrs",
"=",
"new",
"BasicAttributes",
"(",
"true",
")",
";",
"newattr",
"=",
"true",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"missAttrIds",
".",
"length",
";",
"i",
"++",
")",
"{",
"boolean",
"findAttr",
"=",
"false",
";",
"for",
"(",
"NamingEnumeration",
"<",
"?",
">",
"neu",
"=",
"missAttrs",
".",
"getAll",
"(",
")",
";",
"neu",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"Attribute",
"attr",
"=",
"(",
"Attribute",
")",
"neu",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"attr",
".",
"getID",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"missAttrIds",
"[",
"i",
"]",
")",
")",
"{",
"findAttr",
"=",
"true",
";",
"// If the size of the attributes is larger than the",
"// limit, do not cache it.",
"if",
"(",
"!",
"(",
"iAttrsSizeLmit",
">",
"0",
"&&",
"attr",
".",
"size",
"(",
")",
">",
"iAttrsSizeLmit",
")",
")",
"{",
"cachedAttrs",
".",
"put",
"(",
"attr",
")",
";",
"}",
"break",
";",
"}",
"else",
"{",
"int",
"pos",
"=",
"attr",
".",
"getID",
"(",
")",
".",
"indexOf",
"(",
"\";\"",
")",
";",
"if",
"(",
"pos",
">",
"0",
"&&",
"missAttrIds",
"[",
"i",
"]",
".",
"equalsIgnoreCase",
"(",
"attr",
".",
"getID",
"(",
")",
".",
"substring",
"(",
"0",
",",
"pos",
")",
")",
")",
"{",
"findAttr",
"=",
"true",
";",
"// If the size of the attributes is larger than",
"// the limit, do not cache it.",
"if",
"(",
"!",
"(",
"iAttrsSizeLmit",
">",
"0",
"&&",
"attr",
".",
"size",
"(",
")",
">",
"iAttrsSizeLmit",
")",
")",
"{",
"cachedAttrs",
".",
"put",
"(",
"attr",
")",
";",
"}",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"findAttr",
")",
"{",
"Attribute",
"nullAttr",
"=",
"new",
"BasicAttribute",
"(",
"missAttrIds",
"[",
"i",
"]",
",",
"null",
")",
";",
"cachedAttrs",
".",
"put",
"(",
"nullAttr",
")",
";",
"}",
"}",
"if",
"(",
"newattr",
")",
"{",
"// only set the the TTL if we're putting in a new entry",
"getAttributesCache",
"(",
")",
".",
"put",
"(",
"key",
",",
"cachedAttrs",
",",
"1",
",",
"iAttrsCacheTimeOut",
",",
"0",
",",
"null",
")",
";",
"}",
"else",
"{",
"getAttributesCache",
"(",
")",
".",
"put",
"(",
"key",
",",
"cachedAttrs",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" Update \"",
"+",
"iAttrsCacheName",
"+",
"\"(size: \"",
"+",
"getAttributesCache",
"(",
")",
".",
"size",
"(",
")",
"+",
"\" newEntry: \"",
"+",
"newattr",
"+",
"\")\\n\"",
"+",
"key",
"+",
"\": \"",
"+",
"cachedAttrs",
")",
";",
"}",
"}",
"}",
"else",
"{",
"updateAttributesCache",
"(",
"key",
",",
"missAttrs",
",",
"cachedAttrs",
")",
";",
"}",
"}"
] | Update the cached attributes for the specified key. Only attribute IDs that are in the
"missAttrIds" array will be added into the cached attributes.
@param key The key for the cached attributes. This is usually the distinguished name.
@param missAttrs The missing/new attributes.
@param cachedAttrs The cached attributes.
@param missAttrIds The missing/new attribute IDs. | [
"Update",
"the",
"cached",
"attributes",
"for",
"the",
"specified",
"key",
".",
"Only",
"attribute",
"IDs",
"that",
"are",
"in",
"the",
"missAttrIds",
"array",
"will",
"be",
"added",
"into",
"the",
"cached",
"attributes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L1106-L1162 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.updateAttributesCache | private void updateAttributesCache(String key, Attributes missAttrs, Attributes cachedAttrs) {
final String METHODNAME = "updateAttributeCache(key,missAttrs,cachedAttrs)";
if (missAttrs.size() > 0) {
boolean newAttr = false; // differentiate between a new entry and an entry we'll update so we change the cache correctly and maintain the creation TTL.
if (cachedAttrs != null) {
cachedAttrs = (Attributes) cachedAttrs.clone();
} else {
cachedAttrs = new BasicAttributes(true);
newAttr = true;
}
//Set extIdAttrs = iLdapConfigMgr.getExtIds();
for (NamingEnumeration<?> neu = missAttrs.getAll(); neu.hasMoreElements();) {
Attribute attr = (Attribute) neu.nextElement();
// If the size of the attributes is larger than the limit, don not cache it.
if (!(iAttrsSizeLmit > 0 && attr.size() > iAttrsSizeLmit)) {
cachedAttrs.put(attr);
}
}
if (newAttr) {
getAttributesCache().put(key, cachedAttrs, 1, iAttrsCacheTimeOut, 0, null);
} else {
getAttributesCache().put(key, cachedAttrs);
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Update " + iAttrsCacheName + "(size: " + getAttributesCache().size() + " newEntry: " + newAttr + ")\n" + key + ": " + cachedAttrs);
}
}
} | java | private void updateAttributesCache(String key, Attributes missAttrs, Attributes cachedAttrs) {
final String METHODNAME = "updateAttributeCache(key,missAttrs,cachedAttrs)";
if (missAttrs.size() > 0) {
boolean newAttr = false; // differentiate between a new entry and an entry we'll update so we change the cache correctly and maintain the creation TTL.
if (cachedAttrs != null) {
cachedAttrs = (Attributes) cachedAttrs.clone();
} else {
cachedAttrs = new BasicAttributes(true);
newAttr = true;
}
//Set extIdAttrs = iLdapConfigMgr.getExtIds();
for (NamingEnumeration<?> neu = missAttrs.getAll(); neu.hasMoreElements();) {
Attribute attr = (Attribute) neu.nextElement();
// If the size of the attributes is larger than the limit, don not cache it.
if (!(iAttrsSizeLmit > 0 && attr.size() > iAttrsSizeLmit)) {
cachedAttrs.put(attr);
}
}
if (newAttr) {
getAttributesCache().put(key, cachedAttrs, 1, iAttrsCacheTimeOut, 0, null);
} else {
getAttributesCache().put(key, cachedAttrs);
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Update " + iAttrsCacheName + "(size: " + getAttributesCache().size() + " newEntry: " + newAttr + ")\n" + key + ": " + cachedAttrs);
}
}
} | [
"private",
"void",
"updateAttributesCache",
"(",
"String",
"key",
",",
"Attributes",
"missAttrs",
",",
"Attributes",
"cachedAttrs",
")",
"{",
"final",
"String",
"METHODNAME",
"=",
"\"updateAttributeCache(key,missAttrs,cachedAttrs)\"",
";",
"if",
"(",
"missAttrs",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"boolean",
"newAttr",
"=",
"false",
";",
"// differentiate between a new entry and an entry we'll update so we change the cache correctly and maintain the creation TTL.",
"if",
"(",
"cachedAttrs",
"!=",
"null",
")",
"{",
"cachedAttrs",
"=",
"(",
"Attributes",
")",
"cachedAttrs",
".",
"clone",
"(",
")",
";",
"}",
"else",
"{",
"cachedAttrs",
"=",
"new",
"BasicAttributes",
"(",
"true",
")",
";",
"newAttr",
"=",
"true",
";",
"}",
"//Set extIdAttrs = iLdapConfigMgr.getExtIds();",
"for",
"(",
"NamingEnumeration",
"<",
"?",
">",
"neu",
"=",
"missAttrs",
".",
"getAll",
"(",
")",
";",
"neu",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"Attribute",
"attr",
"=",
"(",
"Attribute",
")",
"neu",
".",
"nextElement",
"(",
")",
";",
"// If the size of the attributes is larger than the limit, don not cache it.",
"if",
"(",
"!",
"(",
"iAttrsSizeLmit",
">",
"0",
"&&",
"attr",
".",
"size",
"(",
")",
">",
"iAttrsSizeLmit",
")",
")",
"{",
"cachedAttrs",
".",
"put",
"(",
"attr",
")",
";",
"}",
"}",
"if",
"(",
"newAttr",
")",
"{",
"getAttributesCache",
"(",
")",
".",
"put",
"(",
"key",
",",
"cachedAttrs",
",",
"1",
",",
"iAttrsCacheTimeOut",
",",
"0",
",",
"null",
")",
";",
"}",
"else",
"{",
"getAttributesCache",
"(",
")",
".",
"put",
"(",
"key",
",",
"cachedAttrs",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" Update \"",
"+",
"iAttrsCacheName",
"+",
"\"(size: \"",
"+",
"getAttributesCache",
"(",
")",
".",
"size",
"(",
")",
"+",
"\" newEntry: \"",
"+",
"newAttr",
"+",
"\")\\n\"",
"+",
"key",
"+",
"\": \"",
"+",
"cachedAttrs",
")",
";",
"}",
"}",
"}"
] | Update the attributes cache for the specified key.
@param key The key for the cached attributes. This is usually the distinguished name.
@param missAttrs The missing/new attributes.
@param cachedAttrs The cached attributes. | [
"Update",
"the",
"attributes",
"cache",
"for",
"the",
"specified",
"key",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L1171-L1199 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.checkSearchCache | private NamingEnumeration<SearchResult> checkSearchCache(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws WIMException {
final String METHODNAME = "checkSearchCache";
NamingEnumeration<SearchResult> neu = null;
if (getSearchResultsCache() != null) {
String key = null;
if (filterArgs == null) {
key = toKey(name, filterExpr, cons);
} else {
key = toKey(name, filterExpr, filterArgs, cons);
}
CachedNamingEnumeration cached = (CachedNamingEnumeration) getSearchResultsCache().get(key);
if (cached == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Miss cache: " + key);
}
neu = search(name, filterExpr, filterArgs, cons, null);
String[] reqAttrIds = cons.getReturningAttributes();
neu = updateSearchCache(name, key, neu, reqAttrIds);
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Hit cache: " + key);
}
neu = (CachedNamingEnumeration) cached.clone();
}
} else {
neu = search(name, filterExpr, filterArgs, cons, null);
}
return neu;
} | java | private NamingEnumeration<SearchResult> checkSearchCache(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws WIMException {
final String METHODNAME = "checkSearchCache";
NamingEnumeration<SearchResult> neu = null;
if (getSearchResultsCache() != null) {
String key = null;
if (filterArgs == null) {
key = toKey(name, filterExpr, cons);
} else {
key = toKey(name, filterExpr, filterArgs, cons);
}
CachedNamingEnumeration cached = (CachedNamingEnumeration) getSearchResultsCache().get(key);
if (cached == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Miss cache: " + key);
}
neu = search(name, filterExpr, filterArgs, cons, null);
String[] reqAttrIds = cons.getReturningAttributes();
neu = updateSearchCache(name, key, neu, reqAttrIds);
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Hit cache: " + key);
}
neu = (CachedNamingEnumeration) cached.clone();
}
} else {
neu = search(name, filterExpr, filterArgs, cons, null);
}
return neu;
} | [
"private",
"NamingEnumeration",
"<",
"SearchResult",
">",
"checkSearchCache",
"(",
"String",
"name",
",",
"String",
"filterExpr",
",",
"Object",
"[",
"]",
"filterArgs",
",",
"SearchControls",
"cons",
")",
"throws",
"WIMException",
"{",
"final",
"String",
"METHODNAME",
"=",
"\"checkSearchCache\"",
";",
"NamingEnumeration",
"<",
"SearchResult",
">",
"neu",
"=",
"null",
";",
"if",
"(",
"getSearchResultsCache",
"(",
")",
"!=",
"null",
")",
"{",
"String",
"key",
"=",
"null",
";",
"if",
"(",
"filterArgs",
"==",
"null",
")",
"{",
"key",
"=",
"toKey",
"(",
"name",
",",
"filterExpr",
",",
"cons",
")",
";",
"}",
"else",
"{",
"key",
"=",
"toKey",
"(",
"name",
",",
"filterExpr",
",",
"filterArgs",
",",
"cons",
")",
";",
"}",
"CachedNamingEnumeration",
"cached",
"=",
"(",
"CachedNamingEnumeration",
")",
"getSearchResultsCache",
"(",
")",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"cached",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" Miss cache: \"",
"+",
"key",
")",
";",
"}",
"neu",
"=",
"search",
"(",
"name",
",",
"filterExpr",
",",
"filterArgs",
",",
"cons",
",",
"null",
")",
";",
"String",
"[",
"]",
"reqAttrIds",
"=",
"cons",
".",
"getReturningAttributes",
"(",
")",
";",
"neu",
"=",
"updateSearchCache",
"(",
"name",
",",
"key",
",",
"neu",
",",
"reqAttrIds",
")",
";",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" Hit cache: \"",
"+",
"key",
")",
";",
"}",
"neu",
"=",
"(",
"CachedNamingEnumeration",
")",
"cached",
".",
"clone",
"(",
")",
";",
"}",
"}",
"else",
"{",
"neu",
"=",
"search",
"(",
"name",
",",
"filterExpr",
",",
"filterArgs",
",",
"cons",
",",
"null",
")",
";",
"}",
"return",
"neu",
";",
"}"
] | Check the search cache for previously performed searches. If the result is not cached,
query the LDAP server.
@param name The name of the context or object to search
@param filterExpr the filter expression used in the search.
@param filterArgs the filter arguments used in the search.
@param cons The search controls used in the search.
@return The {@link CachedNamingEnumeration} if the search is still in the cache, null otherwise.
@throws WIMException If the search failed with an error. | [
"Check",
"the",
"search",
"cache",
"for",
"previously",
"performed",
"searches",
".",
"If",
"the",
"result",
"is",
"not",
"cached",
"query",
"the",
"LDAP",
"server",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L1233-L1262 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.updateSearchCache | @FFDCIgnore(NamingException.class)
private NamingEnumeration<SearchResult> updateSearchCache(String searchBase, String key, NamingEnumeration<SearchResult> neu,
String[] reqAttrIds) throws WIMSystemException {
final String METHODNAME = "updateSearchCache";
CachedNamingEnumeration clone1 = new CachedNamingEnumeration();
CachedNamingEnumeration clone2 = new CachedNamingEnumeration();
int count = cloneSearchResults(neu, clone1, clone2);
// Size limit 0 means no limit.
if (iSearchResultSizeLmit == 0 || count < iSearchResultSizeLmit) {
getSearchResultsCache().put(key, clone2, 1, iSearchResultsCacheTimeOut, 0, null);
if (tc.isDebugEnabled())
Tr.debug(tc, METHODNAME + " Update " + iSearchResultsCacheName + "(size: " + getSearchResultsCache().size() + ")\n" + key);
// To reduce JNDI calls during get(), cache the entry into attribute cache
if (getAttributesCache() != null) {
try {
count = 0;
while (clone2.hasMore()) {
SearchResult result = clone2.nextElement();
String dnKey = LdapHelper.prepareDN(result.getName(), searchBase);
Object cached = getAttributesCache().get(dnKey);
Attributes cachedAttrs = null;
if (cached != null && cached instanceof Attributes) {
cachedAttrs = (Attributes) cached;
}
updateAttributesCache(dnKey, result.getAttributes(), cachedAttrs, reqAttrIds);
if (++count > 20) {
// cache only first 20 results from the search.
// caching all entries may thrash the attributeCache
if (tc.isDebugEnabled())
Tr.debug(tc, METHODNAME + " attribute cache updated with " + (count - 1) + " entries. skipping rest.");
break;
}
}
} catch (NamingException e) {
/* Ignore. */
}
}
}
return clone1;
} | java | @FFDCIgnore(NamingException.class)
private NamingEnumeration<SearchResult> updateSearchCache(String searchBase, String key, NamingEnumeration<SearchResult> neu,
String[] reqAttrIds) throws WIMSystemException {
final String METHODNAME = "updateSearchCache";
CachedNamingEnumeration clone1 = new CachedNamingEnumeration();
CachedNamingEnumeration clone2 = new CachedNamingEnumeration();
int count = cloneSearchResults(neu, clone1, clone2);
// Size limit 0 means no limit.
if (iSearchResultSizeLmit == 0 || count < iSearchResultSizeLmit) {
getSearchResultsCache().put(key, clone2, 1, iSearchResultsCacheTimeOut, 0, null);
if (tc.isDebugEnabled())
Tr.debug(tc, METHODNAME + " Update " + iSearchResultsCacheName + "(size: " + getSearchResultsCache().size() + ")\n" + key);
// To reduce JNDI calls during get(), cache the entry into attribute cache
if (getAttributesCache() != null) {
try {
count = 0;
while (clone2.hasMore()) {
SearchResult result = clone2.nextElement();
String dnKey = LdapHelper.prepareDN(result.getName(), searchBase);
Object cached = getAttributesCache().get(dnKey);
Attributes cachedAttrs = null;
if (cached != null && cached instanceof Attributes) {
cachedAttrs = (Attributes) cached;
}
updateAttributesCache(dnKey, result.getAttributes(), cachedAttrs, reqAttrIds);
if (++count > 20) {
// cache only first 20 results from the search.
// caching all entries may thrash the attributeCache
if (tc.isDebugEnabled())
Tr.debug(tc, METHODNAME + " attribute cache updated with " + (count - 1) + " entries. skipping rest.");
break;
}
}
} catch (NamingException e) {
/* Ignore. */
}
}
}
return clone1;
} | [
"@",
"FFDCIgnore",
"(",
"NamingException",
".",
"class",
")",
"private",
"NamingEnumeration",
"<",
"SearchResult",
">",
"updateSearchCache",
"(",
"String",
"searchBase",
",",
"String",
"key",
",",
"NamingEnumeration",
"<",
"SearchResult",
">",
"neu",
",",
"String",
"[",
"]",
"reqAttrIds",
")",
"throws",
"WIMSystemException",
"{",
"final",
"String",
"METHODNAME",
"=",
"\"updateSearchCache\"",
";",
"CachedNamingEnumeration",
"clone1",
"=",
"new",
"CachedNamingEnumeration",
"(",
")",
";",
"CachedNamingEnumeration",
"clone2",
"=",
"new",
"CachedNamingEnumeration",
"(",
")",
";",
"int",
"count",
"=",
"cloneSearchResults",
"(",
"neu",
",",
"clone1",
",",
"clone2",
")",
";",
"// Size limit 0 means no limit.",
"if",
"(",
"iSearchResultSizeLmit",
"==",
"0",
"||",
"count",
"<",
"iSearchResultSizeLmit",
")",
"{",
"getSearchResultsCache",
"(",
")",
".",
"put",
"(",
"key",
",",
"clone2",
",",
"1",
",",
"iSearchResultsCacheTimeOut",
",",
"0",
",",
"null",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" Update \"",
"+",
"iSearchResultsCacheName",
"+",
"\"(size: \"",
"+",
"getSearchResultsCache",
"(",
")",
".",
"size",
"(",
")",
"+",
"\")\\n\"",
"+",
"key",
")",
";",
"// To reduce JNDI calls during get(), cache the entry into attribute cache",
"if",
"(",
"getAttributesCache",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"count",
"=",
"0",
";",
"while",
"(",
"clone2",
".",
"hasMore",
"(",
")",
")",
"{",
"SearchResult",
"result",
"=",
"clone2",
".",
"nextElement",
"(",
")",
";",
"String",
"dnKey",
"=",
"LdapHelper",
".",
"prepareDN",
"(",
"result",
".",
"getName",
"(",
")",
",",
"searchBase",
")",
";",
"Object",
"cached",
"=",
"getAttributesCache",
"(",
")",
".",
"get",
"(",
"dnKey",
")",
";",
"Attributes",
"cachedAttrs",
"=",
"null",
";",
"if",
"(",
"cached",
"!=",
"null",
"&&",
"cached",
"instanceof",
"Attributes",
")",
"{",
"cachedAttrs",
"=",
"(",
"Attributes",
")",
"cached",
";",
"}",
"updateAttributesCache",
"(",
"dnKey",
",",
"result",
".",
"getAttributes",
"(",
")",
",",
"cachedAttrs",
",",
"reqAttrIds",
")",
";",
"if",
"(",
"++",
"count",
">",
"20",
")",
"{",
"// cache only first 20 results from the search.",
"// caching all entries may thrash the attributeCache",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" attribute cache updated with \"",
"+",
"(",
"count",
"-",
"1",
")",
"+",
"\" entries. skipping rest.\"",
")",
";",
"break",
";",
"}",
"}",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"/* Ignore. */",
"}",
"}",
"}",
"return",
"clone1",
";",
"}"
] | Update the search cache with search results.
@param searchBase The base entry the search was made from.
@param key The key for the entry in the search cache.
@param neu The search results.
@param reqAttrIds The attribute IDs that were requested.
@return The {@link CachedNamingEnumeration} with the original search results.
@throws WIMSystemException If the results could not be cloned into the search cache. | [
"Update",
"the",
"search",
"cache",
"with",
"search",
"results",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L1274-L1316 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.getDynamicGroups | public Map<String, LdapEntry> getDynamicGroups(String bases[], List<String> propNames, boolean getMbrshipAttr) throws WIMException {
Map<String, LdapEntry> dynaGrps = new HashMap<String, LdapEntry>();
String[] attrIds = iLdapConfigMgr.getAttributeNames(iLdapConfigMgr.getGroupTypes(), propNames, getMbrshipAttr, false);
String[] dynaMbrAttrNames = iLdapConfigMgr.getDynamicMemberAttributes();
String[] temp = attrIds;
attrIds = new String[temp.length + dynaMbrAttrNames.length];
System.arraycopy(temp, 0, attrIds, 0, temp.length);
System.arraycopy(dynaMbrAttrNames, 0, attrIds, temp.length, dynaMbrAttrNames.length);
String dynaGrpFitler = iLdapConfigMgr.getDynamicGroupFilter();
for (int i = 0, n = bases.length; i < n; i++) {
String base = bases[i];
for (NamingEnumeration<SearchResult> urls = search(base, dynaGrpFitler, SearchControls.SUBTREE_SCOPE, attrIds); urls.hasMoreElements();) {
javax.naming.directory.SearchResult thisEntry = urls.nextElement();
if (thisEntry == null) {
continue;
}
String entryName = thisEntry.getName();
if (entryName == null || entryName.trim().length() == 0) {
continue;
}
String dn = LdapHelper.prepareDN(entryName, base);
javax.naming.directory.Attributes attrs = thisEntry.getAttributes();
String extId = iLdapConfigMgr.getExtIdFromAttributes(dn, SchemaConstants.DO_GROUP, attrs);
String uniqueName = getUniqueName(dn, SchemaConstants.DO_GROUP, attrs);
LdapEntry ldapEntry = new LdapEntry(dn, extId, uniqueName, SchemaConstants.DO_GROUP, attrs);
dynaGrps.put(ldapEntry.getDN(), ldapEntry);
}
}
return dynaGrps;
} | java | public Map<String, LdapEntry> getDynamicGroups(String bases[], List<String> propNames, boolean getMbrshipAttr) throws WIMException {
Map<String, LdapEntry> dynaGrps = new HashMap<String, LdapEntry>();
String[] attrIds = iLdapConfigMgr.getAttributeNames(iLdapConfigMgr.getGroupTypes(), propNames, getMbrshipAttr, false);
String[] dynaMbrAttrNames = iLdapConfigMgr.getDynamicMemberAttributes();
String[] temp = attrIds;
attrIds = new String[temp.length + dynaMbrAttrNames.length];
System.arraycopy(temp, 0, attrIds, 0, temp.length);
System.arraycopy(dynaMbrAttrNames, 0, attrIds, temp.length, dynaMbrAttrNames.length);
String dynaGrpFitler = iLdapConfigMgr.getDynamicGroupFilter();
for (int i = 0, n = bases.length; i < n; i++) {
String base = bases[i];
for (NamingEnumeration<SearchResult> urls = search(base, dynaGrpFitler, SearchControls.SUBTREE_SCOPE, attrIds); urls.hasMoreElements();) {
javax.naming.directory.SearchResult thisEntry = urls.nextElement();
if (thisEntry == null) {
continue;
}
String entryName = thisEntry.getName();
if (entryName == null || entryName.trim().length() == 0) {
continue;
}
String dn = LdapHelper.prepareDN(entryName, base);
javax.naming.directory.Attributes attrs = thisEntry.getAttributes();
String extId = iLdapConfigMgr.getExtIdFromAttributes(dn, SchemaConstants.DO_GROUP, attrs);
String uniqueName = getUniqueName(dn, SchemaConstants.DO_GROUP, attrs);
LdapEntry ldapEntry = new LdapEntry(dn, extId, uniqueName, SchemaConstants.DO_GROUP, attrs);
dynaGrps.put(ldapEntry.getDN(), ldapEntry);
}
}
return dynaGrps;
} | [
"public",
"Map",
"<",
"String",
",",
"LdapEntry",
">",
"getDynamicGroups",
"(",
"String",
"bases",
"[",
"]",
",",
"List",
"<",
"String",
">",
"propNames",
",",
"boolean",
"getMbrshipAttr",
")",
"throws",
"WIMException",
"{",
"Map",
"<",
"String",
",",
"LdapEntry",
">",
"dynaGrps",
"=",
"new",
"HashMap",
"<",
"String",
",",
"LdapEntry",
">",
"(",
")",
";",
"String",
"[",
"]",
"attrIds",
"=",
"iLdapConfigMgr",
".",
"getAttributeNames",
"(",
"iLdapConfigMgr",
".",
"getGroupTypes",
"(",
")",
",",
"propNames",
",",
"getMbrshipAttr",
",",
"false",
")",
";",
"String",
"[",
"]",
"dynaMbrAttrNames",
"=",
"iLdapConfigMgr",
".",
"getDynamicMemberAttributes",
"(",
")",
";",
"String",
"[",
"]",
"temp",
"=",
"attrIds",
";",
"attrIds",
"=",
"new",
"String",
"[",
"temp",
".",
"length",
"+",
"dynaMbrAttrNames",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"temp",
",",
"0",
",",
"attrIds",
",",
"0",
",",
"temp",
".",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"dynaMbrAttrNames",
",",
"0",
",",
"attrIds",
",",
"temp",
".",
"length",
",",
"dynaMbrAttrNames",
".",
"length",
")",
";",
"String",
"dynaGrpFitler",
"=",
"iLdapConfigMgr",
".",
"getDynamicGroupFilter",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"bases",
".",
"length",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"String",
"base",
"=",
"bases",
"[",
"i",
"]",
";",
"for",
"(",
"NamingEnumeration",
"<",
"SearchResult",
">",
"urls",
"=",
"search",
"(",
"base",
",",
"dynaGrpFitler",
",",
"SearchControls",
".",
"SUBTREE_SCOPE",
",",
"attrIds",
")",
";",
"urls",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"javax",
".",
"naming",
".",
"directory",
".",
"SearchResult",
"thisEntry",
"=",
"urls",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"thisEntry",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"String",
"entryName",
"=",
"thisEntry",
".",
"getName",
"(",
")",
";",
"if",
"(",
"entryName",
"==",
"null",
"||",
"entryName",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"continue",
";",
"}",
"String",
"dn",
"=",
"LdapHelper",
".",
"prepareDN",
"(",
"entryName",
",",
"base",
")",
";",
"javax",
".",
"naming",
".",
"directory",
".",
"Attributes",
"attrs",
"=",
"thisEntry",
".",
"getAttributes",
"(",
")",
";",
"String",
"extId",
"=",
"iLdapConfigMgr",
".",
"getExtIdFromAttributes",
"(",
"dn",
",",
"SchemaConstants",
".",
"DO_GROUP",
",",
"attrs",
")",
";",
"String",
"uniqueName",
"=",
"getUniqueName",
"(",
"dn",
",",
"SchemaConstants",
".",
"DO_GROUP",
",",
"attrs",
")",
";",
"LdapEntry",
"ldapEntry",
"=",
"new",
"LdapEntry",
"(",
"dn",
",",
"extId",
",",
"uniqueName",
",",
"SchemaConstants",
".",
"DO_GROUP",
",",
"attrs",
")",
";",
"dynaGrps",
".",
"put",
"(",
"ldapEntry",
".",
"getDN",
"(",
")",
",",
"ldapEntry",
")",
";",
"}",
"}",
"return",
"dynaGrps",
";",
"}"
] | Get dynamic groups.
@param bases Search bases.
@param propNames Properties to return.
@param getMbrshipAttr Whether to request the membership attribute.
@return Map of group distinguished names to {@link LdapEntry}.
@throws WIMException If there was an error resolving the dynamic groups from the LDAP server. | [
"Get",
"dynamic",
"groups",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L1647-L1676 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.isMemberInURLQuery | public boolean isMemberInURLQuery(LdapURL[] urls, String dn) throws WIMException {
boolean result = false;
String[] attrIds = {};
String rdn = LdapHelper.getRDN(dn);
if (urls != null) {
for (int i = 0; i < urls.length; i++) {
LdapURL ldapURL = urls[i];
if (ldapURL.parsedOK()) {
String searchBase = ldapURL.get_dn();
// If dn is not under base, no need to do search
if (LdapHelper.isUnderBases(dn, searchBase)) {
int searchScope = ldapURL.get_searchScope();
String searchFilter = ldapURL.get_filter();
if (searchScope == SearchControls.SUBTREE_SCOPE) {
if (searchFilter == null) {
result = true;
break;
} else {
NamingEnumeration<SearchResult> nenu = search(dn, searchFilter, SearchControls.SUBTREE_SCOPE, attrIds);
if (nenu.hasMoreElements()) {
result = true;
break;
}
}
} else {
if (searchFilter == null) {
searchFilter = rdn;
} else {
searchFilter = "(&(" + searchFilter + ")(" + rdn + "))";
}
NamingEnumeration<SearchResult> nenu = search(searchBase, searchFilter, searchScope, attrIds);
if (nenu.hasMoreElements()) {
SearchResult thisEntry = nenu.nextElement();
if (thisEntry == null) {
continue;
}
String returnedDN = LdapHelper.prepareDN(thisEntry.getName(), searchBase);
if (dn.equalsIgnoreCase(returnedDN)) {
result = true;
break;
}
}
}
}
}
}
}
return result;
} | java | public boolean isMemberInURLQuery(LdapURL[] urls, String dn) throws WIMException {
boolean result = false;
String[] attrIds = {};
String rdn = LdapHelper.getRDN(dn);
if (urls != null) {
for (int i = 0; i < urls.length; i++) {
LdapURL ldapURL = urls[i];
if (ldapURL.parsedOK()) {
String searchBase = ldapURL.get_dn();
// If dn is not under base, no need to do search
if (LdapHelper.isUnderBases(dn, searchBase)) {
int searchScope = ldapURL.get_searchScope();
String searchFilter = ldapURL.get_filter();
if (searchScope == SearchControls.SUBTREE_SCOPE) {
if (searchFilter == null) {
result = true;
break;
} else {
NamingEnumeration<SearchResult> nenu = search(dn, searchFilter, SearchControls.SUBTREE_SCOPE, attrIds);
if (nenu.hasMoreElements()) {
result = true;
break;
}
}
} else {
if (searchFilter == null) {
searchFilter = rdn;
} else {
searchFilter = "(&(" + searchFilter + ")(" + rdn + "))";
}
NamingEnumeration<SearchResult> nenu = search(searchBase, searchFilter, searchScope, attrIds);
if (nenu.hasMoreElements()) {
SearchResult thisEntry = nenu.nextElement();
if (thisEntry == null) {
continue;
}
String returnedDN = LdapHelper.prepareDN(thisEntry.getName(), searchBase);
if (dn.equalsIgnoreCase(returnedDN)) {
result = true;
break;
}
}
}
}
}
}
}
return result;
} | [
"public",
"boolean",
"isMemberInURLQuery",
"(",
"LdapURL",
"[",
"]",
"urls",
",",
"String",
"dn",
")",
"throws",
"WIMException",
"{",
"boolean",
"result",
"=",
"false",
";",
"String",
"[",
"]",
"attrIds",
"=",
"{",
"}",
";",
"String",
"rdn",
"=",
"LdapHelper",
".",
"getRDN",
"(",
"dn",
")",
";",
"if",
"(",
"urls",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"urls",
".",
"length",
";",
"i",
"++",
")",
"{",
"LdapURL",
"ldapURL",
"=",
"urls",
"[",
"i",
"]",
";",
"if",
"(",
"ldapURL",
".",
"parsedOK",
"(",
")",
")",
"{",
"String",
"searchBase",
"=",
"ldapURL",
".",
"get_dn",
"(",
")",
";",
"// If dn is not under base, no need to do search",
"if",
"(",
"LdapHelper",
".",
"isUnderBases",
"(",
"dn",
",",
"searchBase",
")",
")",
"{",
"int",
"searchScope",
"=",
"ldapURL",
".",
"get_searchScope",
"(",
")",
";",
"String",
"searchFilter",
"=",
"ldapURL",
".",
"get_filter",
"(",
")",
";",
"if",
"(",
"searchScope",
"==",
"SearchControls",
".",
"SUBTREE_SCOPE",
")",
"{",
"if",
"(",
"searchFilter",
"==",
"null",
")",
"{",
"result",
"=",
"true",
";",
"break",
";",
"}",
"else",
"{",
"NamingEnumeration",
"<",
"SearchResult",
">",
"nenu",
"=",
"search",
"(",
"dn",
",",
"searchFilter",
",",
"SearchControls",
".",
"SUBTREE_SCOPE",
",",
"attrIds",
")",
";",
"if",
"(",
"nenu",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"result",
"=",
"true",
";",
"break",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"searchFilter",
"==",
"null",
")",
"{",
"searchFilter",
"=",
"rdn",
";",
"}",
"else",
"{",
"searchFilter",
"=",
"\"(&(\"",
"+",
"searchFilter",
"+",
"\")(\"",
"+",
"rdn",
"+",
"\"))\"",
";",
"}",
"NamingEnumeration",
"<",
"SearchResult",
">",
"nenu",
"=",
"search",
"(",
"searchBase",
",",
"searchFilter",
",",
"searchScope",
",",
"attrIds",
")",
";",
"if",
"(",
"nenu",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"SearchResult",
"thisEntry",
"=",
"nenu",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"thisEntry",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"String",
"returnedDN",
"=",
"LdapHelper",
".",
"prepareDN",
"(",
"thisEntry",
".",
"getName",
"(",
")",
",",
"searchBase",
")",
";",
"if",
"(",
"dn",
".",
"equalsIgnoreCase",
"(",
"returnedDN",
")",
")",
"{",
"result",
"=",
"true",
";",
"break",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] | Determine whether the distinguished name is in the LDAP URL query.
@param urls The {@link LdapURL}s to query.
@param dn The distinguished name to check.
@return True if the distinguished name is resolved by one of the {@link LdapURL}s.
@throws WIMException If there were issues resolving any of the LDAP URLs. | [
"Determine",
"whether",
"the",
"distinguished",
"name",
"is",
"in",
"the",
"LDAP",
"URL",
"query",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L1686-L1736 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.searchByOperationalAttribute | public SearchResult searchByOperationalAttribute(String dn, String filter, List<String> inEntityTypes, List<String> propNames, String oprAttribute) throws WIMException {
String inEntityType = null;
List<String> supportedProps = propNames;
if (inEntityTypes != null && inEntityTypes.size() > 0) {
inEntityType = inEntityTypes.get(0);
supportedProps = iLdapConfigMgr.getSupportedProperties(inEntityType, propNames);
}
String[] attrIds = iLdapConfigMgr.getAttributeNames(inEntityTypes, supportedProps, false, false);
attrIds = Arrays.copyOf(attrIds, attrIds.length + 1);
attrIds[attrIds.length - 1] = oprAttribute;
NamingEnumeration<SearchResult> neu = null;
neu = search(dn, filter, SearchControls.OBJECT_SCOPE, attrIds, iCountLimit, iTimeLimit);
if (neu != null) {
try {
if (neu.hasMore()) {
return neu.next();
}
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
}
}
return null;
} | java | public SearchResult searchByOperationalAttribute(String dn, String filter, List<String> inEntityTypes, List<String> propNames, String oprAttribute) throws WIMException {
String inEntityType = null;
List<String> supportedProps = propNames;
if (inEntityTypes != null && inEntityTypes.size() > 0) {
inEntityType = inEntityTypes.get(0);
supportedProps = iLdapConfigMgr.getSupportedProperties(inEntityType, propNames);
}
String[] attrIds = iLdapConfigMgr.getAttributeNames(inEntityTypes, supportedProps, false, false);
attrIds = Arrays.copyOf(attrIds, attrIds.length + 1);
attrIds[attrIds.length - 1] = oprAttribute;
NamingEnumeration<SearchResult> neu = null;
neu = search(dn, filter, SearchControls.OBJECT_SCOPE, attrIds, iCountLimit, iTimeLimit);
if (neu != null) {
try {
if (neu.hasMore()) {
return neu.next();
}
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
}
}
return null;
} | [
"public",
"SearchResult",
"searchByOperationalAttribute",
"(",
"String",
"dn",
",",
"String",
"filter",
",",
"List",
"<",
"String",
">",
"inEntityTypes",
",",
"List",
"<",
"String",
">",
"propNames",
",",
"String",
"oprAttribute",
")",
"throws",
"WIMException",
"{",
"String",
"inEntityType",
"=",
"null",
";",
"List",
"<",
"String",
">",
"supportedProps",
"=",
"propNames",
";",
"if",
"(",
"inEntityTypes",
"!=",
"null",
"&&",
"inEntityTypes",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"inEntityType",
"=",
"inEntityTypes",
".",
"get",
"(",
"0",
")",
";",
"supportedProps",
"=",
"iLdapConfigMgr",
".",
"getSupportedProperties",
"(",
"inEntityType",
",",
"propNames",
")",
";",
"}",
"String",
"[",
"]",
"attrIds",
"=",
"iLdapConfigMgr",
".",
"getAttributeNames",
"(",
"inEntityTypes",
",",
"supportedProps",
",",
"false",
",",
"false",
")",
";",
"attrIds",
"=",
"Arrays",
".",
"copyOf",
"(",
"attrIds",
",",
"attrIds",
".",
"length",
"+",
"1",
")",
";",
"attrIds",
"[",
"attrIds",
".",
"length",
"-",
"1",
"]",
"=",
"oprAttribute",
";",
"NamingEnumeration",
"<",
"SearchResult",
">",
"neu",
"=",
"null",
";",
"neu",
"=",
"search",
"(",
"dn",
",",
"filter",
",",
"SearchControls",
".",
"OBJECT_SCOPE",
",",
"attrIds",
",",
"iCountLimit",
",",
"iTimeLimit",
")",
";",
"if",
"(",
"neu",
"!=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"neu",
".",
"hasMore",
"(",
")",
")",
"{",
"return",
"neu",
".",
"next",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"WIMMessageHelper",
".",
"generateMsgParms",
"(",
"e",
".",
"toString",
"(",
"true",
")",
")",
")",
";",
"throw",
"new",
"WIMSystemException",
"(",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"msg",
",",
"e",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Search using operational attribute specified in the parameter.
@param dn The DN to search on
@param filter The LDAP filter for the search.
@param inEntityTypes The entity types to search for.
@param propNames The property names to return.
@param oprAttribute The operational attribute.
@return The search results or null if there are no results.
@throws WIMException If the entity types do not exist or the search failed. | [
"Search",
"using",
"operational",
"attribute",
"specified",
"in",
"the",
"parameter",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L2066-L2094 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.getBinaryAttributes | private String getBinaryAttributes() {
// Add binary settings for all octet string attributes.
StringBuffer binaryAttrNamesBuffer = new StringBuffer();
// Check the ldap data type of the extId attribute.
Map<String, LdapAttribute> attrMap = iLdapConfigMgr.getAttributes();
for (String attrName : attrMap.keySet()) {
LdapAttribute attr = attrMap.get(attrName);
if (LdapConstants.LDAP_ATTR_SYNTAX_OCTETSTRING.equalsIgnoreCase(attr.getSyntax())) {
binaryAttrNamesBuffer.append(attr.getName()).append(" ");
}
}
return binaryAttrNamesBuffer.toString().trim();
} | java | private String getBinaryAttributes() {
// Add binary settings for all octet string attributes.
StringBuffer binaryAttrNamesBuffer = new StringBuffer();
// Check the ldap data type of the extId attribute.
Map<String, LdapAttribute> attrMap = iLdapConfigMgr.getAttributes();
for (String attrName : attrMap.keySet()) {
LdapAttribute attr = attrMap.get(attrName);
if (LdapConstants.LDAP_ATTR_SYNTAX_OCTETSTRING.equalsIgnoreCase(attr.getSyntax())) {
binaryAttrNamesBuffer.append(attr.getName()).append(" ");
}
}
return binaryAttrNamesBuffer.toString().trim();
} | [
"private",
"String",
"getBinaryAttributes",
"(",
")",
"{",
"// Add binary settings for all octet string attributes.",
"StringBuffer",
"binaryAttrNamesBuffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"// Check the ldap data type of the extId attribute.",
"Map",
"<",
"String",
",",
"LdapAttribute",
">",
"attrMap",
"=",
"iLdapConfigMgr",
".",
"getAttributes",
"(",
")",
";",
"for",
"(",
"String",
"attrName",
":",
"attrMap",
".",
"keySet",
"(",
")",
")",
"{",
"LdapAttribute",
"attr",
"=",
"attrMap",
".",
"get",
"(",
"attrName",
")",
";",
"if",
"(",
"LdapConstants",
".",
"LDAP_ATTR_SYNTAX_OCTETSTRING",
".",
"equalsIgnoreCase",
"(",
"attr",
".",
"getSyntax",
"(",
")",
")",
")",
"{",
"binaryAttrNamesBuffer",
".",
"append",
"(",
"attr",
".",
"getName",
"(",
")",
")",
".",
"append",
"(",
"\" \"",
")",
";",
"}",
"}",
"return",
"binaryAttrNamesBuffer",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
";",
"}"
] | Get the list of configure binary attributes.
@return A white-space delimited string of binary attribute names, suitable for use
configuring JNDI. | [
"Get",
"the",
"list",
"of",
"configure",
"binary",
"attributes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L2102-L2118 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.