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.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java
XPath10ParserImpl.parseLocationStep
private void parseLocationStep(String selector, int start, int stepEnd) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "parseLocationStep", "selector: " + selector + ", start: " + start + ", end: " + stepEnd); int stepStart = start; int posOpenBracket = selector.indexOf("[", start); if(posOpenBracket > stepEnd || posOpenBracket == -1) { // Set posOpenBracket to avoid further processing posOpenBracket = -1; // No brackets so process whole of the location step String step = selector.substring(start,stepEnd); // Set the full name into the identifier. The full name is used in position assignment when // determining uniqueness of names. Only a full name will do. String full = selector.substring(0,stepEnd); // Add an IdentifierImpl for the location step to the array list selOperands.add(createIdentifierForSubExpression(step, full, true, false)); } int posCloseBracket = selector.indexOf("]", start); boolean wrapWholeStep = false; boolean foundPredicates = false; ArrayList tempSelOperands = new ArrayList(); while (posOpenBracket >= 0) { foundPredicates = true; if(posCloseBracket < posOpenBracket) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "parseLocationStep", "bracket error"); InvalidXPathSyntaxException iex = new InvalidXPathSyntaxException(selector); FFDC.processException(cclass, "com.ibm.ws.sib.matchspace.selector.impl.XPath10ParserImpl", iex, "1:372:1.16"); throw iex; } else { // The full selector path up to this point String full = selector.substring(0,posOpenBracket); // Factor out the location step first but be careful we may have a predicate if(start != posOpenBracket) { // Go ahead and deal with the location step String step = selector.substring(start,posOpenBracket); // Add an IdentifierImpl for the location step to the array list tempSelOperands.add(createIdentifierForSubExpression(step, full, true, false)); } // Now parse the predicate String predicate = selector.substring(posOpenBracket + 1,posCloseBracket); Selector parsedPredicate = parsePredicate(predicate, full); // Check whether we were able to parse if(parsedPredicate == null) { // Unable to parse the expression, so we need to wrap the entire step // tempSelOperands.add(createIdentifierForSubExpression(predicate, false)); wrapWholeStep = true; break; } else { // we were able to parse the expression with the MatchParser // Check that the predicate has Simple tests only if(!Matching.isSimple(parsedPredicate)) { wrapWholeStep = true; break; } parsedPredicate.setExtended(); tempSelOperands.add(parsedPredicate); } } // Move to beyond the close bracket start = posCloseBracket+1; //Are there any more brackets? posOpenBracket = selector.indexOf("[", start); posCloseBracket = selector.indexOf("]", start); // Have we found the last bracket in this location step? if(posOpenBracket > stepEnd || posOpenBracket == -1) { // Set posOpenBracket to avoid further processing posOpenBracket = -1; } } // eof while if(foundPredicates) { // If we determined that we cannot parse this location step, then wrap it if(wrapWholeStep) wrapLocationStep(selector, stepStart,stepEnd); else { // PostProcessing here selOperands.addAll(tempSelOperands); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "parseLocationStep"); }
java
private void parseLocationStep(String selector, int start, int stepEnd) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "parseLocationStep", "selector: " + selector + ", start: " + start + ", end: " + stepEnd); int stepStart = start; int posOpenBracket = selector.indexOf("[", start); if(posOpenBracket > stepEnd || posOpenBracket == -1) { // Set posOpenBracket to avoid further processing posOpenBracket = -1; // No brackets so process whole of the location step String step = selector.substring(start,stepEnd); // Set the full name into the identifier. The full name is used in position assignment when // determining uniqueness of names. Only a full name will do. String full = selector.substring(0,stepEnd); // Add an IdentifierImpl for the location step to the array list selOperands.add(createIdentifierForSubExpression(step, full, true, false)); } int posCloseBracket = selector.indexOf("]", start); boolean wrapWholeStep = false; boolean foundPredicates = false; ArrayList tempSelOperands = new ArrayList(); while (posOpenBracket >= 0) { foundPredicates = true; if(posCloseBracket < posOpenBracket) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "parseLocationStep", "bracket error"); InvalidXPathSyntaxException iex = new InvalidXPathSyntaxException(selector); FFDC.processException(cclass, "com.ibm.ws.sib.matchspace.selector.impl.XPath10ParserImpl", iex, "1:372:1.16"); throw iex; } else { // The full selector path up to this point String full = selector.substring(0,posOpenBracket); // Factor out the location step first but be careful we may have a predicate if(start != posOpenBracket) { // Go ahead and deal with the location step String step = selector.substring(start,posOpenBracket); // Add an IdentifierImpl for the location step to the array list tempSelOperands.add(createIdentifierForSubExpression(step, full, true, false)); } // Now parse the predicate String predicate = selector.substring(posOpenBracket + 1,posCloseBracket); Selector parsedPredicate = parsePredicate(predicate, full); // Check whether we were able to parse if(parsedPredicate == null) { // Unable to parse the expression, so we need to wrap the entire step // tempSelOperands.add(createIdentifierForSubExpression(predicate, false)); wrapWholeStep = true; break; } else { // we were able to parse the expression with the MatchParser // Check that the predicate has Simple tests only if(!Matching.isSimple(parsedPredicate)) { wrapWholeStep = true; break; } parsedPredicate.setExtended(); tempSelOperands.add(parsedPredicate); } } // Move to beyond the close bracket start = posCloseBracket+1; //Are there any more brackets? posOpenBracket = selector.indexOf("[", start); posCloseBracket = selector.indexOf("]", start); // Have we found the last bracket in this location step? if(posOpenBracket > stepEnd || posOpenBracket == -1) { // Set posOpenBracket to avoid further processing posOpenBracket = -1; } } // eof while if(foundPredicates) { // If we determined that we cannot parse this location step, then wrap it if(wrapWholeStep) wrapLocationStep(selector, stepStart,stepEnd); else { // PostProcessing here selOperands.addAll(tempSelOperands); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "parseLocationStep"); }
[ "private", "void", "parseLocationStep", "(", "String", "selector", ",", "int", "start", ",", "int", "stepEnd", ")", "throws", "InvalidXPathSyntaxException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"parseLocationStep\"", ",", "\"selector: \"", "+", "selector", "+", "\", start: \"", "+", "start", "+", "\", end: \"", "+", "stepEnd", ")", ";", "int", "stepStart", "=", "start", ";", "int", "posOpenBracket", "=", "selector", ".", "indexOf", "(", "\"[\"", ",", "start", ")", ";", "if", "(", "posOpenBracket", ">", "stepEnd", "||", "posOpenBracket", "==", "-", "1", ")", "{", "// Set posOpenBracket to avoid further processing", "posOpenBracket", "=", "-", "1", ";", "// No brackets so process whole of the location step", "String", "step", "=", "selector", ".", "substring", "(", "start", ",", "stepEnd", ")", ";", "// Set the full name into the identifier. The full name is used in position assignment when", "// determining uniqueness of names. Only a full name will do.", "String", "full", "=", "selector", ".", "substring", "(", "0", ",", "stepEnd", ")", ";", "// Add an IdentifierImpl for the location step to the array list", "selOperands", ".", "add", "(", "createIdentifierForSubExpression", "(", "step", ",", "full", ",", "true", ",", "false", ")", ")", ";", "}", "int", "posCloseBracket", "=", "selector", ".", "indexOf", "(", "\"]\"", ",", "start", ")", ";", "boolean", "wrapWholeStep", "=", "false", ";", "boolean", "foundPredicates", "=", "false", ";", "ArrayList", "tempSelOperands", "=", "new", "ArrayList", "(", ")", ";", "while", "(", "posOpenBracket", ">=", "0", ")", "{", "foundPredicates", "=", "true", ";", "if", "(", "posCloseBracket", "<", "posOpenBracket", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "this", ",", "cclass", ",", "\"parseLocationStep\"", ",", "\"bracket error\"", ")", ";", "InvalidXPathSyntaxException", "iex", "=", "new", "InvalidXPathSyntaxException", "(", "selector", ")", ";", "FFDC", ".", "processException", "(", "cclass", ",", "\"com.ibm.ws.sib.matchspace.selector.impl.XPath10ParserImpl\"", ",", "iex", ",", "\"1:372:1.16\"", ")", ";", "throw", "iex", ";", "}", "else", "{", "// The full selector path up to this point", "String", "full", "=", "selector", ".", "substring", "(", "0", ",", "posOpenBracket", ")", ";", "// Factor out the location step first but be careful we may have a predicate", "if", "(", "start", "!=", "posOpenBracket", ")", "{", "// Go ahead and deal with the location step", "String", "step", "=", "selector", ".", "substring", "(", "start", ",", "posOpenBracket", ")", ";", "// Add an IdentifierImpl for the location step to the array list", "tempSelOperands", ".", "add", "(", "createIdentifierForSubExpression", "(", "step", ",", "full", ",", "true", ",", "false", ")", ")", ";", "}", "// Now parse the predicate", "String", "predicate", "=", "selector", ".", "substring", "(", "posOpenBracket", "+", "1", ",", "posCloseBracket", ")", ";", "Selector", "parsedPredicate", "=", "parsePredicate", "(", "predicate", ",", "full", ")", ";", "// Check whether we were able to parse", "if", "(", "parsedPredicate", "==", "null", ")", "{", "// Unable to parse the expression, so we need to wrap the entire step", "// tempSelOperands.add(createIdentifierForSubExpression(predicate, false));", "wrapWholeStep", "=", "true", ";", "break", ";", "}", "else", "{", "// we were able to parse the expression with the MatchParser", "// Check that the predicate has Simple tests only", "if", "(", "!", "Matching", ".", "isSimple", "(", "parsedPredicate", ")", ")", "{", "wrapWholeStep", "=", "true", ";", "break", ";", "}", "parsedPredicate", ".", "setExtended", "(", ")", ";", "tempSelOperands", ".", "add", "(", "parsedPredicate", ")", ";", "}", "}", "// Move to beyond the close bracket", "start", "=", "posCloseBracket", "+", "1", ";", "//Are there any more brackets?", "posOpenBracket", "=", "selector", ".", "indexOf", "(", "\"[\"", ",", "start", ")", ";", "posCloseBracket", "=", "selector", ".", "indexOf", "(", "\"]\"", ",", "start", ")", ";", "// Have we found the last bracket in this location step?", "if", "(", "posOpenBracket", ">", "stepEnd", "||", "posOpenBracket", "==", "-", "1", ")", "{", "// Set posOpenBracket to avoid further processing", "posOpenBracket", "=", "-", "1", ";", "}", "}", "// eof while", "if", "(", "foundPredicates", ")", "{", "// If we determined that we cannot parse this location step, then wrap it", "if", "(", "wrapWholeStep", ")", "wrapLocationStep", "(", "selector", ",", "stepStart", ",", "stepEnd", ")", ";", "else", "{", "// PostProcessing here", "selOperands", ".", "addAll", "(", "tempSelOperands", ")", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "this", ",", "cclass", ",", "\"parseLocationStep\"", ")", ";", "}" ]
Break a location step into predicates that can be driven against the MatchParser. @param selector @param start @param stepEnd @throws InvalidXPathSyntaxException
[ "Break", "a", "location", "step", "into", "predicates", "that", "can", "be", "driven", "against", "the", "MatchParser", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java#L307-L420
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java
XPath10ParserImpl.createIdentifierForSubExpression
private IdentifierImpl createIdentifierForSubExpression(String subExpression, String fullExpression, boolean isLocationStep, boolean isLastStep) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "createIdentifierForSubExpression", "subExpression: " + subExpression + ", isLocStep: " + new Boolean(isLocationStep) + ", isLastStep: " + new Boolean(isLocationStep)); IdentifierImpl stepIdentifier = new IdentifierImpl(subExpression); // Set the full name into the identifier stepIdentifier.setFullName(fullExpression); // bump the locationStep if we're not dealing with a predicate if(isLocationStep) locationStep++; // Set the appropriate XPath parameters for this Identifier setXPathCharacteristics(stepIdentifier); // Set the type to child if not the last step if(!isLastStep) stepIdentifier.setType(Selector.CHILD); else stepIdentifier.setType(Selector.BOOLEAN); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "createIdentifierForSubExpression", stepIdentifier); return stepIdentifier; }
java
private IdentifierImpl createIdentifierForSubExpression(String subExpression, String fullExpression, boolean isLocationStep, boolean isLastStep) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "createIdentifierForSubExpression", "subExpression: " + subExpression + ", isLocStep: " + new Boolean(isLocationStep) + ", isLastStep: " + new Boolean(isLocationStep)); IdentifierImpl stepIdentifier = new IdentifierImpl(subExpression); // Set the full name into the identifier stepIdentifier.setFullName(fullExpression); // bump the locationStep if we're not dealing with a predicate if(isLocationStep) locationStep++; // Set the appropriate XPath parameters for this Identifier setXPathCharacteristics(stepIdentifier); // Set the type to child if not the last step if(!isLastStep) stepIdentifier.setType(Selector.CHILD); else stepIdentifier.setType(Selector.BOOLEAN); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "createIdentifierForSubExpression", stepIdentifier); return stepIdentifier; }
[ "private", "IdentifierImpl", "createIdentifierForSubExpression", "(", "String", "subExpression", ",", "String", "fullExpression", ",", "boolean", "isLocationStep", ",", "boolean", "isLastStep", ")", "throws", "InvalidXPathSyntaxException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"createIdentifierForSubExpression\"", ",", "\"subExpression: \"", "+", "subExpression", "+", "\", isLocStep: \"", "+", "new", "Boolean", "(", "isLocationStep", ")", "+", "\", isLastStep: \"", "+", "new", "Boolean", "(", "isLocationStep", ")", ")", ";", "IdentifierImpl", "stepIdentifier", "=", "new", "IdentifierImpl", "(", "subExpression", ")", ";", "// Set the full name into the identifier", "stepIdentifier", ".", "setFullName", "(", "fullExpression", ")", ";", "// bump the locationStep if we're not dealing with a predicate", "if", "(", "isLocationStep", ")", "locationStep", "++", ";", "// Set the appropriate XPath parameters for this Identifier", "setXPathCharacteristics", "(", "stepIdentifier", ")", ";", "// Set the type to child if not the last step", "if", "(", "!", "isLastStep", ")", "stepIdentifier", ".", "setType", "(", "Selector", ".", "CHILD", ")", ";", "else", "stepIdentifier", ".", "setType", "(", "Selector", ".", "BOOLEAN", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "this", ",", "cclass", ",", "\"createIdentifierForSubExpression\"", ",", "stepIdentifier", ")", ";", "return", "stepIdentifier", ";", "}" ]
When we've isolated a subexpression we wrap it in an Identifier. @param subExpression @param isLocationStep @param isLastStep @return @throws InvalidXPathSyntaxException
[ "When", "we", "ve", "isolated", "a", "subexpression", "we", "wrap", "it", "in", "an", "Identifier", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java#L579-L612
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java
XPath10ParserImpl.createIdentifierForWildExpression
private IdentifierImpl createIdentifierForWildExpression(String selector) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "createIdentifierForWildExpression", "selector: " + selector); IdentifierImpl wildIdentifier = new IdentifierImpl(selector); // Set the appropriate XPath parameters for this Identifier setXPathCharacteristics(wildIdentifier); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "createIdentifierForSubExpression", wildIdentifier); return wildIdentifier; }
java
private IdentifierImpl createIdentifierForWildExpression(String selector) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "createIdentifierForWildExpression", "selector: " + selector); IdentifierImpl wildIdentifier = new IdentifierImpl(selector); // Set the appropriate XPath parameters for this Identifier setXPathCharacteristics(wildIdentifier); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "createIdentifierForSubExpression", wildIdentifier); return wildIdentifier; }
[ "private", "IdentifierImpl", "createIdentifierForWildExpression", "(", "String", "selector", ")", "throws", "InvalidXPathSyntaxException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"createIdentifierForWildExpression\"", ",", "\"selector: \"", "+", "selector", ")", ";", "IdentifierImpl", "wildIdentifier", "=", "new", "IdentifierImpl", "(", "selector", ")", ";", "// Set the appropriate XPath parameters for this Identifier", "setXPathCharacteristics", "(", "wildIdentifier", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "this", ",", "cclass", ",", "\"createIdentifierForSubExpression\"", ",", "wildIdentifier", ")", ";", "return", "wildIdentifier", ";", "}" ]
Wrap a selector with a multilevel wildcard in an Identifier. @param selector @return @throws InvalidXPathSyntaxException
[ "Wrap", "a", "selector", "with", "a", "multilevel", "wildcard", "in", "an", "Identifier", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java#L621-L638
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java
XPath10ParserImpl.setXPathCharacteristics
private void setXPathCharacteristics(IdentifierImpl identifier) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "setXPathCharacteristics", "identifier: " + identifier); // Need to set the domain to XPATH1.0 identifier.setSelectorDomain(2); // Set the locationStep also identifier.setStep(locationStep); // Call XPath to compile the XPath1.0 expression and store the // resultant XPathExpression in the Identifier. XPathExpression xpexp = null; try { // Parse an expression up-front Node node = null; NodeList ns = null; XPath xpath0 = XPathFactory.newInstance().newXPath(); // If a namespace context has been set then set it into the XPath env if(namespaceContext != null) xpath0.setNamespaceContext(namespaceContext); xpexp = xpath0.compile(identifier.getName()); } catch (Exception ex) { // No FFDC Code Needed. // We don't FFDC because we'll catch this exception and then attempt // to parse the entire expression. If that fails, then we FFDC. if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "setXPathCharacteristics", ex); throw new InvalidXPathSyntaxException(identifier.getName()); } // Store xpexp in the Identifier identifier.setCompiledExpression(xpexp); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "setXPathCharacteristics"); }
java
private void setXPathCharacteristics(IdentifierImpl identifier) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "setXPathCharacteristics", "identifier: " + identifier); // Need to set the domain to XPATH1.0 identifier.setSelectorDomain(2); // Set the locationStep also identifier.setStep(locationStep); // Call XPath to compile the XPath1.0 expression and store the // resultant XPathExpression in the Identifier. XPathExpression xpexp = null; try { // Parse an expression up-front Node node = null; NodeList ns = null; XPath xpath0 = XPathFactory.newInstance().newXPath(); // If a namespace context has been set then set it into the XPath env if(namespaceContext != null) xpath0.setNamespaceContext(namespaceContext); xpexp = xpath0.compile(identifier.getName()); } catch (Exception ex) { // No FFDC Code Needed. // We don't FFDC because we'll catch this exception and then attempt // to parse the entire expression. If that fails, then we FFDC. if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "setXPathCharacteristics", ex); throw new InvalidXPathSyntaxException(identifier.getName()); } // Store xpexp in the Identifier identifier.setCompiledExpression(xpexp); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "setXPathCharacteristics"); }
[ "private", "void", "setXPathCharacteristics", "(", "IdentifierImpl", "identifier", ")", "throws", "InvalidXPathSyntaxException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"setXPathCharacteristics\"", ",", "\"identifier: \"", "+", "identifier", ")", ";", "// Need to set the domain to XPATH1.0", "identifier", ".", "setSelectorDomain", "(", "2", ")", ";", "// Set the locationStep also", "identifier", ".", "setStep", "(", "locationStep", ")", ";", "// Call XPath to compile the XPath1.0 expression and store the", "// resultant XPathExpression in the Identifier.", "XPathExpression", "xpexp", "=", "null", ";", "try", "{", "// Parse an expression up-front", "Node", "node", "=", "null", ";", "NodeList", "ns", "=", "null", ";", "XPath", "xpath0", "=", "XPathFactory", ".", "newInstance", "(", ")", ".", "newXPath", "(", ")", ";", "// If a namespace context has been set then set it into the XPath env", "if", "(", "namespaceContext", "!=", "null", ")", "xpath0", ".", "setNamespaceContext", "(", "namespaceContext", ")", ";", "xpexp", "=", "xpath0", ".", "compile", "(", "identifier", ".", "getName", "(", ")", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "// No FFDC Code Needed.", "// We don't FFDC because we'll catch this exception and then attempt", "// to parse the entire expression. If that fails, then we FFDC.", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "this", ",", "cclass", ",", "\"setXPathCharacteristics\"", ",", "ex", ")", ";", "throw", "new", "InvalidXPathSyntaxException", "(", "identifier", ".", "getName", "(", ")", ")", ";", "}", "// Store xpexp in the Identifier ", "identifier", ".", "setCompiledExpression", "(", "xpexp", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "this", ",", "cclass", ",", "\"setXPathCharacteristics\"", ")", ";", "}" ]
Configure the Identifier with appropriate XPath parameters. @param identifier @throws InvalidXPathSyntaxException
[ "Configure", "the", "Identifier", "with", "appropriate", "XPath", "parameters", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java#L646-L694
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java
XPath10ParserImpl.parsePredicate
private Selector parsePredicate(String predicate, String fullPath) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "parsePredicate", "predicate: " + predicate); Selector parsed = null; try { // Preprocess predicate for special characters String parserInput = preProcessForSpecials(predicate); // Attempt to parse predicate with "JMS" parser predicateParser = MatchParserImpl.prime(predicateParser, parserInput, true); parsed = predicateParser.getSelector(parserInput); if (parsed.getType() == Selector.INVALID) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this,cclass, "parsePredicate", "Unable to parse predicate"); // reset the output to null parsed = null; } else { postProcessSelectorTree(parsed, fullPath); } } catch (Exception ex) { // No FFDC Code Needed. // In this case we will only trace the exception that we encountered. // It could be that the XPath parser is able to process this predicate // and that we've encountered a discrepancy between the syntax of an // expression supported by JMS and by XPath. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this,cclass, "parsePredicate", ex); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "parsePredicate", parsed); return parsed; }
java
private Selector parsePredicate(String predicate, String fullPath) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "parsePredicate", "predicate: " + predicate); Selector parsed = null; try { // Preprocess predicate for special characters String parserInput = preProcessForSpecials(predicate); // Attempt to parse predicate with "JMS" parser predicateParser = MatchParserImpl.prime(predicateParser, parserInput, true); parsed = predicateParser.getSelector(parserInput); if (parsed.getType() == Selector.INVALID) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this,cclass, "parsePredicate", "Unable to parse predicate"); // reset the output to null parsed = null; } else { postProcessSelectorTree(parsed, fullPath); } } catch (Exception ex) { // No FFDC Code Needed. // In this case we will only trace the exception that we encountered. // It could be that the XPath parser is able to process this predicate // and that we've encountered a discrepancy between the syntax of an // expression supported by JMS and by XPath. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this,cclass, "parsePredicate", ex); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "parsePredicate", parsed); return parsed; }
[ "private", "Selector", "parsePredicate", "(", "String", "predicate", ",", "String", "fullPath", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"parsePredicate\"", ",", "\"predicate: \"", "+", "predicate", ")", ";", "Selector", "parsed", "=", "null", ";", "try", "{", "// Preprocess predicate for special characters", "String", "parserInput", "=", "preProcessForSpecials", "(", "predicate", ")", ";", "// Attempt to parse predicate with \"JMS\" parser", "predicateParser", "=", "MatchParserImpl", ".", "prime", "(", "predicateParser", ",", "parserInput", ",", "true", ")", ";", "parsed", "=", "predicateParser", ".", "getSelector", "(", "parserInput", ")", ";", "if", "(", "parsed", ".", "getType", "(", ")", "==", "Selector", ".", "INVALID", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "tc", ".", "debug", "(", "this", ",", "cclass", ",", "\"parsePredicate\"", ",", "\"Unable to parse predicate\"", ")", ";", "// reset the output to null", "parsed", "=", "null", ";", "}", "else", "{", "postProcessSelectorTree", "(", "parsed", ",", "fullPath", ")", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "// No FFDC Code Needed.", "// In this case we will only trace the exception that we encountered.", "// It could be that the XPath parser is able to process this predicate", "// and that we've encountered a discrepancy between the syntax of an", "// expression supported by JMS and by XPath.", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "tc", ".", "debug", "(", "this", ",", "cclass", ",", "\"parsePredicate\"", ",", "ex", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "this", ",", "cclass", ",", "\"parsePredicate\"", ",", "parsed", ")", ";", "return", "parsed", ";", "}" ]
Attempt to parse an isolated predicate using the MatchParser. @param predicate @return
[ "Attempt", "to", "parse", "an", "isolated", "predicate", "using", "the", "MatchParser", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java#L702-L743
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java
XPath10ParserImpl.preProcessForSpecials
private String preProcessForSpecials(String predicate) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "preProcessForSpecials", "predicate: " + predicate); String processed = predicate; String replace = replaceSpecialsWithSub(predicate); if (replace != null) { processed = replace; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "preProcessForSpecials", processed); return processed; }
java
private String preProcessForSpecials(String predicate) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "preProcessForSpecials", "predicate: " + predicate); String processed = predicate; String replace = replaceSpecialsWithSub(predicate); if (replace != null) { processed = replace; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "preProcessForSpecials", processed); return processed; }
[ "private", "String", "preProcessForSpecials", "(", "String", "predicate", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"preProcessForSpecials\"", ",", "\"predicate: \"", "+", "predicate", ")", ";", "String", "processed", "=", "predicate", ";", "String", "replace", "=", "replaceSpecialsWithSub", "(", "predicate", ")", ";", "if", "(", "replace", "!=", "null", ")", "{", "processed", "=", "replace", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "this", ",", "cclass", ",", "\"preProcessForSpecials\"", ",", "processed", ")", ";", "return", "processed", ";", "}" ]
Locate and replace any special characters that are going to cause problems fr the MatchParser. @param predicate @return
[ "Locate", "and", "replace", "any", "special", "characters", "that", "are", "going", "to", "cause", "problems", "fr", "the", "MatchParser", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java#L752-L770
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java
XPath10ParserImpl.postProcessSelectorTree
private void postProcessSelectorTree(Selector parsed, String fullPath) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "postProcessSelectorTree", "parsed: " + parsed + ", fullPath: " + fullPath); // Walk the selector tree looking for Identifiers if(parsed instanceof IdentifierImpl) { IdentifierImpl parsedIdentifier = (IdentifierImpl) parsed; String identName = parsedIdentifier.getName(); // Reinstate any ampersands and slashes that were removed prior to // parsing String newIdentName = replaceSubForSpecials(identName); if (newIdentName != null) { parsedIdentifier.setName(newIdentName); parsedIdentifier.setFullName(fullPath+newIdentName); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this, cclass, "postProcessSelectorTree", "Identifier name has been reset to: " + ((IdentifierImpl) parsed).getName()); } else { // Set the full path name into the identifier parsedIdentifier.setFullName(fullPath+identName); } // Set the appropriate XPath parameters for this Identifier setXPathCharacteristics((IdentifierImpl) parsed); } else if(parsed instanceof OperatorImpl) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this, cclass, "postProcessSelectorTree", parsed + " is an OperatorImpl"); // Set the extended flag in the Operator parsed.setExtended(); postProcessOperands((OperatorImpl) parsed, fullPath); } else if(parsed instanceof LiteralImpl) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this, cclass, "postProcessSelectorTree", parsed + " is an LiteralImpl"); LiteralImpl literal = (LiteralImpl) parsed; if(literal.getType() == Selector.STRING) { // Reinstate any ampersands and slashes that were removed prior to // parsing String literalString = (String) literal.getValue(); String newLiteralString = replaceSubForSpecials(literalString); if (newLiteralString != null) { ((LiteralImpl) parsed).value = newLiteralString; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this, cclass, "postProcessSelectorTree", "Literal Value has been reset to: " + ((LiteralImpl) parsed).getValue()); } } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this, cclass, "postProcessSelectorTree", "No post processing can be done on: " + parsed); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "postProcessSelectorTree"); }
java
private void postProcessSelectorTree(Selector parsed, String fullPath) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "postProcessSelectorTree", "parsed: " + parsed + ", fullPath: " + fullPath); // Walk the selector tree looking for Identifiers if(parsed instanceof IdentifierImpl) { IdentifierImpl parsedIdentifier = (IdentifierImpl) parsed; String identName = parsedIdentifier.getName(); // Reinstate any ampersands and slashes that were removed prior to // parsing String newIdentName = replaceSubForSpecials(identName); if (newIdentName != null) { parsedIdentifier.setName(newIdentName); parsedIdentifier.setFullName(fullPath+newIdentName); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this, cclass, "postProcessSelectorTree", "Identifier name has been reset to: " + ((IdentifierImpl) parsed).getName()); } else { // Set the full path name into the identifier parsedIdentifier.setFullName(fullPath+identName); } // Set the appropriate XPath parameters for this Identifier setXPathCharacteristics((IdentifierImpl) parsed); } else if(parsed instanceof OperatorImpl) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this, cclass, "postProcessSelectorTree", parsed + " is an OperatorImpl"); // Set the extended flag in the Operator parsed.setExtended(); postProcessOperands((OperatorImpl) parsed, fullPath); } else if(parsed instanceof LiteralImpl) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this, cclass, "postProcessSelectorTree", parsed + " is an LiteralImpl"); LiteralImpl literal = (LiteralImpl) parsed; if(literal.getType() == Selector.STRING) { // Reinstate any ampersands and slashes that were removed prior to // parsing String literalString = (String) literal.getValue(); String newLiteralString = replaceSubForSpecials(literalString); if (newLiteralString != null) { ((LiteralImpl) parsed).value = newLiteralString; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this, cclass, "postProcessSelectorTree", "Literal Value has been reset to: " + ((LiteralImpl) parsed).getValue()); } } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this, cclass, "postProcessSelectorTree", "No post processing can be done on: " + parsed); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "postProcessSelectorTree"); }
[ "private", "void", "postProcessSelectorTree", "(", "Selector", "parsed", ",", "String", "fullPath", ")", "throws", "InvalidXPathSyntaxException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"postProcessSelectorTree\"", ",", "\"parsed: \"", "+", "parsed", "+", "\", fullPath: \"", "+", "fullPath", ")", ";", "// Walk the selector tree looking for Identifiers", "if", "(", "parsed", "instanceof", "IdentifierImpl", ")", "{", "IdentifierImpl", "parsedIdentifier", "=", "(", "IdentifierImpl", ")", "parsed", ";", "String", "identName", "=", "parsedIdentifier", ".", "getName", "(", ")", ";", "// Reinstate any ampersands and slashes that were removed prior to", "// parsing", "String", "newIdentName", "=", "replaceSubForSpecials", "(", "identName", ")", ";", "if", "(", "newIdentName", "!=", "null", ")", "{", "parsedIdentifier", ".", "setName", "(", "newIdentName", ")", ";", "parsedIdentifier", ".", "setFullName", "(", "fullPath", "+", "newIdentName", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "tc", ".", "debug", "(", "this", ",", "cclass", ",", "\"postProcessSelectorTree\"", ",", "\"Identifier name has been reset to: \"", "+", "(", "(", "IdentifierImpl", ")", "parsed", ")", ".", "getName", "(", ")", ")", ";", "}", "else", "{", "// Set the full path name into the identifier", "parsedIdentifier", ".", "setFullName", "(", "fullPath", "+", "identName", ")", ";", "}", "// Set the appropriate XPath parameters for this Identifier", "setXPathCharacteristics", "(", "(", "IdentifierImpl", ")", "parsed", ")", ";", "}", "else", "if", "(", "parsed", "instanceof", "OperatorImpl", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "tc", ".", "debug", "(", "this", ",", "cclass", ",", "\"postProcessSelectorTree\"", ",", "parsed", "+", "\" is an OperatorImpl\"", ")", ";", "// Set the extended flag in the Operator", "parsed", ".", "setExtended", "(", ")", ";", "postProcessOperands", "(", "(", "OperatorImpl", ")", "parsed", ",", "fullPath", ")", ";", "}", "else", "if", "(", "parsed", "instanceof", "LiteralImpl", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "tc", ".", "debug", "(", "this", ",", "cclass", ",", "\"postProcessSelectorTree\"", ",", "parsed", "+", "\" is an LiteralImpl\"", ")", ";", "LiteralImpl", "literal", "=", "(", "LiteralImpl", ")", "parsed", ";", "if", "(", "literal", ".", "getType", "(", ")", "==", "Selector", ".", "STRING", ")", "{", "// Reinstate any ampersands and slashes that were removed prior to", "// parsing ", "String", "literalString", "=", "(", "String", ")", "literal", ".", "getValue", "(", ")", ";", "String", "newLiteralString", "=", "replaceSubForSpecials", "(", "literalString", ")", ";", "if", "(", "newLiteralString", "!=", "null", ")", "{", "(", "(", "LiteralImpl", ")", "parsed", ")", ".", "value", "=", "newLiteralString", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "tc", ".", "debug", "(", "this", ",", "cclass", ",", "\"postProcessSelectorTree\"", ",", "\"Literal Value has been reset to: \"", "+", "(", "(", "LiteralImpl", ")", "parsed", ")", ".", "getValue", "(", ")", ")", ";", "}", "}", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "tc", ".", "debug", "(", "this", ",", "cclass", ",", "\"postProcessSelectorTree\"", ",", "\"No post processing can be done on: \"", "+", "parsed", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "this", ",", "cclass", ",", "\"postProcessSelectorTree\"", ")", ";", "}" ]
Handle special character substitution. @param parsed @throws InvalidXPathSyntaxException
[ "Handle", "special", "character", "substitution", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java#L778-L865
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java
XPath10ParserImpl.postProcessOperands
private void postProcessOperands(OperatorImpl opImpl, String fullPath) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "postProcessOperands", "opImpl: " + opImpl + ", fullPath: " + fullPath); // Check for Identifiers with ampersand strings for(int i = 0; i< opImpl.operands.length; i++) { Selector sel = opImpl.operands[i]; postProcessSelectorTree(sel, fullPath); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "postProcessOperands"); }
java
private void postProcessOperands(OperatorImpl opImpl, String fullPath) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "postProcessOperands", "opImpl: " + opImpl + ", fullPath: " + fullPath); // Check for Identifiers with ampersand strings for(int i = 0; i< opImpl.operands.length; i++) { Selector sel = opImpl.operands[i]; postProcessSelectorTree(sel, fullPath); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "postProcessOperands"); }
[ "private", "void", "postProcessOperands", "(", "OperatorImpl", "opImpl", ",", "String", "fullPath", ")", "throws", "InvalidXPathSyntaxException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"postProcessOperands\"", ",", "\"opImpl: \"", "+", "opImpl", "+", "\", fullPath: \"", "+", "fullPath", ")", ";", "// Check for Identifiers with ampersand strings", "for", "(", "int", "i", "=", "0", ";", "i", "<", "opImpl", ".", "operands", ".", "length", ";", "i", "++", ")", "{", "Selector", "sel", "=", "opImpl", ".", "operands", "[", "i", "]", ";", "postProcessSelectorTree", "(", "sel", ",", "fullPath", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "this", ",", "cclass", ",", "\"postProcessOperands\"", ")", ";", "}" ]
Traverse an Operator tree handling special character substitution. @param opImpl @throws InvalidXPathSyntaxException
[ "Traverse", "an", "Operator", "tree", "handling", "special", "character", "substitution", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java#L873-L888
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java
XPath10ParserImpl.replaceSpecialsWithSub
private String replaceSpecialsWithSub(String inString) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "replaceSpecialsWithSub", "inString: " + inString); String outString = null; StringBuffer sb = null; // First of all look for ampersands int posAmpersand = inString.indexOf("@"); if(posAmpersand >=0) { // Need to do some work, the predicate has an attribute char sb = new StringBuffer(inString); } // Locate and replace the ampersands while(posAmpersand >=0) { // Replace the ampersand with "_$AMP$_" sb.replace(posAmpersand, posAmpersand + 1, "_$AMP$_"); int start = posAmpersand + 1; posAmpersand = sb.indexOf("@", start); } // Now look for slashes int posSlash = inString.indexOf("/"); if(posSlash >=0 && sb == null) { // Need to do some work, the predicate has an attribute char sb = new StringBuffer(inString); } // Locate and replace the slashes while(posSlash >=0) { // Replace the slash with "_$SL$_" sb.replace(posSlash, posSlash + 1, "_$SL$_"); int start = posSlash + 1; posSlash = sb.indexOf("/", start); } // Now look for doubledots int posDD = inString.indexOf(".."); if(posDD >=0 && sb == null) { // Need to do some work, the predicate has an attribute char sb = new StringBuffer(inString); } // Locate and replace the doubledots while(posDD >=0) { // Replace the slash with "_$DD$_" sb.replace(posDD, posDD + 2, "_$DD$_"); int start = posDD + 1; posDD = sb.indexOf("..", start); } // Now look for singledots int posSD = -1; if(sb != null) posSD = sb.indexOf("."); else { posSD = inString.indexOf("."); if(posSD >=0) { // Need to do some work, the predicate has an attribute char sb = new StringBuffer(inString); } } // Locate and replace the singledots while(posSD >=0) { // Move start position to beyond the current dot int start = posSD + 1; // Need to be a bit careful here, we don't want to replace // decimal points if( start < sb.length() && Character.isDigit(sb.charAt(posSD+1))) { // Subsequent char is a digit posSD = -1; } else { // Test previous char if(posSD > 0) { if( Character.isDigit(sb.charAt(posSD-1))) { // Prev char is a digit posSD = -1; } } } // Replace the dot with "_$SD$_" if(posSD >= 0) { sb.replace(posSD, posSD + 1, "_$SD$_"); } // Any more dots? posSD = sb.indexOf(".", start); } // We've finished if (sb != null) { outString = sb.toString(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "replaceSpecialsWithSub", outString); return outString; }
java
private String replaceSpecialsWithSub(String inString) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "replaceSpecialsWithSub", "inString: " + inString); String outString = null; StringBuffer sb = null; // First of all look for ampersands int posAmpersand = inString.indexOf("@"); if(posAmpersand >=0) { // Need to do some work, the predicate has an attribute char sb = new StringBuffer(inString); } // Locate and replace the ampersands while(posAmpersand >=0) { // Replace the ampersand with "_$AMP$_" sb.replace(posAmpersand, posAmpersand + 1, "_$AMP$_"); int start = posAmpersand + 1; posAmpersand = sb.indexOf("@", start); } // Now look for slashes int posSlash = inString.indexOf("/"); if(posSlash >=0 && sb == null) { // Need to do some work, the predicate has an attribute char sb = new StringBuffer(inString); } // Locate and replace the slashes while(posSlash >=0) { // Replace the slash with "_$SL$_" sb.replace(posSlash, posSlash + 1, "_$SL$_"); int start = posSlash + 1; posSlash = sb.indexOf("/", start); } // Now look for doubledots int posDD = inString.indexOf(".."); if(posDD >=0 && sb == null) { // Need to do some work, the predicate has an attribute char sb = new StringBuffer(inString); } // Locate and replace the doubledots while(posDD >=0) { // Replace the slash with "_$DD$_" sb.replace(posDD, posDD + 2, "_$DD$_"); int start = posDD + 1; posDD = sb.indexOf("..", start); } // Now look for singledots int posSD = -1; if(sb != null) posSD = sb.indexOf("."); else { posSD = inString.indexOf("."); if(posSD >=0) { // Need to do some work, the predicate has an attribute char sb = new StringBuffer(inString); } } // Locate and replace the singledots while(posSD >=0) { // Move start position to beyond the current dot int start = posSD + 1; // Need to be a bit careful here, we don't want to replace // decimal points if( start < sb.length() && Character.isDigit(sb.charAt(posSD+1))) { // Subsequent char is a digit posSD = -1; } else { // Test previous char if(posSD > 0) { if( Character.isDigit(sb.charAt(posSD-1))) { // Prev char is a digit posSD = -1; } } } // Replace the dot with "_$SD$_" if(posSD >= 0) { sb.replace(posSD, posSD + 1, "_$SD$_"); } // Any more dots? posSD = sb.indexOf(".", start); } // We've finished if (sb != null) { outString = sb.toString(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "replaceSpecialsWithSub", outString); return outString; }
[ "private", "String", "replaceSpecialsWithSub", "(", "String", "inString", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"replaceSpecialsWithSub\"", ",", "\"inString: \"", "+", "inString", ")", ";", "String", "outString", "=", "null", ";", "StringBuffer", "sb", "=", "null", ";", "// First of all look for ampersands", "int", "posAmpersand", "=", "inString", ".", "indexOf", "(", "\"@\"", ")", ";", "if", "(", "posAmpersand", ">=", "0", ")", "{", "// Need to do some work, the predicate has an attribute char", "sb", "=", "new", "StringBuffer", "(", "inString", ")", ";", "}", "// Locate and replace the ampersands", "while", "(", "posAmpersand", ">=", "0", ")", "{", "// Replace the ampersand with \"_$AMP$_\"", "sb", ".", "replace", "(", "posAmpersand", ",", "posAmpersand", "+", "1", ",", "\"_$AMP$_\"", ")", ";", "int", "start", "=", "posAmpersand", "+", "1", ";", "posAmpersand", "=", "sb", ".", "indexOf", "(", "\"@\"", ",", "start", ")", ";", "}", "// Now look for slashes", "int", "posSlash", "=", "inString", ".", "indexOf", "(", "\"/\"", ")", ";", "if", "(", "posSlash", ">=", "0", "&&", "sb", "==", "null", ")", "{", "// Need to do some work, the predicate has an attribute char", "sb", "=", "new", "StringBuffer", "(", "inString", ")", ";", "}", "// Locate and replace the slashes", "while", "(", "posSlash", ">=", "0", ")", "{", "// Replace the slash with \"_$SL$_\"", "sb", ".", "replace", "(", "posSlash", ",", "posSlash", "+", "1", ",", "\"_$SL$_\"", ")", ";", "int", "start", "=", "posSlash", "+", "1", ";", "posSlash", "=", "sb", ".", "indexOf", "(", "\"/\"", ",", "start", ")", ";", "}", "// Now look for doubledots", "int", "posDD", "=", "inString", ".", "indexOf", "(", "\"..\"", ")", ";", "if", "(", "posDD", ">=", "0", "&&", "sb", "==", "null", ")", "{", "// Need to do some work, the predicate has an attribute char", "sb", "=", "new", "StringBuffer", "(", "inString", ")", ";", "}", "// Locate and replace the doubledots", "while", "(", "posDD", ">=", "0", ")", "{", "// Replace the slash with \"_$DD$_\"", "sb", ".", "replace", "(", "posDD", ",", "posDD", "+", "2", ",", "\"_$DD$_\"", ")", ";", "int", "start", "=", "posDD", "+", "1", ";", "posDD", "=", "sb", ".", "indexOf", "(", "\"..\"", ",", "start", ")", ";", "}", "// Now look for singledots", "int", "posSD", "=", "-", "1", ";", "if", "(", "sb", "!=", "null", ")", "posSD", "=", "sb", ".", "indexOf", "(", "\".\"", ")", ";", "else", "{", "posSD", "=", "inString", ".", "indexOf", "(", "\".\"", ")", ";", "if", "(", "posSD", ">=", "0", ")", "{", "// Need to do some work, the predicate has an attribute char", "sb", "=", "new", "StringBuffer", "(", "inString", ")", ";", "}", "}", "// Locate and replace the singledots", "while", "(", "posSD", ">=", "0", ")", "{", "// Move start position to beyond the current dot", "int", "start", "=", "posSD", "+", "1", ";", "// Need to be a bit careful here, we don't want to replace", "// decimal points", "if", "(", "start", "<", "sb", ".", "length", "(", ")", "&&", "Character", ".", "isDigit", "(", "sb", ".", "charAt", "(", "posSD", "+", "1", ")", ")", ")", "{", "// Subsequent char is a digit", "posSD", "=", "-", "1", ";", "}", "else", "{", "// Test previous char", "if", "(", "posSD", ">", "0", ")", "{", "if", "(", "Character", ".", "isDigit", "(", "sb", ".", "charAt", "(", "posSD", "-", "1", ")", ")", ")", "{", "// Prev char is a digit", "posSD", "=", "-", "1", ";", "}", "}", "}", "// Replace the dot with \"_$SD$_\" ", "if", "(", "posSD", ">=", "0", ")", "{", "sb", ".", "replace", "(", "posSD", ",", "posSD", "+", "1", ",", "\"_$SD$_\"", ")", ";", "}", "// Any more dots?", "posSD", "=", "sb", ".", "indexOf", "(", "\".\"", ",", "start", ")", ";", "}", "// We've finished", "if", "(", "sb", "!=", "null", ")", "{", "outString", "=", "sb", ".", "toString", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "this", ",", "cclass", ",", "\"replaceSpecialsWithSub\"", ",", "outString", ")", ";", "return", "outString", ";", "}" ]
Replace special characters in the string with substitutions. @param inString @return
[ "Replace", "special", "characters", "in", "the", "string", "with", "substitutions", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java#L896-L1015
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java
XPath10ParserImpl.replaceSubForSpecials
private String replaceSubForSpecials(String inString) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "replaceSubForSpecials", "inString: " + inString); String outString = null; StringBuffer sb = null; // First deal with ampersands int posAmpersand = inString.indexOf("_$AMP$_"); if(posAmpersand >=0) { // Need to do some work, the string has an attribute char sb = new StringBuffer(inString); } // Locate and replace the ampersand substitute while(posAmpersand >=0) { // Replace the "_$AMP$_" with an ampersand sb.replace(posAmpersand, posAmpersand + 7, "@"); int start = posAmpersand + 1; posAmpersand = sb.indexOf("_$AMP$_", start); } // Now deal with slashes int posSlash = inString.indexOf("_$SL$_"); if(posSlash >=0 && sb == null) { // Need to do some work, the string has a slash char sb = new StringBuffer(inString); } // Locate and replace the slash substitute while(posSlash >=0) { // Replace the "_$SL$_" with a slash sb.replace(posSlash, posSlash + 6, "/"); int start = posSlash + 1; posSlash = sb.indexOf("_$SL$_", start); } // Now deal with doubledots int posDD = inString.indexOf("_$DD$_"); if(posDD >=0 && sb == null) { // Need to do some work, the string has a slash char sb = new StringBuffer(inString); } // Locate and replace the doubledot substitute while(posDD >=0) { // Replace the "_$DD$_" with a doubledot sb.replace(posDD, posDD + 6, ".."); int start = posDD + 2; posDD = sb.indexOf("_$DD$_", start); } // Now deal with singledots int posSD = inString.indexOf("_$SD$_"); if(posSD >=0 && sb == null) { // Need to do some work, the string has a slash char sb = new StringBuffer(inString); } // Locate and replace the singledot substitute while(posSD >=0) { // Replace the "_$SD$_" with a dot sb.replace(posSD, posSD + 6, "."); int start = posSD + 1; posSD = sb.indexOf("_$SD$_", start); } // We're finished if (sb != null) { outString = sb.toString(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "replaceSubForSpecials", outString); return outString; }
java
private String replaceSubForSpecials(String inString) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "replaceSubForSpecials", "inString: " + inString); String outString = null; StringBuffer sb = null; // First deal with ampersands int posAmpersand = inString.indexOf("_$AMP$_"); if(posAmpersand >=0) { // Need to do some work, the string has an attribute char sb = new StringBuffer(inString); } // Locate and replace the ampersand substitute while(posAmpersand >=0) { // Replace the "_$AMP$_" with an ampersand sb.replace(posAmpersand, posAmpersand + 7, "@"); int start = posAmpersand + 1; posAmpersand = sb.indexOf("_$AMP$_", start); } // Now deal with slashes int posSlash = inString.indexOf("_$SL$_"); if(posSlash >=0 && sb == null) { // Need to do some work, the string has a slash char sb = new StringBuffer(inString); } // Locate and replace the slash substitute while(posSlash >=0) { // Replace the "_$SL$_" with a slash sb.replace(posSlash, posSlash + 6, "/"); int start = posSlash + 1; posSlash = sb.indexOf("_$SL$_", start); } // Now deal with doubledots int posDD = inString.indexOf("_$DD$_"); if(posDD >=0 && sb == null) { // Need to do some work, the string has a slash char sb = new StringBuffer(inString); } // Locate and replace the doubledot substitute while(posDD >=0) { // Replace the "_$DD$_" with a doubledot sb.replace(posDD, posDD + 6, ".."); int start = posDD + 2; posDD = sb.indexOf("_$DD$_", start); } // Now deal with singledots int posSD = inString.indexOf("_$SD$_"); if(posSD >=0 && sb == null) { // Need to do some work, the string has a slash char sb = new StringBuffer(inString); } // Locate and replace the singledot substitute while(posSD >=0) { // Replace the "_$SD$_" with a dot sb.replace(posSD, posSD + 6, "."); int start = posSD + 1; posSD = sb.indexOf("_$SD$_", start); } // We're finished if (sb != null) { outString = sb.toString(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "replaceSubForSpecials", outString); return outString; }
[ "private", "String", "replaceSubForSpecials", "(", "String", "inString", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"replaceSubForSpecials\"", ",", "\"inString: \"", "+", "inString", ")", ";", "String", "outString", "=", "null", ";", "StringBuffer", "sb", "=", "null", ";", "// First deal with ampersands", "int", "posAmpersand", "=", "inString", ".", "indexOf", "(", "\"_$AMP$_\"", ")", ";", "if", "(", "posAmpersand", ">=", "0", ")", "{", "// Need to do some work, the string has an attribute char", "sb", "=", "new", "StringBuffer", "(", "inString", ")", ";", "}", "// Locate and replace the ampersand substitute", "while", "(", "posAmpersand", ">=", "0", ")", "{", "// Replace the \"_$AMP$_\" with an ampersand", "sb", ".", "replace", "(", "posAmpersand", ",", "posAmpersand", "+", "7", ",", "\"@\"", ")", ";", "int", "start", "=", "posAmpersand", "+", "1", ";", "posAmpersand", "=", "sb", ".", "indexOf", "(", "\"_$AMP$_\"", ",", "start", ")", ";", "}", "// Now deal with slashes", "int", "posSlash", "=", "inString", ".", "indexOf", "(", "\"_$SL$_\"", ")", ";", "if", "(", "posSlash", ">=", "0", "&&", "sb", "==", "null", ")", "{", "// Need to do some work, the string has a slash char", "sb", "=", "new", "StringBuffer", "(", "inString", ")", ";", "}", "// Locate and replace the slash substitute", "while", "(", "posSlash", ">=", "0", ")", "{", "// Replace the \"_$SL$_\" with a slash", "sb", ".", "replace", "(", "posSlash", ",", "posSlash", "+", "6", ",", "\"/\"", ")", ";", "int", "start", "=", "posSlash", "+", "1", ";", "posSlash", "=", "sb", ".", "indexOf", "(", "\"_$SL$_\"", ",", "start", ")", ";", "}", "// Now deal with doubledots", "int", "posDD", "=", "inString", ".", "indexOf", "(", "\"_$DD$_\"", ")", ";", "if", "(", "posDD", ">=", "0", "&&", "sb", "==", "null", ")", "{", "// Need to do some work, the string has a slash char", "sb", "=", "new", "StringBuffer", "(", "inString", ")", ";", "}", "// Locate and replace the doubledot substitute", "while", "(", "posDD", ">=", "0", ")", "{", "// Replace the \"_$DD$_\" with a doubledot", "sb", ".", "replace", "(", "posDD", ",", "posDD", "+", "6", ",", "\"..\"", ")", ";", "int", "start", "=", "posDD", "+", "2", ";", "posDD", "=", "sb", ".", "indexOf", "(", "\"_$DD$_\"", ",", "start", ")", ";", "}", "// Now deal with singledots", "int", "posSD", "=", "inString", ".", "indexOf", "(", "\"_$SD$_\"", ")", ";", "if", "(", "posSD", ">=", "0", "&&", "sb", "==", "null", ")", "{", "// Need to do some work, the string has a slash char", "sb", "=", "new", "StringBuffer", "(", "inString", ")", ";", "}", "// Locate and replace the singledot substitute", "while", "(", "posSD", ">=", "0", ")", "{", "// Replace the \"_$SD$_\" with a dot", "sb", ".", "replace", "(", "posSD", ",", "posSD", "+", "6", ",", "\".\"", ")", ";", "int", "start", "=", "posSD", "+", "1", ";", "posSD", "=", "sb", ".", "indexOf", "(", "\"_$SD$_\"", ",", "start", ")", ";", "}", "// We're finished", "if", "(", "sb", "!=", "null", ")", "{", "outString", "=", "sb", ".", "toString", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "this", ",", "cclass", ",", "\"replaceSubForSpecials\"", ",", "outString", ")", ";", "return", "outString", ";", "}" ]
Replace substitutions in the string with the original special characters. @param inString @return
[ "Replace", "substitutions", "in", "the", "string", "with", "the", "original", "special", "characters", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java#L1023-L1113
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java
XPath10ParserImpl.wrapLocationStep
private void wrapLocationStep(String selector, int start, int stepEnd) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "wrapLocationStep", "selector: " + selector + ", start: " + start + ", stepEnd: " + stepEnd); String step = selector.substring(start,stepEnd); String full = selector.substring(0,stepEnd); // Add an IdentifierImpl for the location step to the array list selOperands.add(createIdentifierForSubExpression(step, full, true, false)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "wrapLocationStep"); }
java
private void wrapLocationStep(String selector, int start, int stepEnd) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "wrapLocationStep", "selector: " + selector + ", start: " + start + ", stepEnd: " + stepEnd); String step = selector.substring(start,stepEnd); String full = selector.substring(0,stepEnd); // Add an IdentifierImpl for the location step to the array list selOperands.add(createIdentifierForSubExpression(step, full, true, false)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "wrapLocationStep"); }
[ "private", "void", "wrapLocationStep", "(", "String", "selector", ",", "int", "start", ",", "int", "stepEnd", ")", "throws", "InvalidXPathSyntaxException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"wrapLocationStep\"", ",", "\"selector: \"", "+", "selector", "+", "\", start: \"", "+", "start", "+", "\", stepEnd: \"", "+", "stepEnd", ")", ";", "String", "step", "=", "selector", ".", "substring", "(", "start", ",", "stepEnd", ")", ";", "String", "full", "=", "selector", ".", "substring", "(", "0", ",", "stepEnd", ")", ";", "// Add an IdentifierImpl for the location step to the array list", "selOperands", ".", "add", "(", "createIdentifierForSubExpression", "(", "step", ",", "full", ",", "true", ",", "false", ")", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "this", ",", "cclass", ",", "\"wrapLocationStep\"", ")", ";", "}" ]
Wrap a location step in an Identifier. @param selector @param start @param stepEnd @throws InvalidXPathSyntaxException
[ "Wrap", "a", "location", "step", "in", "an", "Identifier", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java#L1386-L1403
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java
XPath10ParserImpl.wrapLastLocationStep
private void wrapLastLocationStep(String selector, int start, boolean bumpLocationStep) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "wrapLastLocationStep", "selector: " + selector + ", start: " + start + ", bumpLocationStep: " + new Boolean(bumpLocationStep)); int stepEnd = selector.length(); String step = selector.substring(start,stepEnd); String full = selector.substring(0,stepEnd); // Add an IdentifierImpl for the location step to the array list selOperands.add(createIdentifierForSubExpression(step, full, bumpLocationStep, true)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "wrapLastLocationStep"); }
java
private void wrapLastLocationStep(String selector, int start, boolean bumpLocationStep) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "wrapLastLocationStep", "selector: " + selector + ", start: " + start + ", bumpLocationStep: " + new Boolean(bumpLocationStep)); int stepEnd = selector.length(); String step = selector.substring(start,stepEnd); String full = selector.substring(0,stepEnd); // Add an IdentifierImpl for the location step to the array list selOperands.add(createIdentifierForSubExpression(step, full, bumpLocationStep, true)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "wrapLastLocationStep"); }
[ "private", "void", "wrapLastLocationStep", "(", "String", "selector", ",", "int", "start", ",", "boolean", "bumpLocationStep", ")", "throws", "InvalidXPathSyntaxException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"wrapLastLocationStep\"", ",", "\"selector: \"", "+", "selector", "+", "\", start: \"", "+", "start", "+", "\", bumpLocationStep: \"", "+", "new", "Boolean", "(", "bumpLocationStep", ")", ")", ";", "int", "stepEnd", "=", "selector", ".", "length", "(", ")", ";", "String", "step", "=", "selector", ".", "substring", "(", "start", ",", "stepEnd", ")", ";", "String", "full", "=", "selector", ".", "substring", "(", "0", ",", "stepEnd", ")", ";", "// Add an IdentifierImpl for the location step to the array list", "selOperands", ".", "add", "(", "createIdentifierForSubExpression", "(", "step", ",", "full", ",", "bumpLocationStep", ",", "true", ")", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "this", ",", "cclass", ",", "\"wrapLastLocationStep\"", ")", ";", "}" ]
Wrap the last location step in an Identifier. @param selector @param start @param bumpLocationStep @throws InvalidXPathSyntaxException
[ "Wrap", "the", "last", "location", "step", "in", "an", "Identifier", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java#L1413-L1432
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainGroupDataImpl.java
ChainGroupDataImpl.addChain
public void addChain(ChainData newChain) throws ChainException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "addChain: " + newChain.getName()); } if (containsChain(newChain.getName())) { ChainException e = new ChainException("Chain already exists: " + newChain.getName()); FFDCFilter.processException(e, getClass().getName() + ".addChain", "116", this, new Object[] { newChain }); throw e; } // Create a chain array that is one element bigger than the current one. int currentLength = this.chainArray.length; ChainData[] newChains = new ChainData[currentLength + 1]; // Copy the existing elements to the new array. System.arraycopy(getChains(), 0, newChains, 0, currentLength); // Add the new chain to the end of the new list. newChains[currentLength] = newChain; // Update this group's chain list setChains(newChains); // Add all group listeners to this chain. If some already exist, // this doesn't break anything. for (ChainEventListener listener : getChainEventListeners()) { ((ChainDataImpl) newChain).addChainEventListener(listener); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addChain"); } }
java
public void addChain(ChainData newChain) throws ChainException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "addChain: " + newChain.getName()); } if (containsChain(newChain.getName())) { ChainException e = new ChainException("Chain already exists: " + newChain.getName()); FFDCFilter.processException(e, getClass().getName() + ".addChain", "116", this, new Object[] { newChain }); throw e; } // Create a chain array that is one element bigger than the current one. int currentLength = this.chainArray.length; ChainData[] newChains = new ChainData[currentLength + 1]; // Copy the existing elements to the new array. System.arraycopy(getChains(), 0, newChains, 0, currentLength); // Add the new chain to the end of the new list. newChains[currentLength] = newChain; // Update this group's chain list setChains(newChains); // Add all group listeners to this chain. If some already exist, // this doesn't break anything. for (ChainEventListener listener : getChainEventListeners()) { ((ChainDataImpl) newChain).addChainEventListener(listener); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addChain"); } }
[ "public", "void", "addChain", "(", "ChainData", "newChain", ")", "throws", "ChainException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"addChain: \"", "+", "newChain", ".", "getName", "(", ")", ")", ";", "}", "if", "(", "containsChain", "(", "newChain", ".", "getName", "(", ")", ")", ")", "{", "ChainException", "e", "=", "new", "ChainException", "(", "\"Chain already exists: \"", "+", "newChain", ".", "getName", "(", ")", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".addChain\"", ",", "\"116\"", ",", "this", ",", "new", "Object", "[", "]", "{", "newChain", "}", ")", ";", "throw", "e", ";", "}", "// Create a chain array that is one element bigger than the current one.", "int", "currentLength", "=", "this", ".", "chainArray", ".", "length", ";", "ChainData", "[", "]", "newChains", "=", "new", "ChainData", "[", "currentLength", "+", "1", "]", ";", "// Copy the existing elements to the new array.", "System", ".", "arraycopy", "(", "getChains", "(", ")", ",", "0", ",", "newChains", ",", "0", ",", "currentLength", ")", ";", "// Add the new chain to the end of the new list.", "newChains", "[", "currentLength", "]", "=", "newChain", ";", "// Update this group's chain list", "setChains", "(", "newChains", ")", ";", "// Add all group listeners to this chain. If some already exist,", "// this doesn't break anything.", "for", "(", "ChainEventListener", "listener", ":", "getChainEventListeners", "(", ")", ")", "{", "(", "(", "ChainDataImpl", ")", "newChain", ")", ".", "addChainEventListener", "(", "listener", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"addChain\"", ")", ";", "}", "}" ]
Adds the input chain to the group. All chain event listeners associated with the group are also added to the chain. @param newChain @throws ChainException if chain already exists in group.
[ "Adds", "the", "input", "chain", "to", "the", "group", ".", "All", "chain", "event", "listeners", "associated", "with", "the", "group", "are", "also", "added", "to", "the", "chain", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainGroupDataImpl.java#L112-L141
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainGroupDataImpl.java
ChainGroupDataImpl.removeChain
public void removeChain(ChainData inputChain) throws ChainException { String chainname = inputChain.getName(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "removeChain: " + chainname); } if (!containsChain(chainname)) { ChainException e = new ChainException("Unable to find chain: " + chainname); FFDCFilter.processException(e, getClass().getName() + ".removeChain", "157", this, new Object[] { inputChain, this.framework }); throw e; } // Create a chain array that is one element smaller than the current one. int currentLength = this.chainArray.length; ChainData[] newChains = new ChainData[currentLength - 1]; // Copy all but the input chain into the new array. for (int i = 0; i < currentLength; i++) { if (!chainname.equals(this.chainArray[i].getName())) { newChains[i] = this.chainArray[i]; } } // Update this group's chain list. setChains(newChains); // Remove group associated listeners from the chain, only if not // associated with other group. for (ChainEventListener listener : getChainEventListeners()) { removeListenerFromChain(listener, inputChain); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "removeChain"); } }
java
public void removeChain(ChainData inputChain) throws ChainException { String chainname = inputChain.getName(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "removeChain: " + chainname); } if (!containsChain(chainname)) { ChainException e = new ChainException("Unable to find chain: " + chainname); FFDCFilter.processException(e, getClass().getName() + ".removeChain", "157", this, new Object[] { inputChain, this.framework }); throw e; } // Create a chain array that is one element smaller than the current one. int currentLength = this.chainArray.length; ChainData[] newChains = new ChainData[currentLength - 1]; // Copy all but the input chain into the new array. for (int i = 0; i < currentLength; i++) { if (!chainname.equals(this.chainArray[i].getName())) { newChains[i] = this.chainArray[i]; } } // Update this group's chain list. setChains(newChains); // Remove group associated listeners from the chain, only if not // associated with other group. for (ChainEventListener listener : getChainEventListeners()) { removeListenerFromChain(listener, inputChain); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "removeChain"); } }
[ "public", "void", "removeChain", "(", "ChainData", "inputChain", ")", "throws", "ChainException", "{", "String", "chainname", "=", "inputChain", ".", "getName", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"removeChain: \"", "+", "chainname", ")", ";", "}", "if", "(", "!", "containsChain", "(", "chainname", ")", ")", "{", "ChainException", "e", "=", "new", "ChainException", "(", "\"Unable to find chain: \"", "+", "chainname", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".removeChain\"", ",", "\"157\"", ",", "this", ",", "new", "Object", "[", "]", "{", "inputChain", ",", "this", ".", "framework", "}", ")", ";", "throw", "e", ";", "}", "// Create a chain array that is one element smaller than the current one.", "int", "currentLength", "=", "this", ".", "chainArray", ".", "length", ";", "ChainData", "[", "]", "newChains", "=", "new", "ChainData", "[", "currentLength", "-", "1", "]", ";", "// Copy all but the input chain into the new array.", "for", "(", "int", "i", "=", "0", ";", "i", "<", "currentLength", ";", "i", "++", ")", "{", "if", "(", "!", "chainname", ".", "equals", "(", "this", ".", "chainArray", "[", "i", "]", ".", "getName", "(", ")", ")", ")", "{", "newChains", "[", "i", "]", "=", "this", ".", "chainArray", "[", "i", "]", ";", "}", "}", "// Update this group's chain list.", "setChains", "(", "newChains", ")", ";", "// Remove group associated listeners from the chain, only if not", "// associated with other group.", "for", "(", "ChainEventListener", "listener", ":", "getChainEventListeners", "(", ")", ")", "{", "removeListenerFromChain", "(", "listener", ",", "inputChain", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"removeChain\"", ")", ";", "}", "}" ]
Removes the input chain from the group. All group chain event listeners all also removed from the chain unless the chain is in another group which is associated with the listener. @param inputChain chain object to be removed. @throws ChainException if chain doesn't exist in group.
[ "Removes", "the", "input", "chain", "from", "the", "group", ".", "All", "group", "chain", "event", "listeners", "all", "also", "removed", "from", "the", "chain", "unless", "the", "chain", "is", "in", "another", "group", "which", "is", "associated", "with", "the", "listener", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainGroupDataImpl.java#L153-L185
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainGroupDataImpl.java
ChainGroupDataImpl.updateChain
public void updateChain(ChainData inputChain) { String chainname = inputChain.getName(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "updateChain: " + chainname); } // Find the chain in the group. for (int i = 0; i < this.chainArray.length; i++) { if (chainname.equals(this.chainArray[i].getName())) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Updating chain " + chainname + " in group " + getName()); } // Found the chain. Update the array with the new data. this.chainArray[i] = inputChain; break; } } }
java
public void updateChain(ChainData inputChain) { String chainname = inputChain.getName(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "updateChain: " + chainname); } // Find the chain in the group. for (int i = 0; i < this.chainArray.length; i++) { if (chainname.equals(this.chainArray[i].getName())) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Updating chain " + chainname + " in group " + getName()); } // Found the chain. Update the array with the new data. this.chainArray[i] = inputChain; break; } } }
[ "public", "void", "updateChain", "(", "ChainData", "inputChain", ")", "{", "String", "chainname", "=", "inputChain", ".", "getName", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"updateChain: \"", "+", "chainname", ")", ";", "}", "// Find the chain in the group.", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "chainArray", ".", "length", ";", "i", "++", ")", "{", "if", "(", "chainname", ".", "equals", "(", "this", ".", "chainArray", "[", "i", "]", ".", "getName", "(", ")", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Updating chain \"", "+", "chainname", "+", "\" in group \"", "+", "getName", "(", ")", ")", ";", "}", "// Found the chain. Update the array with the new data.", "this", ".", "chainArray", "[", "i", "]", "=", "inputChain", ";", "break", ";", "}", "}", "}" ]
Search the group for the input chain. If found, update it. Otherwise do nothing. @param inputChain
[ "Search", "the", "group", "for", "the", "input", "chain", ".", "If", "found", "update", "it", ".", "Otherwise", "do", "nothing", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainGroupDataImpl.java#L193-L210
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainGroupDataImpl.java
ChainGroupDataImpl.removeListenerFromChain
private void removeListenerFromChain(ChainEventListener listener, ChainData chainData) { ChainGroupData[] otherGroups = null; boolean foundOtherGroupWithListener = false; // Extract the groups that this chain is involved in. try { otherGroups = this.framework.getAllChainGroups(chainData.getName()); foundOtherGroupWithListener = false; int i = 0; for (i = 0; i < otherGroups.length; i++) { if (((ChainGroupDataImpl) otherGroups[i]).containsChainEventListener(listener)) { // Chain is in another group that has this listener. foundOtherGroupWithListener = true; break; } } if (!foundOtherGroupWithListener) { // Chain is NOT in another group that has this listener, so listener can // be removed. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Removing listener from chain config, " + chainData.getName()); } ((ChainDataImpl) chainData).removeChainEventListener(listener); } else { // Chain was found in another group with this listener if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found chain " + chainData.getName() + " in another group, " + otherGroups[i].getName()); } } } catch (ChainException e) { // This shouldn't ever happen, but in case it does, we know no refs were // found. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Chain not found in config: " + chainData.getName() + ", but will remove listener."); } ((ChainDataImpl) chainData).removeChainEventListener(listener); } }
java
private void removeListenerFromChain(ChainEventListener listener, ChainData chainData) { ChainGroupData[] otherGroups = null; boolean foundOtherGroupWithListener = false; // Extract the groups that this chain is involved in. try { otherGroups = this.framework.getAllChainGroups(chainData.getName()); foundOtherGroupWithListener = false; int i = 0; for (i = 0; i < otherGroups.length; i++) { if (((ChainGroupDataImpl) otherGroups[i]).containsChainEventListener(listener)) { // Chain is in another group that has this listener. foundOtherGroupWithListener = true; break; } } if (!foundOtherGroupWithListener) { // Chain is NOT in another group that has this listener, so listener can // be removed. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Removing listener from chain config, " + chainData.getName()); } ((ChainDataImpl) chainData).removeChainEventListener(listener); } else { // Chain was found in another group with this listener if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found chain " + chainData.getName() + " in another group, " + otherGroups[i].getName()); } } } catch (ChainException e) { // This shouldn't ever happen, but in case it does, we know no refs were // found. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Chain not found in config: " + chainData.getName() + ", but will remove listener."); } ((ChainDataImpl) chainData).removeChainEventListener(listener); } }
[ "private", "void", "removeListenerFromChain", "(", "ChainEventListener", "listener", ",", "ChainData", "chainData", ")", "{", "ChainGroupData", "[", "]", "otherGroups", "=", "null", ";", "boolean", "foundOtherGroupWithListener", "=", "false", ";", "// Extract the groups that this chain is involved in.", "try", "{", "otherGroups", "=", "this", ".", "framework", ".", "getAllChainGroups", "(", "chainData", ".", "getName", "(", ")", ")", ";", "foundOtherGroupWithListener", "=", "false", ";", "int", "i", "=", "0", ";", "for", "(", "i", "=", "0", ";", "i", "<", "otherGroups", ".", "length", ";", "i", "++", ")", "{", "if", "(", "(", "(", "ChainGroupDataImpl", ")", "otherGroups", "[", "i", "]", ")", ".", "containsChainEventListener", "(", "listener", ")", ")", "{", "// Chain is in another group that has this listener.", "foundOtherGroupWithListener", "=", "true", ";", "break", ";", "}", "}", "if", "(", "!", "foundOtherGroupWithListener", ")", "{", "// Chain is NOT in another group that has this listener, so listener can", "// be removed.", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Removing listener from chain config, \"", "+", "chainData", ".", "getName", "(", ")", ")", ";", "}", "(", "(", "ChainDataImpl", ")", "chainData", ")", ".", "removeChainEventListener", "(", "listener", ")", ";", "}", "else", "{", "// Chain was found in another group with this listener", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Found chain \"", "+", "chainData", ".", "getName", "(", ")", "+", "\" in another group, \"", "+", "otherGroups", "[", "i", "]", ".", "getName", "(", ")", ")", ";", "}", "}", "}", "catch", "(", "ChainException", "e", ")", "{", "// This shouldn't ever happen, but in case it does, we know no refs were", "// found.", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Chain not found in config: \"", "+", "chainData", ".", "getName", "(", ")", "+", "\", but will remove listener.\"", ")", ";", "}", "(", "(", "ChainDataImpl", ")", "chainData", ")", ".", "removeChainEventListener", "(", "listener", ")", ";", "}", "}" ]
Remove the listener from the chain, but only if the chain is not associated with the listener through another group. @param listener chain event listener to be removed from the chain @param chainData chain from which to remove chain event listener
[ "Remove", "the", "listener", "from", "the", "chain", "but", "only", "if", "the", "chain", "is", "not", "associated", "with", "the", "listener", "through", "another", "group", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainGroupDataImpl.java#L248-L284
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainGroupDataImpl.java
ChainGroupDataImpl.addChainEventListener
public final void addChainEventListener(ChainEventListener listener) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "addChainEventListener: " + listener); } if ((null != listener) && (!getChainEventListeners().contains(listener))) { // Add the listener to the set monitored by this group. getChainEventListeners().add(listener); // Add the listener to each of the chains in this group. // Extract the chain data array from the group data object for (ChainData chain : getChains()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Adding listener to chain, " + chain.getName()); } ((ChainDataImpl) chain).addChainEventListener(listener); } } }
java
public final void addChainEventListener(ChainEventListener listener) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "addChainEventListener: " + listener); } if ((null != listener) && (!getChainEventListeners().contains(listener))) { // Add the listener to the set monitored by this group. getChainEventListeners().add(listener); // Add the listener to each of the chains in this group. // Extract the chain data array from the group data object for (ChainData chain : getChains()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Adding listener to chain, " + chain.getName()); } ((ChainDataImpl) chain).addChainEventListener(listener); } } }
[ "public", "final", "void", "addChainEventListener", "(", "ChainEventListener", "listener", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"addChainEventListener: \"", "+", "listener", ")", ";", "}", "if", "(", "(", "null", "!=", "listener", ")", "&&", "(", "!", "getChainEventListeners", "(", ")", ".", "contains", "(", "listener", ")", ")", ")", "{", "// Add the listener to the set monitored by this group.", "getChainEventListeners", "(", ")", ".", "add", "(", "listener", ")", ";", "// Add the listener to each of the chains in this group.", "// Extract the chain data array from the group data object", "for", "(", "ChainData", "chain", ":", "getChains", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Adding listener to chain, \"", "+", "chain", ".", "getName", "(", ")", ")", ";", "}", "(", "(", "ChainDataImpl", ")", "chain", ")", ".", "addChainEventListener", "(", "listener", ")", ";", "}", "}", "}" ]
Method addChainEventListener. Enables external entities to be notified of chain events on each of the chains in the group described in ChainEventListener interface. @param listener
[ "Method", "addChainEventListener", ".", "Enables", "external", "entities", "to", "be", "notified", "of", "chain", "events", "on", "each", "of", "the", "chains", "in", "the", "group", "described", "in", "ChainEventListener", "interface", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainGroupDataImpl.java#L293-L309
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainGroupDataImpl.java
ChainGroupDataImpl.removeChainEventListener
public final void removeChainEventListener(ChainEventListener listener) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "removeChainEventListener: " + listener); } if (null != listener) { // Remove the listener from the list monitored by this group. if (!getChainEventListeners().remove(listener)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Listener " + listener + " was not found in list monitored by group " + getName()); } } // Remove the listener from each of the chains in this group. for (ChainData chain : getChains()) { removeListenerFromChain(listener, chain); } } }
java
public final void removeChainEventListener(ChainEventListener listener) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "removeChainEventListener: " + listener); } if (null != listener) { // Remove the listener from the list monitored by this group. if (!getChainEventListeners().remove(listener)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Listener " + listener + " was not found in list monitored by group " + getName()); } } // Remove the listener from each of the chains in this group. for (ChainData chain : getChains()) { removeListenerFromChain(listener, chain); } } }
[ "public", "final", "void", "removeChainEventListener", "(", "ChainEventListener", "listener", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"removeChainEventListener: \"", "+", "listener", ")", ";", "}", "if", "(", "null", "!=", "listener", ")", "{", "// Remove the listener from the list monitored by this group.", "if", "(", "!", "getChainEventListeners", "(", ")", ".", "remove", "(", "listener", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Listener \"", "+", "listener", "+", "\" was not found in list monitored by group \"", "+", "getName", "(", ")", ")", ";", "}", "}", "// Remove the listener from each of the chains in this group.", "for", "(", "ChainData", "chain", ":", "getChains", "(", ")", ")", "{", "removeListenerFromChain", "(", "listener", ",", "chain", ")", ";", "}", "}", "}" ]
Method removeChainEventListener. Removes a listener from the list of those being informed of chain events on this chain. The listener is also removed from each chain in the group unless the chain is in another group which is associated with the listener. @param listener
[ "Method", "removeChainEventListener", ".", "Removes", "a", "listener", "from", "the", "list", "of", "those", "being", "informed", "of", "chain", "events", "on", "this", "chain", ".", "The", "listener", "is", "also", "removed", "from", "each", "chain", "in", "the", "group", "unless", "the", "chain", "is", "in", "another", "group", "which", "is", "associated", "with", "the", "listener", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChainGroupDataImpl.java#L319-L336
train
OpenLiberty/open-liberty
dev/com.ibm.json4j/src/com/ibm/json/xml/internal/JSONObject.java
JSONObject.addJSONObject
public void addJSONObject(JSONObject obj) { if (logger.isLoggable(Level.FINER)) logger.entering(className, "addJSONObject(JSONObject)"); Vector vect = (Vector) this.jsonObjects.get(obj.objectName); if (vect != null) { vect.add(obj); } else { vect = new Vector(); vect.add(obj); this.jsonObjects.put(obj.objectName, vect); } if (logger.isLoggable(Level.FINER)) logger.exiting(className, "addJSONObject(JSONObject)"); }
java
public void addJSONObject(JSONObject obj) { if (logger.isLoggable(Level.FINER)) logger.entering(className, "addJSONObject(JSONObject)"); Vector vect = (Vector) this.jsonObjects.get(obj.objectName); if (vect != null) { vect.add(obj); } else { vect = new Vector(); vect.add(obj); this.jsonObjects.put(obj.objectName, vect); } if (logger.isLoggable(Level.FINER)) logger.exiting(className, "addJSONObject(JSONObject)"); }
[ "public", "void", "addJSONObject", "(", "JSONObject", "obj", ")", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "logger", ".", "entering", "(", "className", ",", "\"addJSONObject(JSONObject)\"", ")", ";", "Vector", "vect", "=", "(", "Vector", ")", "this", ".", "jsonObjects", ".", "get", "(", "obj", ".", "objectName", ")", ";", "if", "(", "vect", "!=", "null", ")", "{", "vect", ".", "add", "(", "obj", ")", ";", "}", "else", "{", "vect", "=", "new", "Vector", "(", ")", ";", "vect", ".", "add", "(", "obj", ")", ";", "this", ".", "jsonObjects", ".", "put", "(", "obj", ".", "objectName", ",", "vect", ")", ";", "}", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "logger", ".", "exiting", "(", "className", ",", "\"addJSONObject(JSONObject)\"", ")", ";", "}" ]
Method to add a JSON child object to this JSON object. @param obj The child JSON object to add to this JSON object.
[ "Method", "to", "add", "a", "JSON", "child", "object", "to", "this", "JSON", "object", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.json4j/src/com/ibm/json/xml/internal/JSONObject.java#L98-L115
train
OpenLiberty/open-liberty
dev/com.ibm.json4j/src/com/ibm/json/xml/internal/JSONObject.java
JSONObject.writeObject
public void writeObject(Writer writer, int indentDepth, boolean contentOnly, boolean compact) throws IOException { if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeObject(Writer, int, boolean, boolean)"); if (writer != null) { try { if (isEmptyObject()) { writeEmptyObject(writer,indentDepth,contentOnly, compact); } else if (isTextOnlyObject()) { writeTextOnlyObject(writer,indentDepth,contentOnly, compact); } else { writeComplexObject(writer,indentDepth,contentOnly,compact); } } catch (Exception ex) { IOException iox = new IOException("Error occurred on serialization of JSON text."); iox.initCause(ex); throw iox; } } else { throw new IOException("The writer cannot be null."); } if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeObject(Writer, int, boolean, boolean)"); }
java
public void writeObject(Writer writer, int indentDepth, boolean contentOnly, boolean compact) throws IOException { if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeObject(Writer, int, boolean, boolean)"); if (writer != null) { try { if (isEmptyObject()) { writeEmptyObject(writer,indentDepth,contentOnly, compact); } else if (isTextOnlyObject()) { writeTextOnlyObject(writer,indentDepth,contentOnly, compact); } else { writeComplexObject(writer,indentDepth,contentOnly,compact); } } catch (Exception ex) { IOException iox = new IOException("Error occurred on serialization of JSON text."); iox.initCause(ex); throw iox; } } else { throw new IOException("The writer cannot be null."); } if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeObject(Writer, int, boolean, boolean)"); }
[ "public", "void", "writeObject", "(", "Writer", "writer", ",", "int", "indentDepth", ",", "boolean", "contentOnly", ",", "boolean", "compact", ")", "throws", "IOException", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "logger", ".", "entering", "(", "className", ",", "\"writeObject(Writer, int, boolean, boolean)\"", ")", ";", "if", "(", "writer", "!=", "null", ")", "{", "try", "{", "if", "(", "isEmptyObject", "(", ")", ")", "{", "writeEmptyObject", "(", "writer", ",", "indentDepth", ",", "contentOnly", ",", "compact", ")", ";", "}", "else", "if", "(", "isTextOnlyObject", "(", ")", ")", "{", "writeTextOnlyObject", "(", "writer", ",", "indentDepth", ",", "contentOnly", ",", "compact", ")", ";", "}", "else", "{", "writeComplexObject", "(", "writer", ",", "indentDepth", ",", "contentOnly", ",", "compact", ")", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "IOException", "iox", "=", "new", "IOException", "(", "\"Error occurred on serialization of JSON text.\"", ")", ";", "iox", ".", "initCause", "(", "ex", ")", ";", "throw", "iox", ";", "}", "}", "else", "{", "throw", "new", "IOException", "(", "\"The writer cannot be null.\"", ")", ";", "}", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "logger", ".", "entering", "(", "className", ",", "\"writeObject(Writer, int, boolean, boolean)\"", ")", ";", "}" ]
Method to write out the JSON formatted object. @param writer The writer to use when serializing the JSON structure. @param indentDepth How far to indent the text for object's JSON format. @param contentOnly Flag to debnnote whether to assign this as an attribute name, or as a nameless object. Commonly used for serializing an array. The Array itself has the name, The contents are all nameless objects @param compact Flag to denote to write the JSON in compact form. No indentions or newlines. Setting this value to true will cause indentDepth to be ignored. @throws IOException Trhown if an error occurs on write.
[ "Method", "to", "write", "out", "the", "JSON", "formatted", "object", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.json4j/src/com/ibm/json/xml/internal/JSONObject.java#L158-L194
train
OpenLiberty/open-liberty
dev/com.ibm.json4j/src/com/ibm/json/xml/internal/JSONObject.java
JSONObject.writeIndention
private void writeIndention(Writer writer, int indentDepth) throws IOException { if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeIndention(Writer, int)"); try { for (int i = 0; i < indentDepth; i++) { writer.write(indent); } } catch (Exception ex) { IOException iox = new IOException("Error occurred on serialization of JSON text."); iox.initCause(ex); throw iox; } if (logger.isLoggable(Level.FINER)) logger.exiting(className, "writeIndention(Writer, int)"); }
java
private void writeIndention(Writer writer, int indentDepth) throws IOException { if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeIndention(Writer, int)"); try { for (int i = 0; i < indentDepth; i++) { writer.write(indent); } } catch (Exception ex) { IOException iox = new IOException("Error occurred on serialization of JSON text."); iox.initCause(ex); throw iox; } if (logger.isLoggable(Level.FINER)) logger.exiting(className, "writeIndention(Writer, int)"); }
[ "private", "void", "writeIndention", "(", "Writer", "writer", ",", "int", "indentDepth", ")", "throws", "IOException", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "logger", ".", "entering", "(", "className", ",", "\"writeIndention(Writer, int)\"", ")", ";", "try", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "indentDepth", ";", "i", "++", ")", "{", "writer", ".", "write", "(", "indent", ")", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "IOException", "iox", "=", "new", "IOException", "(", "\"Error occurred on serialization of JSON text.\"", ")", ";", "iox", ".", "initCause", "(", "ex", ")", ";", "throw", "iox", ";", "}", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "logger", ".", "exiting", "(", "className", ",", "\"writeIndention(Writer, int)\"", ")", ";", "}" ]
Internal method for doing a simple indention write. @param writer The writer to use while writing the JSON text. @param indentDepth How deep to indent the text. @throws IOException Trhown if an error occurs on write.
[ "Internal", "method", "for", "doing", "a", "simple", "indention", "write", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.json4j/src/com/ibm/json/xml/internal/JSONObject.java#L242-L262
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/core/ConvertDateTimeHandler.java
ConvertDateTimeHandler.setAttributes
public void setAttributes(FaceletContext ctx, Object obj) { DateTimeConverter c = (DateTimeConverter) obj; if (this.locale != null) { c.setLocale(ComponentSupport.getLocale(ctx, this.locale)); } if (this.pattern != null) { c.setPattern(this.pattern.getValue(ctx)); } else { if (this.type != null) { c.setType(this.type.getValue(ctx)); } if (this.dateStyle != null) { c.setDateStyle(this.dateStyle.getValue(ctx)); } if (this.timeStyle != null) { c.setTimeStyle(this.timeStyle.getValue(ctx)); } } if (this.timeZone != null) { Object t = this.timeZone.getObject(ctx); if (t != null) { if (t instanceof TimeZone) { c.setTimeZone((TimeZone) t); } else if (t instanceof String) { TimeZone tz = TimeZone.getTimeZone((String) t); c.setTimeZone(tz); } else { throw new TagAttributeException(this.tag, this.timeZone, "Illegal TimeZone, must evaluate to either a java.util.TimeZone or String, is type: " + t.getClass()); } } } }
java
public void setAttributes(FaceletContext ctx, Object obj) { DateTimeConverter c = (DateTimeConverter) obj; if (this.locale != null) { c.setLocale(ComponentSupport.getLocale(ctx, this.locale)); } if (this.pattern != null) { c.setPattern(this.pattern.getValue(ctx)); } else { if (this.type != null) { c.setType(this.type.getValue(ctx)); } if (this.dateStyle != null) { c.setDateStyle(this.dateStyle.getValue(ctx)); } if (this.timeStyle != null) { c.setTimeStyle(this.timeStyle.getValue(ctx)); } } if (this.timeZone != null) { Object t = this.timeZone.getObject(ctx); if (t != null) { if (t instanceof TimeZone) { c.setTimeZone((TimeZone) t); } else if (t instanceof String) { TimeZone tz = TimeZone.getTimeZone((String) t); c.setTimeZone(tz); } else { throw new TagAttributeException(this.tag, this.timeZone, "Illegal TimeZone, must evaluate to either a java.util.TimeZone or String, is type: " + t.getClass()); } } } }
[ "public", "void", "setAttributes", "(", "FaceletContext", "ctx", ",", "Object", "obj", ")", "{", "DateTimeConverter", "c", "=", "(", "DateTimeConverter", ")", "obj", ";", "if", "(", "this", ".", "locale", "!=", "null", ")", "{", "c", ".", "setLocale", "(", "ComponentSupport", ".", "getLocale", "(", "ctx", ",", "this", ".", "locale", ")", ")", ";", "}", "if", "(", "this", ".", "pattern", "!=", "null", ")", "{", "c", ".", "setPattern", "(", "this", ".", "pattern", ".", "getValue", "(", "ctx", ")", ")", ";", "}", "else", "{", "if", "(", "this", ".", "type", "!=", "null", ")", "{", "c", ".", "setType", "(", "this", ".", "type", ".", "getValue", "(", "ctx", ")", ")", ";", "}", "if", "(", "this", ".", "dateStyle", "!=", "null", ")", "{", "c", ".", "setDateStyle", "(", "this", ".", "dateStyle", ".", "getValue", "(", "ctx", ")", ")", ";", "}", "if", "(", "this", ".", "timeStyle", "!=", "null", ")", "{", "c", ".", "setTimeStyle", "(", "this", ".", "timeStyle", ".", "getValue", "(", "ctx", ")", ")", ";", "}", "}", "if", "(", "this", ".", "timeZone", "!=", "null", ")", "{", "Object", "t", "=", "this", ".", "timeZone", ".", "getObject", "(", "ctx", ")", ";", "if", "(", "t", "!=", "null", ")", "{", "if", "(", "t", "instanceof", "TimeZone", ")", "{", "c", ".", "setTimeZone", "(", "(", "TimeZone", ")", "t", ")", ";", "}", "else", "if", "(", "t", "instanceof", "String", ")", "{", "TimeZone", "tz", "=", "TimeZone", ".", "getTimeZone", "(", "(", "String", ")", "t", ")", ";", "c", ".", "setTimeZone", "(", "tz", ")", ";", "}", "else", "{", "throw", "new", "TagAttributeException", "(", "this", ".", "tag", ",", "this", ".", "timeZone", ",", "\"Illegal TimeZone, must evaluate to either a java.util.TimeZone or String, is type: \"", "+", "t", ".", "getClass", "(", ")", ")", ";", "}", "}", "}", "}" ]
Implements tag spec, see taglib documentation. @see org.apache.myfaces.view.facelets.tag.ObjectHandler#setAttributes(javax.faces.view.facelets.FaceletContext, java.lang.Object)
[ "Implements", "tag", "spec", "see", "taglib", "documentation", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/core/ConvertDateTimeHandler.java#L97-L146
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/InternalOutputStreamManager.java
InternalOutputStreamManager.createShellStreamSet
public void createShellStreamSet() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createShellStreamSet"); StreamSet streamSet = null; synchronized (streamSets) { streamSet = new StreamSet(null, targetMEUuid, 0, isLink ? StreamSet.Type.LINK_INTERNAL_OUTPUT : StreamSet.Type.INTERNAL_OUTPUT); streamSets.put(null, streamSet); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createShellStreamSet", streamSet); }
java
public void createShellStreamSet() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createShellStreamSet"); StreamSet streamSet = null; synchronized (streamSets) { streamSet = new StreamSet(null, targetMEUuid, 0, isLink ? StreamSet.Type.LINK_INTERNAL_OUTPUT : StreamSet.Type.INTERNAL_OUTPUT); streamSets.put(null, streamSet); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createShellStreamSet", streamSet); }
[ "public", "void", "createShellStreamSet", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"createShellStreamSet\"", ")", ";", "StreamSet", "streamSet", "=", "null", ";", "synchronized", "(", "streamSets", ")", "{", "streamSet", "=", "new", "StreamSet", "(", "null", ",", "targetMEUuid", ",", "0", ",", "isLink", "?", "StreamSet", ".", "Type", ".", "LINK_INTERNAL_OUTPUT", ":", "StreamSet", ".", "Type", ".", "INTERNAL_OUTPUT", ")", ";", "streamSets", ".", "put", "(", "null", ",", "streamSet", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"createShellStreamSet\"", ",", "streamSet", ")", ";", "}" ]
This method will create a StreamSet with null StreamId.
[ "This", "method", "will", "create", "a", "StreamSet", "with", "null", "StreamId", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/InternalOutputStreamManager.java#L112-L130
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/InternalOutputStreamManager.java
InternalOutputStreamManager.processAckExpected
public void processAckExpected(long stamp, int priority, Reliability reliability, SIBUuid12 streamID) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "processAckExpected", new Object[] { Long.valueOf(stamp), Integer.valueOf(priority), reliability, streamID }); // NOTE: pass false here (meaning don't create a new streamSet) because we should only get // an AckExpected (under v1 anyway) if we've already received data of some sort // (and hence already created the stream). StreamSet streamSet = getStreamSet(streamID, false); if (streamSet != null) { InternalOutputStream internalOutputStream = (InternalOutputStream) streamSet.getStream(priority, reliability); // There is no stream for BestEffort non persistent messages if (reliability.compareTo(Reliability.BEST_EFFORT_NONPERSISTENT) > 0) { // We do need to write the message to the stream if (internalOutputStream != null) { internalOutputStream.processAckExpected(stamp); } else { // We didn't expect an AckExpected for this stream so throw it away but write an entry // to the trace log indicating that it happened if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unexpected AckExpected message for streamID " + streamID + " Reliability " + reliability + " priority " + priority); } } } else { // We didn't expect an AckExpected for this streamID so throw it away but write an entry // to the trace log indicating that it happened if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "AckExpected message for unknown streamID " + streamID); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "processAckExpected"); }
java
public void processAckExpected(long stamp, int priority, Reliability reliability, SIBUuid12 streamID) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "processAckExpected", new Object[] { Long.valueOf(stamp), Integer.valueOf(priority), reliability, streamID }); // NOTE: pass false here (meaning don't create a new streamSet) because we should only get // an AckExpected (under v1 anyway) if we've already received data of some sort // (and hence already created the stream). StreamSet streamSet = getStreamSet(streamID, false); if (streamSet != null) { InternalOutputStream internalOutputStream = (InternalOutputStream) streamSet.getStream(priority, reliability); // There is no stream for BestEffort non persistent messages if (reliability.compareTo(Reliability.BEST_EFFORT_NONPERSISTENT) > 0) { // We do need to write the message to the stream if (internalOutputStream != null) { internalOutputStream.processAckExpected(stamp); } else { // We didn't expect an AckExpected for this stream so throw it away but write an entry // to the trace log indicating that it happened if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unexpected AckExpected message for streamID " + streamID + " Reliability " + reliability + " priority " + priority); } } } else { // We didn't expect an AckExpected for this streamID so throw it away but write an entry // to the trace log indicating that it happened if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "AckExpected message for unknown streamID " + streamID); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "processAckExpected"); }
[ "public", "void", "processAckExpected", "(", "long", "stamp", ",", "int", "priority", ",", "Reliability", "reliability", ",", "SIBUuid12", "streamID", ")", "throws", "SIResourceException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"processAckExpected\"", ",", "new", "Object", "[", "]", "{", "Long", ".", "valueOf", "(", "stamp", ")", ",", "Integer", ".", "valueOf", "(", "priority", ")", ",", "reliability", ",", "streamID", "}", ")", ";", "// NOTE: pass false here (meaning don't create a new streamSet) because we should only get ", "// an AckExpected (under v1 anyway) if we've already received data of some sort", "// (and hence already created the stream).", "StreamSet", "streamSet", "=", "getStreamSet", "(", "streamID", ",", "false", ")", ";", "if", "(", "streamSet", "!=", "null", ")", "{", "InternalOutputStream", "internalOutputStream", "=", "(", "InternalOutputStream", ")", "streamSet", ".", "getStream", "(", "priority", ",", "reliability", ")", ";", "// There is no stream for BestEffort non persistent messages ", "if", "(", "reliability", ".", "compareTo", "(", "Reliability", ".", "BEST_EFFORT_NONPERSISTENT", ")", ">", "0", ")", "{", "// We do need to write the message to the stream ", "if", "(", "internalOutputStream", "!=", "null", ")", "{", "internalOutputStream", ".", "processAckExpected", "(", "stamp", ")", ";", "}", "else", "{", "// We didn't expect an AckExpected for this stream so throw it away but write an entry ", "// to the trace log indicating that it happened", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Unexpected AckExpected message for streamID \"", "+", "streamID", "+", "\" Reliability \"", "+", "reliability", "+", "\" priority \"", "+", "priority", ")", ";", "}", "}", "}", "else", "{", "// We didn't expect an AckExpected for this streamID so throw it away but write an entry ", "// to the trace log indicating that it happened", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"AckExpected message for unknown streamID \"", "+", "streamID", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"processAckExpected\"", ")", ";", "}" ]
needs to send an AckExpected downstream.
[ "needs", "to", "send", "an", "AckExpected", "downstream", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/InternalOutputStreamManager.java#L274-L321
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/InternalOutputStreamManager.java
InternalOutputStreamManager.forceFlush
public void forceFlush(SIBUuid12 streamID) throws SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "forceFlush", streamID); StreamSet streamSet = streamSets.get(streamID); streamSet.dereferenceControlAdapter(); // Send out a flushed message. If this fails, make sure we get // to at least invoke the callback. try { // The Cellule argument is null as it is ignored by our parent handler // this flush message should be broadcast downstream. // This will also implicitly remove the streamSet downControl.sendFlushedMessage(null, streamID); } catch (Exception e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.gd.InternalOutputStreamManager.forceFlush", "1:743:1.48.1.1", this); // Note that it doesn't make much sense to throw an exception here since // this is a callback from stream array map. if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "forceFlush", e); return; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "forceFlush"); }
java
public void forceFlush(SIBUuid12 streamID) throws SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "forceFlush", streamID); StreamSet streamSet = streamSets.get(streamID); streamSet.dereferenceControlAdapter(); // Send out a flushed message. If this fails, make sure we get // to at least invoke the callback. try { // The Cellule argument is null as it is ignored by our parent handler // this flush message should be broadcast downstream. // This will also implicitly remove the streamSet downControl.sendFlushedMessage(null, streamID); } catch (Exception e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.gd.InternalOutputStreamManager.forceFlush", "1:743:1.48.1.1", this); // Note that it doesn't make much sense to throw an exception here since // this is a callback from stream array map. if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "forceFlush", e); return; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "forceFlush"); }
[ "public", "void", "forceFlush", "(", "SIBUuid12", "streamID", ")", "throws", "SIErrorException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"forceFlush\"", ",", "streamID", ")", ";", "StreamSet", "streamSet", "=", "streamSets", ".", "get", "(", "streamID", ")", ";", "streamSet", ".", "dereferenceControlAdapter", "(", ")", ";", "// Send out a flushed message. If this fails, make sure we get", "// to at least invoke the callback.", "try", "{", "// The Cellule argument is null as it is ignored by our parent handler", "// this flush message should be broadcast downstream.", "// This will also implicitly remove the streamSet", "downControl", ".", "sendFlushedMessage", "(", "null", ",", "streamID", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// FFDC", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.sib.processor.gd.InternalOutputStreamManager.forceFlush\"", ",", "\"1:743:1.48.1.1\"", ",", "this", ")", ";", "// Note that it doesn't make much sense to throw an exception here since", "// this is a callback from stream array map.", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"forceFlush\"", ",", "e", ")", ";", "return", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"forceFlush\"", ")", ";", "}" ]
This method will be called to force flush of streamSet
[ "This", "method", "will", "be", "called", "to", "force", "flush", "of", "streamSet" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/InternalOutputStreamManager.java#L712-L746
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/InternalOutputStreamManager.java
InternalOutputStreamManager.stampNotFlushed
public ControlNotFlushed stampNotFlushed(ControlNotFlushed msg, SIBUuid12 streamID) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "stampNotFlushed", new Object[] { msg }); int count = 0; //the maximum possible number of streams in a set int max = (SIMPConstants.MSG_HIGH_PRIORITY + 1) * (Reliability.MAX_INDEX + 1); //an array of priorities int[] ps = new int[max]; //an array of reliabilities int[] qs = new int[max]; //an array of prefixes long[] cs = new long[max]; StreamSet streamSet = getStreamSet(streamID, false); //iterate through the non-null streams Iterator itr = streamSet.iterator(); while (itr.hasNext()) { InternalOutputStream oStream = (InternalOutputStream) itr.next(); // for each stream, store it's priority, reliability and completed prefix ps[count] = oStream.getPriority(); qs[count] = oStream.getReliability().toInt(); cs[count] = oStream.getCompletedPrefix(); count++; } //create some arrays which are of the correct size int[] realps = new int[count]; int[] realqs = new int[count]; long[] realcs = new long[count]; //copy the data in to them System.arraycopy(ps, 0, realps, 0, count); System.arraycopy(qs, 0, realqs, 0, count); System.arraycopy(cs, 0, realcs, 0, count); //set the appropriate message fields msg.setCompletedPrefixPriority(realps); msg.setCompletedPrefixQOS(realqs); msg.setCompletedPrefixTicks(realcs); msg.setDuplicatePrefixPriority(realps); msg.setDuplicatePrefixQOS(realqs); msg.setDuplicatePrefixTicks(realcs); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "stampNotFlushed", msg); //return the message return msg; }
java
public ControlNotFlushed stampNotFlushed(ControlNotFlushed msg, SIBUuid12 streamID) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "stampNotFlushed", new Object[] { msg }); int count = 0; //the maximum possible number of streams in a set int max = (SIMPConstants.MSG_HIGH_PRIORITY + 1) * (Reliability.MAX_INDEX + 1); //an array of priorities int[] ps = new int[max]; //an array of reliabilities int[] qs = new int[max]; //an array of prefixes long[] cs = new long[max]; StreamSet streamSet = getStreamSet(streamID, false); //iterate through the non-null streams Iterator itr = streamSet.iterator(); while (itr.hasNext()) { InternalOutputStream oStream = (InternalOutputStream) itr.next(); // for each stream, store it's priority, reliability and completed prefix ps[count] = oStream.getPriority(); qs[count] = oStream.getReliability().toInt(); cs[count] = oStream.getCompletedPrefix(); count++; } //create some arrays which are of the correct size int[] realps = new int[count]; int[] realqs = new int[count]; long[] realcs = new long[count]; //copy the data in to them System.arraycopy(ps, 0, realps, 0, count); System.arraycopy(qs, 0, realqs, 0, count); System.arraycopy(cs, 0, realcs, 0, count); //set the appropriate message fields msg.setCompletedPrefixPriority(realps); msg.setCompletedPrefixQOS(realqs); msg.setCompletedPrefixTicks(realcs); msg.setDuplicatePrefixPriority(realps); msg.setDuplicatePrefixQOS(realqs); msg.setDuplicatePrefixTicks(realcs); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "stampNotFlushed", msg); //return the message return msg; }
[ "public", "ControlNotFlushed", "stampNotFlushed", "(", "ControlNotFlushed", "msg", ",", "SIBUuid12", "streamID", ")", "throws", "SIResourceException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"stampNotFlushed\"", ",", "new", "Object", "[", "]", "{", "msg", "}", ")", ";", "int", "count", "=", "0", ";", "//the maximum possible number of streams in a set", "int", "max", "=", "(", "SIMPConstants", ".", "MSG_HIGH_PRIORITY", "+", "1", ")", "*", "(", "Reliability", ".", "MAX_INDEX", "+", "1", ")", ";", "//an array of priorities", "int", "[", "]", "ps", "=", "new", "int", "[", "max", "]", ";", "//an array of reliabilities", "int", "[", "]", "qs", "=", "new", "int", "[", "max", "]", ";", "//an array of prefixes", "long", "[", "]", "cs", "=", "new", "long", "[", "max", "]", ";", "StreamSet", "streamSet", "=", "getStreamSet", "(", "streamID", ",", "false", ")", ";", "//iterate through the non-null streams", "Iterator", "itr", "=", "streamSet", ".", "iterator", "(", ")", ";", "while", "(", "itr", ".", "hasNext", "(", ")", ")", "{", "InternalOutputStream", "oStream", "=", "(", "InternalOutputStream", ")", "itr", ".", "next", "(", ")", ";", "// for each stream, store it's priority, reliability and completed prefix", "ps", "[", "count", "]", "=", "oStream", ".", "getPriority", "(", ")", ";", "qs", "[", "count", "]", "=", "oStream", ".", "getReliability", "(", ")", ".", "toInt", "(", ")", ";", "cs", "[", "count", "]", "=", "oStream", ".", "getCompletedPrefix", "(", ")", ";", "count", "++", ";", "}", "//create some arrays which are of the correct size", "int", "[", "]", "realps", "=", "new", "int", "[", "count", "]", ";", "int", "[", "]", "realqs", "=", "new", "int", "[", "count", "]", ";", "long", "[", "]", "realcs", "=", "new", "long", "[", "count", "]", ";", "//copy the data in to them", "System", ".", "arraycopy", "(", "ps", ",", "0", ",", "realps", ",", "0", ",", "count", ")", ";", "System", ".", "arraycopy", "(", "qs", ",", "0", ",", "realqs", ",", "0", ",", "count", ")", ";", "System", ".", "arraycopy", "(", "cs", ",", "0", ",", "realcs", ",", "0", ",", "count", ")", ";", "//set the appropriate message fields", "msg", ".", "setCompletedPrefixPriority", "(", "realps", ")", ";", "msg", ".", "setCompletedPrefixQOS", "(", "realqs", ")", ";", "msg", ".", "setCompletedPrefixTicks", "(", "realcs", ")", ";", "msg", ".", "setDuplicatePrefixPriority", "(", "realps", ")", ";", "msg", ".", "setDuplicatePrefixQOS", "(", "realqs", ")", ";", "msg", ".", "setDuplicatePrefixTicks", "(", "realcs", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"stampNotFlushed\"", ",", "msg", ")", ";", "//return the message", "return", "msg", ";", "}" ]
Attach the appropriate completed and duplicate prefixes for the stream stored in this array to a ControlNotFlushed message. @param msg The ControlNotFlushed message to stamp. @throws SIResourceException
[ "Attach", "the", "appropriate", "completed", "and", "duplicate", "prefixes", "for", "the", "stream", "stored", "in", "this", "array", "to", "a", "ControlNotFlushed", "message", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/InternalOutputStreamManager.java#L806-L860
train
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/data/SpdStatisticExternal.java
SpdStatisticExternal.getStatistic
public StatisticImpl getStatistic() { if (enabled) { if (proxy == null) { System.out.println("[SpdStatisticExternal] null proxy"); return null; } proxy.updateStatisticOnRequest(dataId); // onReqStatistic will be updated by the component // the reference is kept in this class return onReqStatistic; } else return null; }
java
public StatisticImpl getStatistic() { if (enabled) { if (proxy == null) { System.out.println("[SpdStatisticExternal] null proxy"); return null; } proxy.updateStatisticOnRequest(dataId); // onReqStatistic will be updated by the component // the reference is kept in this class return onReqStatistic; } else return null; }
[ "public", "StatisticImpl", "getStatistic", "(", ")", "{", "if", "(", "enabled", ")", "{", "if", "(", "proxy", "==", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"[SpdStatisticExternal] null proxy\"", ")", ";", "return", "null", ";", "}", "proxy", ".", "updateStatisticOnRequest", "(", "dataId", ")", ";", "// onReqStatistic will be updated by the component", "// the reference is kept in this class", "return", "onReqStatistic", ";", "}", "else", "return", "null", ";", "}" ]
return a wire level data using given time as snapshotTime
[ "return", "a", "wire", "level", "data", "using", "given", "time", "as", "snapshotTime" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/data/SpdStatisticExternal.java#L66-L80
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TraceComponent.java
TraceComponent.uniquify
static String[] uniquify(String[] arr, boolean alwaysClone) { int numUnique = uniquifyCountAndCopy(arr, null); if (numUnique == 0) return EMPTY_STRING_ARRAY; if (numUnique == arr.length) return alwaysClone ? arr.clone() : arr; String[] out = new String[numUnique]; uniquifyCountAndCopy(arr, out); return out; }
java
static String[] uniquify(String[] arr, boolean alwaysClone) { int numUnique = uniquifyCountAndCopy(arr, null); if (numUnique == 0) return EMPTY_STRING_ARRAY; if (numUnique == arr.length) return alwaysClone ? arr.clone() : arr; String[] out = new String[numUnique]; uniquifyCountAndCopy(arr, out); return out; }
[ "static", "String", "[", "]", "uniquify", "(", "String", "[", "]", "arr", ",", "boolean", "alwaysClone", ")", "{", "int", "numUnique", "=", "uniquifyCountAndCopy", "(", "arr", ",", "null", ")", ";", "if", "(", "numUnique", "==", "0", ")", "return", "EMPTY_STRING_ARRAY", ";", "if", "(", "numUnique", "==", "arr", ".", "length", ")", "return", "alwaysClone", "?", "arr", ".", "clone", "(", ")", ":", "arr", ";", "String", "[", "]", "out", "=", "new", "String", "[", "numUnique", "]", ";", "uniquifyCountAndCopy", "(", "arr", ",", "out", ")", ";", "return", "out", ";", "}" ]
Remove null and duplicate elements from an array. @param arr the input array @param alwaysClone true if the input array should be copied even if it doesn't contain nulls or duplicates @return the output array
[ "Remove", "null", "and", "duplicate", "elements", "from", "an", "array", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TraceComponent.java#L154-L164
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TraceComponent.java
TraceComponent.uniquifyCountAndCopy
private static int uniquifyCountAndCopy(String[] in, String[] out) { int count = 0; outer: for (int i = 0; i < in.length; i++) { if (in[i] != null) { for (int j = 0; j < i; j++) if (in[i].equals(in[j])) continue outer; if (out != null) out[count] = in[i]; count++; } } return count; }
java
private static int uniquifyCountAndCopy(String[] in, String[] out) { int count = 0; outer: for (int i = 0; i < in.length; i++) { if (in[i] != null) { for (int j = 0; j < i; j++) if (in[i].equals(in[j])) continue outer; if (out != null) out[count] = in[i]; count++; } } return count; }
[ "private", "static", "int", "uniquifyCountAndCopy", "(", "String", "[", "]", "in", ",", "String", "[", "]", "out", ")", "{", "int", "count", "=", "0", ";", "outer", ":", "for", "(", "int", "i", "=", "0", ";", "i", "<", "in", ".", "length", ";", "i", "++", ")", "{", "if", "(", "in", "[", "i", "]", "!=", "null", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "i", ";", "j", "++", ")", "if", "(", "in", "[", "i", "]", ".", "equals", "(", "in", "[", "j", "]", ")", ")", "continue", "outer", ";", "if", "(", "out", "!=", "null", ")", "out", "[", "count", "]", "=", "in", "[", "i", "]", ";", "count", "++", ";", "}", "}", "return", "count", ";", "}" ]
Count the number of non-null non-duplicate elements in an array, and copy those elements to an output array if provided. @param in the input array @param out an output array, or null to count rather than copying @return the number of non-null non-duplicate elements
[ "Count", "the", "number", "of", "non", "-", "null", "non", "-", "duplicate", "elements", "in", "an", "array", "and", "copy", "those", "elements", "to", "an", "output", "array", "if", "provided", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TraceComponent.java#L174-L187
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TraceComponent.java
TraceComponent.findMinimumSafeLevel
private Integer findMinimumSafeLevel(PackageIndex<Integer> index) { if (index == null) { return null; } Integer minimumLevel = index.find(name); if (minimumLevel == null) { // Find by groups for (String group : groups) { minimumLevel = index.find(group); if (minimumLevel != null) { break; } } } return minimumLevel; }
java
private Integer findMinimumSafeLevel(PackageIndex<Integer> index) { if (index == null) { return null; } Integer minimumLevel = index.find(name); if (minimumLevel == null) { // Find by groups for (String group : groups) { minimumLevel = index.find(group); if (minimumLevel != null) { break; } } } return minimumLevel; }
[ "private", "Integer", "findMinimumSafeLevel", "(", "PackageIndex", "<", "Integer", ">", "index", ")", "{", "if", "(", "index", "==", "null", ")", "{", "return", "null", ";", "}", "Integer", "minimumLevel", "=", "index", ".", "find", "(", "name", ")", ";", "if", "(", "minimumLevel", "==", "null", ")", "{", "// Find by groups", "for", "(", "String", "group", ":", "groups", ")", "{", "minimumLevel", "=", "index", ".", "find", "(", "group", ")", ";", "if", "(", "minimumLevel", "!=", "null", ")", "{", "break", ";", "}", "}", "}", "return", "minimumLevel", ";", "}" ]
Search by name first and if not found, then search by groups. @param index @return the minimum safe level to enable trace for, or null if not found.
[ "Search", "by", "name", "first", "and", "if", "not", "found", "then", "search", "by", "groups", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TraceComponent.java#L453-L468
train
OpenLiberty/open-liberty
dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxRecoveryAgentImpl.java
TxRecoveryAgentImpl.createCustomTranLogConfiguration
private TranLogConfiguration createCustomTranLogConfiguration(String recoveredServerIdentity, String logDir, boolean isPeerRecoverySupported) throws URISyntaxException { if (tc.isEntryEnabled()) Tr.entry(tc, "createCustomTranLogConfiguration", new java.lang.Object[] { recoveredServerIdentity, logDir, this }); TranLogConfiguration tlc = null; final java.util.Properties props = new java.util.Properties(); java.net.URI logSettingURI = new java.net.URI(logDir); String scheme = logSettingURI.getScheme(); String logSetting = logSettingURI.getAuthority(); if (tc.isDebugEnabled()) Tr.debug(tc, "Scheme read from URI " + scheme + ", log setting" + logSetting); // For the cloud and peer recovery scenarios, we'll automatically add a suffix that matches the recoveryIdentity if (tc.isDebugEnabled()) Tr.debug(tc, "Test to see if peer recovery is supported - ", isPeerRecoverySupported); if (isPeerRecoverySupported) { if (tc.isDebugEnabled()) Tr.debug(tc, "Work with server recovery identity - " + recoveredServerIdentity + ", reset current logdir"); if (recoveredServerIdentity != null) { logDir = "custom://com.ibm.rls.jdbc.SQLRecoveryLogFactory?datasource=Liberty" + ",tablesuffix=" + recoveredServerIdentity; if (tc.isDebugEnabled()) Tr.debug(tc, "log dir is now - ", logDir); } } props.setProperty("LOG_DIRECTORY", logDir); tlc = new TranLogConfiguration(logSetting, props); if (tc.isEntryEnabled()) Tr.exit(tc, "createCustomTranLogConfiguration", tlc); return tlc; }
java
private TranLogConfiguration createCustomTranLogConfiguration(String recoveredServerIdentity, String logDir, boolean isPeerRecoverySupported) throws URISyntaxException { if (tc.isEntryEnabled()) Tr.entry(tc, "createCustomTranLogConfiguration", new java.lang.Object[] { recoveredServerIdentity, logDir, this }); TranLogConfiguration tlc = null; final java.util.Properties props = new java.util.Properties(); java.net.URI logSettingURI = new java.net.URI(logDir); String scheme = logSettingURI.getScheme(); String logSetting = logSettingURI.getAuthority(); if (tc.isDebugEnabled()) Tr.debug(tc, "Scheme read from URI " + scheme + ", log setting" + logSetting); // For the cloud and peer recovery scenarios, we'll automatically add a suffix that matches the recoveryIdentity if (tc.isDebugEnabled()) Tr.debug(tc, "Test to see if peer recovery is supported - ", isPeerRecoverySupported); if (isPeerRecoverySupported) { if (tc.isDebugEnabled()) Tr.debug(tc, "Work with server recovery identity - " + recoveredServerIdentity + ", reset current logdir"); if (recoveredServerIdentity != null) { logDir = "custom://com.ibm.rls.jdbc.SQLRecoveryLogFactory?datasource=Liberty" + ",tablesuffix=" + recoveredServerIdentity; if (tc.isDebugEnabled()) Tr.debug(tc, "log dir is now - ", logDir); } } props.setProperty("LOG_DIRECTORY", logDir); tlc = new TranLogConfiguration(logSetting, props); if (tc.isEntryEnabled()) Tr.exit(tc, "createCustomTranLogConfiguration", tlc); return tlc; }
[ "private", "TranLogConfiguration", "createCustomTranLogConfiguration", "(", "String", "recoveredServerIdentity", ",", "String", "logDir", ",", "boolean", "isPeerRecoverySupported", ")", "throws", "URISyntaxException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"createCustomTranLogConfiguration\"", ",", "new", "java", ".", "lang", ".", "Object", "[", "]", "{", "recoveredServerIdentity", ",", "logDir", ",", "this", "}", ")", ";", "TranLogConfiguration", "tlc", "=", "null", ";", "final", "java", ".", "util", ".", "Properties", "props", "=", "new", "java", ".", "util", ".", "Properties", "(", ")", ";", "java", ".", "net", ".", "URI", "logSettingURI", "=", "new", "java", ".", "net", ".", "URI", "(", "logDir", ")", ";", "String", "scheme", "=", "logSettingURI", ".", "getScheme", "(", ")", ";", "String", "logSetting", "=", "logSettingURI", ".", "getAuthority", "(", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Scheme read from URI \"", "+", "scheme", "+", "\", log setting\"", "+", "logSetting", ")", ";", "// For the cloud and peer recovery scenarios, we'll automatically add a suffix that matches the recoveryIdentity", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Test to see if peer recovery is supported - \"", ",", "isPeerRecoverySupported", ")", ";", "if", "(", "isPeerRecoverySupported", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Work with server recovery identity - \"", "+", "recoveredServerIdentity", "+", "\", reset current logdir\"", ")", ";", "if", "(", "recoveredServerIdentity", "!=", "null", ")", "{", "logDir", "=", "\"custom://com.ibm.rls.jdbc.SQLRecoveryLogFactory?datasource=Liberty\"", "+", "\",tablesuffix=\"", "+", "recoveredServerIdentity", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"log dir is now - \"", ",", "logDir", ")", ";", "}", "}", "props", ".", "setProperty", "(", "\"LOG_DIRECTORY\"", ",", "logDir", ")", ";", "tlc", "=", "new", "TranLogConfiguration", "(", "logSetting", ",", "props", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"createCustomTranLogConfiguration\"", ",", "tlc", ")", ";", "return", "tlc", ";", "}" ]
Creates a custom TranLogConfiguration object appropriate for storing transaction logs in an RDBMS or other custom repository. @param recoveredServerIdentity @param logDir @param isPeerRecoverySupported @return @throws URISyntaxException
[ "Creates", "a", "custom", "TranLogConfiguration", "object", "appropriate", "for", "storing", "transaction", "logs", "in", "an", "RDBMS", "or", "other", "custom", "repository", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxRecoveryAgentImpl.java#L631-L662
train
OpenLiberty/open-liberty
dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxRecoveryAgentImpl.java
TxRecoveryAgentImpl.createFileTranLogConfiguration
private TranLogConfiguration createFileTranLogConfiguration(String recoveredServerIdentity, FailureScope fs, String logDir, int logSize, boolean isPeerRecoverySupported) throws URISyntaxException { if (tc.isEntryEnabled()) Tr.entry(tc, "createFileTranLogConfiguration", new java.lang.Object[] { recoveredServerIdentity, fs, logDir, logSize, this }); TranLogConfiguration tlc = null; if (_isPeerRecoverySupported) { if (tc.isDebugEnabled()) Tr.debug(tc, "Work with server recovery identity - ", recoveredServerIdentity); // Do we need to reset the logdir? if (recoveredServerIdentity.equals(localRecoveryIdentity)) { if (tc.isDebugEnabled()) Tr.debug(tc, "Local server recovery identity so no need to reset the logDir"); } else { // Reset the logdir if (fs != null && fs instanceof FileFailureScope) { FileFailureScope ffs = (FileFailureScope) fs; if (ffs != null) { LeaseInfo li = ffs.getLeaseInfo(); if (li != null) { logDir = li.getLeaseDetail(); if (tc.isDebugEnabled()) Tr.debug(tc, "Have reset the logDir to ", logDir); } } } } } tlc = new TranLogConfiguration(logDir, logDir, logSize); if (tc.isEntryEnabled()) Tr.exit(tc, "createFileTranLogConfiguration", tlc); return tlc; }
java
private TranLogConfiguration createFileTranLogConfiguration(String recoveredServerIdentity, FailureScope fs, String logDir, int logSize, boolean isPeerRecoverySupported) throws URISyntaxException { if (tc.isEntryEnabled()) Tr.entry(tc, "createFileTranLogConfiguration", new java.lang.Object[] { recoveredServerIdentity, fs, logDir, logSize, this }); TranLogConfiguration tlc = null; if (_isPeerRecoverySupported) { if (tc.isDebugEnabled()) Tr.debug(tc, "Work with server recovery identity - ", recoveredServerIdentity); // Do we need to reset the logdir? if (recoveredServerIdentity.equals(localRecoveryIdentity)) { if (tc.isDebugEnabled()) Tr.debug(tc, "Local server recovery identity so no need to reset the logDir"); } else { // Reset the logdir if (fs != null && fs instanceof FileFailureScope) { FileFailureScope ffs = (FileFailureScope) fs; if (ffs != null) { LeaseInfo li = ffs.getLeaseInfo(); if (li != null) { logDir = li.getLeaseDetail(); if (tc.isDebugEnabled()) Tr.debug(tc, "Have reset the logDir to ", logDir); } } } } } tlc = new TranLogConfiguration(logDir, logDir, logSize); if (tc.isEntryEnabled()) Tr.exit(tc, "createFileTranLogConfiguration", tlc); return tlc; }
[ "private", "TranLogConfiguration", "createFileTranLogConfiguration", "(", "String", "recoveredServerIdentity", ",", "FailureScope", "fs", ",", "String", "logDir", ",", "int", "logSize", ",", "boolean", "isPeerRecoverySupported", ")", "throws", "URISyntaxException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"createFileTranLogConfiguration\"", ",", "new", "java", ".", "lang", ".", "Object", "[", "]", "{", "recoveredServerIdentity", ",", "fs", ",", "logDir", ",", "logSize", ",", "this", "}", ")", ";", "TranLogConfiguration", "tlc", "=", "null", ";", "if", "(", "_isPeerRecoverySupported", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Work with server recovery identity - \"", ",", "recoveredServerIdentity", ")", ";", "// Do we need to reset the logdir?", "if", "(", "recoveredServerIdentity", ".", "equals", "(", "localRecoveryIdentity", ")", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Local server recovery identity so no need to reset the logDir\"", ")", ";", "}", "else", "{", "// Reset the logdir", "if", "(", "fs", "!=", "null", "&&", "fs", "instanceof", "FileFailureScope", ")", "{", "FileFailureScope", "ffs", "=", "(", "FileFailureScope", ")", "fs", ";", "if", "(", "ffs", "!=", "null", ")", "{", "LeaseInfo", "li", "=", "ffs", ".", "getLeaseInfo", "(", ")", ";", "if", "(", "li", "!=", "null", ")", "{", "logDir", "=", "li", ".", "getLeaseDetail", "(", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Have reset the logDir to \"", ",", "logDir", ")", ";", "}", "}", "}", "}", "}", "tlc", "=", "new", "TranLogConfiguration", "(", "logDir", ",", "logDir", ",", "logSize", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"createFileTranLogConfiguration\"", ",", "tlc", ")", ";", "return", "tlc", ";", "}" ]
Creates a Filesystem TranLogConfiguration object appropriate for storing transaction logs in a filesystem. @param recoveredServerIdentity @param fs @param logDir @param logSize @param isPeerRecoverySupported @return @throws URISyntaxException
[ "Creates", "a", "Filesystem", "TranLogConfiguration", "object", "appropriate", "for", "storing", "transaction", "logs", "in", "a", "filesystem", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxRecoveryAgentImpl.java#L675-L714
train
OpenLiberty/open-liberty
dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxRecoveryAgentImpl.java
TxRecoveryAgentImpl.getPeerLeaseCheckInterval
private int getPeerLeaseCheckInterval() { if (tc.isEntryEnabled()) Tr.entry(tc, "getPeerLeaseCheckInterval"); int intToReturn; Integer peerLeaseCheckInterval = null; try { peerLeaseCheckInterval = AccessController.doPrivileged( new PrivilegedExceptionAction<Integer>() { @Override public Integer run() { return Integer.getInteger("com.ibm.tx.jta.impl.PeerLeaseCheckInterval", 20); // Default is 20 seconds } }); } catch (PrivilegedActionException e) { if (tc.isDebugEnabled()) Tr.debug(tc, "Exception setting Peer Lease-Check Interval", e); peerLeaseCheckInterval = null; } if (peerLeaseCheckInterval == null) peerLeaseCheckInterval = new Integer(20); intToReturn = peerLeaseCheckInterval.intValue(); if (tc.isEntryEnabled()) Tr.exit(tc, "getPeerLeaseCheckInterval", intToReturn); return intToReturn; }
java
private int getPeerLeaseCheckInterval() { if (tc.isEntryEnabled()) Tr.entry(tc, "getPeerLeaseCheckInterval"); int intToReturn; Integer peerLeaseCheckInterval = null; try { peerLeaseCheckInterval = AccessController.doPrivileged( new PrivilegedExceptionAction<Integer>() { @Override public Integer run() { return Integer.getInteger("com.ibm.tx.jta.impl.PeerLeaseCheckInterval", 20); // Default is 20 seconds } }); } catch (PrivilegedActionException e) { if (tc.isDebugEnabled()) Tr.debug(tc, "Exception setting Peer Lease-Check Interval", e); peerLeaseCheckInterval = null; } if (peerLeaseCheckInterval == null) peerLeaseCheckInterval = new Integer(20); intToReturn = peerLeaseCheckInterval.intValue(); if (tc.isEntryEnabled()) Tr.exit(tc, "getPeerLeaseCheckInterval", intToReturn); return intToReturn; }
[ "private", "int", "getPeerLeaseCheckInterval", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"getPeerLeaseCheckInterval\"", ")", ";", "int", "intToReturn", ";", "Integer", "peerLeaseCheckInterval", "=", "null", ";", "try", "{", "peerLeaseCheckInterval", "=", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedExceptionAction", "<", "Integer", ">", "(", ")", "{", "@", "Override", "public", "Integer", "run", "(", ")", "{", "return", "Integer", ".", "getInteger", "(", "\"com.ibm.tx.jta.impl.PeerLeaseCheckInterval\"", ",", "20", ")", ";", "// Default is 20 seconds", "}", "}", ")", ";", "}", "catch", "(", "PrivilegedActionException", "e", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Exception setting Peer Lease-Check Interval\"", ",", "e", ")", ";", "peerLeaseCheckInterval", "=", "null", ";", "}", "if", "(", "peerLeaseCheckInterval", "==", "null", ")", "peerLeaseCheckInterval", "=", "new", "Integer", "(", "20", ")", ";", "intToReturn", "=", "peerLeaseCheckInterval", ".", "intValue", "(", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"getPeerLeaseCheckInterval\"", ",", "intToReturn", ")", ";", "return", "intToReturn", ";", "}" ]
This method retrieves a system property named com.ibm.tx.jta.impl.PeerLeaseCheckInterval which allows a value to be specified for the time we should wait between peer server status checks. @return
[ "This", "method", "retrieves", "a", "system", "property", "named", "com", ".", "ibm", ".", "tx", ".", "jta", ".", "impl", ".", "PeerLeaseCheckInterval", "which", "allows", "a", "value", "to", "be", "specified", "for", "the", "time", "we", "should", "wait", "between", "peer", "server", "status", "checks", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxRecoveryAgentImpl.java#L722-L749
train
OpenLiberty/open-liberty
dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxRecoveryAgentImpl.java
TxRecoveryAgentImpl.doNotShutdownOnRecoveryFailure
private boolean doNotShutdownOnRecoveryFailure() { if (tc.isEntryEnabled()) Tr.entry(tc, "doNotShutdownOnRecoveryFailure"); boolean doCheck = true; Boolean doNotShutdownOnRecoveryFailure = null; try { doNotShutdownOnRecoveryFailure = AccessController.doPrivileged( new PrivilegedExceptionAction<Boolean>() { @Override public Boolean run() { Boolean theResult = Boolean.getBoolean("com.ibm.ws.recoverylog.spi.DoNotShutdownOnRecoveryFailure"); if (tc.isDebugEnabled()) Tr.debug(tc, "Have retrieved jvm property with result, " + theResult.booleanValue()); return theResult; } }); } catch (PrivilegedActionException e) { if (tc.isDebugEnabled()) Tr.debug(tc, "Exception getting DoNotShutdownOnRecoveryFailure property", e); doNotShutdownOnRecoveryFailure = null; } if (doNotShutdownOnRecoveryFailure == null) doNotShutdownOnRecoveryFailure = Boolean.TRUE; doCheck = doNotShutdownOnRecoveryFailure.booleanValue(); if (tc.isEntryEnabled()) Tr.exit(tc, "doNotShutdownOnRecoveryFailure", doCheck); return doCheck; }
java
private boolean doNotShutdownOnRecoveryFailure() { if (tc.isEntryEnabled()) Tr.entry(tc, "doNotShutdownOnRecoveryFailure"); boolean doCheck = true; Boolean doNotShutdownOnRecoveryFailure = null; try { doNotShutdownOnRecoveryFailure = AccessController.doPrivileged( new PrivilegedExceptionAction<Boolean>() { @Override public Boolean run() { Boolean theResult = Boolean.getBoolean("com.ibm.ws.recoverylog.spi.DoNotShutdownOnRecoveryFailure"); if (tc.isDebugEnabled()) Tr.debug(tc, "Have retrieved jvm property with result, " + theResult.booleanValue()); return theResult; } }); } catch (PrivilegedActionException e) { if (tc.isDebugEnabled()) Tr.debug(tc, "Exception getting DoNotShutdownOnRecoveryFailure property", e); doNotShutdownOnRecoveryFailure = null; } if (doNotShutdownOnRecoveryFailure == null) doNotShutdownOnRecoveryFailure = Boolean.TRUE; doCheck = doNotShutdownOnRecoveryFailure.booleanValue(); if (tc.isEntryEnabled()) Tr.exit(tc, "doNotShutdownOnRecoveryFailure", doCheck); return doCheck; }
[ "private", "boolean", "doNotShutdownOnRecoveryFailure", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"doNotShutdownOnRecoveryFailure\"", ")", ";", "boolean", "doCheck", "=", "true", ";", "Boolean", "doNotShutdownOnRecoveryFailure", "=", "null", ";", "try", "{", "doNotShutdownOnRecoveryFailure", "=", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedExceptionAction", "<", "Boolean", ">", "(", ")", "{", "@", "Override", "public", "Boolean", "run", "(", ")", "{", "Boolean", "theResult", "=", "Boolean", ".", "getBoolean", "(", "\"com.ibm.ws.recoverylog.spi.DoNotShutdownOnRecoveryFailure\"", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Have retrieved jvm property with result, \"", "+", "theResult", ".", "booleanValue", "(", ")", ")", ";", "return", "theResult", ";", "}", "}", ")", ";", "}", "catch", "(", "PrivilegedActionException", "e", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Exception getting DoNotShutdownOnRecoveryFailure property\"", ",", "e", ")", ";", "doNotShutdownOnRecoveryFailure", "=", "null", ";", "}", "if", "(", "doNotShutdownOnRecoveryFailure", "==", "null", ")", "doNotShutdownOnRecoveryFailure", "=", "Boolean", ".", "TRUE", ";", "doCheck", "=", "doNotShutdownOnRecoveryFailure", ".", "booleanValue", "(", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"doNotShutdownOnRecoveryFailure\"", ",", "doCheck", ")", ";", "return", "doCheck", ";", "}" ]
This method retrieves a system property named com.ibm.ws.recoverylog.spi.DoNotShutdownOnRecoveryFailure which allows the server to start with failed recovery logs - non 2PC work may still be performed by the server. @return
[ "This", "method", "retrieves", "a", "system", "property", "named", "com", ".", "ibm", ".", "ws", ".", "recoverylog", ".", "spi", ".", "DoNotShutdownOnRecoveryFailure", "which", "allows", "the", "server", "to", "start", "with", "failed", "recovery", "logs", "-", "non", "2PC", "work", "may", "still", "be", "performed", "by", "the", "server", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxRecoveryAgentImpl.java#L792-L823
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/WCCustomProperties.java
WCCustomProperties.getStringKey
private static String getStringKey(String propertyKey) { if (WCCustomProperties.FullyQualifiedPropertiesMap.containsKey(propertyKey)) { return WCCustomProperties.FullyQualifiedPropertiesMap.get(propertyKey).toLowerCase(); } else { return propertyKey; } }
java
private static String getStringKey(String propertyKey) { if (WCCustomProperties.FullyQualifiedPropertiesMap.containsKey(propertyKey)) { return WCCustomProperties.FullyQualifiedPropertiesMap.get(propertyKey).toLowerCase(); } else { return propertyKey; } }
[ "private", "static", "String", "getStringKey", "(", "String", "propertyKey", ")", "{", "if", "(", "WCCustomProperties", ".", "FullyQualifiedPropertiesMap", ".", "containsKey", "(", "propertyKey", ")", ")", "{", "return", "WCCustomProperties", ".", "FullyQualifiedPropertiesMap", ".", "get", "(", "propertyKey", ")", ".", "toLowerCase", "(", ")", ";", "}", "else", "{", "return", "propertyKey", ";", "}", "}" ]
propertyKey is lowerCase value
[ "propertyKey", "is", "lowerCase", "value" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/WCCustomProperties.java#L408-L414
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryBaseImpl.java
LogRepositoryBaseImpl.createLockFile
protected void createLockFile(String pid, String label) throws IOException { if (!AccessHelper.isDirectory(repositoryLocation)) { AccessHelper.makeDirectories(repositoryLocation); } // Remove stale lock files if any. for (File lock : listFiles(LOCKFILE_FILTER)) { AccessHelper.deleteFile(lock); } // Create a new lock file. StringBuilder sb = new StringBuilder(); sb.append(getLogDirectoryName(System.currentTimeMillis(), pid, label)).append(LOCK_EXT); AccessHelper.createFileOutputStream(new File(repositoryLocation, sb.toString()), false).close(); }
java
protected void createLockFile(String pid, String label) throws IOException { if (!AccessHelper.isDirectory(repositoryLocation)) { AccessHelper.makeDirectories(repositoryLocation); } // Remove stale lock files if any. for (File lock : listFiles(LOCKFILE_FILTER)) { AccessHelper.deleteFile(lock); } // Create a new lock file. StringBuilder sb = new StringBuilder(); sb.append(getLogDirectoryName(System.currentTimeMillis(), pid, label)).append(LOCK_EXT); AccessHelper.createFileOutputStream(new File(repositoryLocation, sb.toString()), false).close(); }
[ "protected", "void", "createLockFile", "(", "String", "pid", ",", "String", "label", ")", "throws", "IOException", "{", "if", "(", "!", "AccessHelper", ".", "isDirectory", "(", "repositoryLocation", ")", ")", "{", "AccessHelper", ".", "makeDirectories", "(", "repositoryLocation", ")", ";", "}", "// Remove stale lock files if any.", "for", "(", "File", "lock", ":", "listFiles", "(", "LOCKFILE_FILTER", ")", ")", "{", "AccessHelper", ".", "deleteFile", "(", "lock", ")", ";", "}", "// Create a new lock file.", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "getLogDirectoryName", "(", "System", ".", "currentTimeMillis", "(", ")", ",", "pid", ",", "label", ")", ")", ".", "append", "(", "LOCK_EXT", ")", ";", "AccessHelper", ".", "createFileOutputStream", "(", "new", "File", "(", "repositoryLocation", ",", "sb", ".", "toString", "(", ")", ")", ",", "false", ")", ".", "close", "(", ")", ";", "}" ]
Creates lock file to be used as a pattern for instance repository. Should be called only by parent's manager on start up. @param pid process ID of the parent. @param label label of the parent. @throws IOException if there's a problem to create lock file.
[ "Creates", "lock", "file", "to", "be", "used", "as", "a", "pattern", "for", "instance", "repository", ".", "Should", "be", "called", "only", "by", "parent", "s", "manager", "on", "start", "up", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryBaseImpl.java#L143-L157
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryBaseImpl.java
LogRepositoryBaseImpl.getLogFile
protected File getLogFile(File parentLocation, long timestamp) { if (timestamp < 0) { throw new IllegalArgumentException("timestamp cannot be negative"); } StringBuilder sb = new StringBuilder(); sb.append(timestamp).append(EXTENSION); return new File(parentLocation, sb.toString()); }
java
protected File getLogFile(File parentLocation, long timestamp) { if (timestamp < 0) { throw new IllegalArgumentException("timestamp cannot be negative"); } StringBuilder sb = new StringBuilder(); sb.append(timestamp).append(EXTENSION); return new File(parentLocation, sb.toString()); }
[ "protected", "File", "getLogFile", "(", "File", "parentLocation", ",", "long", "timestamp", ")", "{", "if", "(", "timestamp", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"timestamp cannot be negative\"", ")", ";", "}", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "timestamp", ")", ".", "append", "(", "EXTENSION", ")", ";", "return", "new", "File", "(", "parentLocation", ",", "sb", ".", "toString", "(", ")", ")", ";", "}" ]
calculates repository file name. @param timestamp the time in 'millis' of the first record in the file. @return the file according to repository pattern
[ "calculates", "repository", "file", "name", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryBaseImpl.java#L274-L281
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryBaseImpl.java
LogRepositoryBaseImpl.getLogFileTimestamp
public long getLogFileTimestamp(File file) { if (file == null) { return -1L; } String name = file.getName(); // Check name for extension if (name == null || name.length() == 0 || !name.endsWith(EXTENSION)) { return -1L; } try { return Long.parseLong(name.substring(0, name.indexOf(EXTENSION))); } catch (NumberFormatException ex) { return -1L; } }
java
public long getLogFileTimestamp(File file) { if (file == null) { return -1L; } String name = file.getName(); // Check name for extension if (name == null || name.length() == 0 || !name.endsWith(EXTENSION)) { return -1L; } try { return Long.parseLong(name.substring(0, name.indexOf(EXTENSION))); } catch (NumberFormatException ex) { return -1L; } }
[ "public", "long", "getLogFileTimestamp", "(", "File", "file", ")", "{", "if", "(", "file", "==", "null", ")", "{", "return", "-", "1L", ";", "}", "String", "name", "=", "file", ".", "getName", "(", ")", ";", "// Check name for extension", "if", "(", "name", "==", "null", "||", "name", ".", "length", "(", ")", "==", "0", "||", "!", "name", ".", "endsWith", "(", "EXTENSION", ")", ")", "{", "return", "-", "1L", ";", "}", "try", "{", "return", "Long", ".", "parseLong", "(", "name", ".", "substring", "(", "0", ",", "name", ".", "indexOf", "(", "EXTENSION", ")", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "ex", ")", "{", "return", "-", "1L", ";", "}", "}" ]
Retrieves the timestamp from the name of the file. @param file to retrieve timestamp from. @return timestamp in millis or -1 if name's pattern does not correspond to the one used for files in the repository.
[ "Retrieves", "the", "timestamp", "from", "the", "name", "of", "the", "file", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryBaseImpl.java#L290-L307
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryBaseImpl.java
LogRepositoryBaseImpl.getLogDirectoryName
public String getLogDirectoryName(long timestamp, String pid, String label) { if (pid == null || pid.isEmpty()) { throw new IllegalArgumentException("pid cannot be empty"); } StringBuilder sb = new StringBuilder(); if (timestamp > 0) { sb.append(timestamp).append(TIMESEPARATOR); } sb.append(pid); if (label != null && !label.trim().isEmpty()) { sb.append(LABELSEPARATOR).append(label); } return sb.toString(); }
java
public String getLogDirectoryName(long timestamp, String pid, String label) { if (pid == null || pid.isEmpty()) { throw new IllegalArgumentException("pid cannot be empty"); } StringBuilder sb = new StringBuilder(); if (timestamp > 0) { sb.append(timestamp).append(TIMESEPARATOR); } sb.append(pid); if (label != null && !label.trim().isEmpty()) { sb.append(LABELSEPARATOR).append(label); } return sb.toString(); }
[ "public", "String", "getLogDirectoryName", "(", "long", "timestamp", ",", "String", "pid", ",", "String", "label", ")", "{", "if", "(", "pid", "==", "null", "||", "pid", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"pid cannot be empty\"", ")", ";", "}", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "timestamp", ">", "0", ")", "{", "sb", ".", "append", "(", "timestamp", ")", ".", "append", "(", "TIMESEPARATOR", ")", ";", "}", "sb", ".", "append", "(", "pid", ")", ";", "if", "(", "label", "!=", "null", "&&", "!", "label", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "sb", ".", "append", "(", "LABELSEPARATOR", ")", ".", "append", "(", "label", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
returns sub-directory name to be used for instances and sub-processes @param timestamp time of the instance start. It should be negative for sub-processes @param pid process Id of the instance or sub-process. It cannot be null or empty. @param label additional identification to use on the sub-directory. @return string representing requested sub-directory.
[ "returns", "sub", "-", "directory", "name", "to", "be", "used", "for", "instances", "and", "sub", "-", "processes" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryBaseImpl.java#L317-L334
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryBaseImpl.java
LogRepositoryBaseImpl.parseTimeStamp
public static long parseTimeStamp(String fileName) { if (fileName == null || fileName.isEmpty()) { return -1L; } int pidIndex = fileName.indexOf(TIMESEPARATOR); int labelIndex = fileName.indexOf(LABELSEPARATOR); // If no time separator or it's a part of the label there's no timestamp if (pidIndex < 0 || (labelIndex > 0 && labelIndex < pidIndex)) { return -1L; } try { return Long.parseLong(fileName.substring(0, pidIndex)); } catch (NumberFormatException ex) { return -1L; } }
java
public static long parseTimeStamp(String fileName) { if (fileName == null || fileName.isEmpty()) { return -1L; } int pidIndex = fileName.indexOf(TIMESEPARATOR); int labelIndex = fileName.indexOf(LABELSEPARATOR); // If no time separator or it's a part of the label there's no timestamp if (pidIndex < 0 || (labelIndex > 0 && labelIndex < pidIndex)) { return -1L; } try { return Long.parseLong(fileName.substring(0, pidIndex)); } catch (NumberFormatException ex) { return -1L; } }
[ "public", "static", "long", "parseTimeStamp", "(", "String", "fileName", ")", "{", "if", "(", "fileName", "==", "null", "||", "fileName", ".", "isEmpty", "(", ")", ")", "{", "return", "-", "1L", ";", "}", "int", "pidIndex", "=", "fileName", ".", "indexOf", "(", "TIMESEPARATOR", ")", ";", "int", "labelIndex", "=", "fileName", ".", "indexOf", "(", "LABELSEPARATOR", ")", ";", "// If no time separator or it's a part of the label there's no timestamp", "if", "(", "pidIndex", "<", "0", "||", "(", "labelIndex", ">", "0", "&&", "labelIndex", "<", "pidIndex", ")", ")", "{", "return", "-", "1L", ";", "}", "try", "{", "return", "Long", ".", "parseLong", "(", "fileName", ".", "substring", "(", "0", ",", "pidIndex", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "ex", ")", "{", "return", "-", "1L", ";", "}", "}" ]
Retrieves the timestamp out of the directory name. example: directory file name for a serverinstance would be <repos_timestamp>_<pid>-<label> returned would be <repos_timestamp>
[ "Retrieves", "the", "timestamp", "out", "of", "the", "directory", "name", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryBaseImpl.java#L435-L450
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryBaseImpl.java
LogRepositoryBaseImpl.parsePIDandLabel
public static String parsePIDandLabel(String fileName) { if (fileName == null || fileName.isEmpty()) { return null; } int pidIndex = fileName.indexOf(TIMESEPARATOR); int labelIndex = fileName.indexOf(LABELSEPARATOR); // If no time separator or it's a part of the label the full name is the result if (pidIndex < 0 || (labelIndex > 0 && labelIndex < pidIndex)) { return fileName; } return fileName.substring(pidIndex + 1); }
java
public static String parsePIDandLabel(String fileName) { if (fileName == null || fileName.isEmpty()) { return null; } int pidIndex = fileName.indexOf(TIMESEPARATOR); int labelIndex = fileName.indexOf(LABELSEPARATOR); // If no time separator or it's a part of the label the full name is the result if (pidIndex < 0 || (labelIndex > 0 && labelIndex < pidIndex)) { return fileName; } return fileName.substring(pidIndex + 1); }
[ "public", "static", "String", "parsePIDandLabel", "(", "String", "fileName", ")", "{", "if", "(", "fileName", "==", "null", "||", "fileName", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "int", "pidIndex", "=", "fileName", ".", "indexOf", "(", "TIMESEPARATOR", ")", ";", "int", "labelIndex", "=", "fileName", ".", "indexOf", "(", "LABELSEPARATOR", ")", ";", "// If no time separator or it's a part of the label the full name is the result", "if", "(", "pidIndex", "<", "0", "||", "(", "labelIndex", ">", "0", "&&", "labelIndex", "<", "pidIndex", ")", ")", "{", "return", "fileName", ";", "}", "return", "fileName", ".", "substring", "(", "pidIndex", "+", "1", ")", ";", "}" ]
Retrieves the PID and label combined out of the directory name. @param fileName @return
[ "Retrieves", "the", "PID", "and", "label", "combined", "out", "of", "the", "directory", "name", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryBaseImpl.java#L542-L555
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java
TraceNLS.getFormattedMessageFromLocalizedMessage
public static String getFormattedMessageFromLocalizedMessage(String localizedMessage, Object[] args, boolean quiet) { return TraceNLSResolver.getInstance().getFormattedMessage(localizedMessage, args); }
java
public static String getFormattedMessageFromLocalizedMessage(String localizedMessage, Object[] args, boolean quiet) { return TraceNLSResolver.getInstance().getFormattedMessage(localizedMessage, args); }
[ "public", "static", "String", "getFormattedMessageFromLocalizedMessage", "(", "String", "localizedMessage", ",", "Object", "[", "]", "args", ",", "boolean", "quiet", ")", "{", "return", "TraceNLSResolver", ".", "getInstance", "(", ")", ".", "getFormattedMessage", "(", "localizedMessage", ",", "args", ")", ";", "}" ]
Return the formatted message obtained by substituting parameters passed into a message @param localizedMessage the message into which parameters will be substituted @param args the arguments that will be substituted into the message @param quiet indicates whether or not errors will be logged when encountered @return String a message with parameters substituted in as appropriate
[ "Return", "the", "formatted", "message", "obtained", "by", "substituting", "parameters", "passed", "into", "a", "message" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java#L681-L683
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/Provisioner.java
Provisioner.resolveBundles
public void resolveBundles(BundleContext bContext, List<Bundle> bundlesToResolve) { if (bundlesToResolve == null || bundlesToResolve.size() == 0) { return; } FrameworkWiring wiring = adaptSystemBundle(bContext, FrameworkWiring.class); if (wiring != null) { ResolutionReportHelper rrh = null; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { rrh = new ResolutionReportHelper(); rrh.startHelper(bContext); } try { wiring.resolveBundles(bundlesToResolve); } finally { if (rrh != null) { rrh.stopHelper(); Tr.debug(this, tc, rrh.getResolutionReportString()); } } } }
java
public void resolveBundles(BundleContext bContext, List<Bundle> bundlesToResolve) { if (bundlesToResolve == null || bundlesToResolve.size() == 0) { return; } FrameworkWiring wiring = adaptSystemBundle(bContext, FrameworkWiring.class); if (wiring != null) { ResolutionReportHelper rrh = null; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { rrh = new ResolutionReportHelper(); rrh.startHelper(bContext); } try { wiring.resolveBundles(bundlesToResolve); } finally { if (rrh != null) { rrh.stopHelper(); Tr.debug(this, tc, rrh.getResolutionReportString()); } } } }
[ "public", "void", "resolveBundles", "(", "BundleContext", "bContext", ",", "List", "<", "Bundle", ">", "bundlesToResolve", ")", "{", "if", "(", "bundlesToResolve", "==", "null", "||", "bundlesToResolve", ".", "size", "(", ")", "==", "0", ")", "{", "return", ";", "}", "FrameworkWiring", "wiring", "=", "adaptSystemBundle", "(", "bContext", ",", "FrameworkWiring", ".", "class", ")", ";", "if", "(", "wiring", "!=", "null", ")", "{", "ResolutionReportHelper", "rrh", "=", "null", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "rrh", "=", "new", "ResolutionReportHelper", "(", ")", ";", "rrh", ".", "startHelper", "(", "bContext", ")", ";", "}", "try", "{", "wiring", ".", "resolveBundles", "(", "bundlesToResolve", ")", ";", "}", "finally", "{", "if", "(", "rrh", "!=", "null", ")", "{", "rrh", ".", "stopHelper", "(", ")", ";", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "rrh", ".", "getResolutionReportString", "(", ")", ")", ";", "}", "}", "}", "}" ]
Utility for resolving bundles @param bundlesToResolve
[ "Utility", "for", "resolving", "bundles" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/Provisioner.java#L532-L553
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/Provisioner.java
Provisioner.getBundleLocation
public static String getBundleLocation(String urlString, String productName) { String productNameInfo = (productName != null && !productName.isEmpty()) ? (BUNDLE_LOC_PROD_EXT_TAG + productName + ":") : ""; return BUNDLE_LOC_FEATURE_TAG + productNameInfo + urlString; }
java
public static String getBundleLocation(String urlString, String productName) { String productNameInfo = (productName != null && !productName.isEmpty()) ? (BUNDLE_LOC_PROD_EXT_TAG + productName + ":") : ""; return BUNDLE_LOC_FEATURE_TAG + productNameInfo + urlString; }
[ "public", "static", "String", "getBundleLocation", "(", "String", "urlString", ",", "String", "productName", ")", "{", "String", "productNameInfo", "=", "(", "productName", "!=", "null", "&&", "!", "productName", ".", "isEmpty", "(", ")", ")", "?", "(", "BUNDLE_LOC_PROD_EXT_TAG", "+", "productName", "+", "\":\"", ")", ":", "\"\"", ";", "return", "BUNDLE_LOC_FEATURE_TAG", "+", "productNameInfo", "+", "urlString", ";", "}" ]
Gets the bundle location. The location format is consistent with what SchemaBundle and BundleList. @return The bundle location.
[ "Gets", "the", "bundle", "location", ".", "The", "location", "format", "is", "consistent", "with", "what", "SchemaBundle", "and", "BundleList", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/Provisioner.java#L628-L631
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/Provisioner.java
Provisioner.getRegionName
private String getRegionName(String productName) { if (productName == null || productName.isEmpty()) { return kernelRegion.getName(); } return REGION_EXTENSION_PREFIX + INVALID_REGION_CHARS.matcher(productName).replaceAll("-"); }
java
private String getRegionName(String productName) { if (productName == null || productName.isEmpty()) { return kernelRegion.getName(); } return REGION_EXTENSION_PREFIX + INVALID_REGION_CHARS.matcher(productName).replaceAll("-"); }
[ "private", "String", "getRegionName", "(", "String", "productName", ")", "{", "if", "(", "productName", "==", "null", "||", "productName", ".", "isEmpty", "(", ")", ")", "{", "return", "kernelRegion", ".", "getName", "(", ")", ";", "}", "return", "REGION_EXTENSION_PREFIX", "+", "INVALID_REGION_CHARS", ".", "matcher", "(", "productName", ")", ".", "replaceAll", "(", "\"-\"", ")", ";", "}" ]
Gets the region name according to the product name. @param productName the product name. Empty string or <code>null</code> indicates the liberty profile itself. @return the region name
[ "Gets", "the", "region", "name", "according", "to", "the", "product", "name", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/Provisioner.java#L640-L645
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/config/ConfigEntry.java
ConfigEntry.getESIDependencies
public static String getESIDependencies(Enumeration e1, Enumeration e2) { if ((e1 == null || !e1.hasMoreElements())) if ((e2 == null || !e2.hasMoreElements())) return null; StringBuffer sb = new StringBuffer("dependencies=\""); if (e1 != null) while (e1.hasMoreElements()) { sb.append(" "); sb.append((String) e1.nextElement()); } if (e2 != null) while (e2.hasMoreElements()) { sb.append(" "); sb.append((String) e2.nextElement()); } //don't append a trailing double quote, since we have to add the cache id later return sb.toString(); }
java
public static String getESIDependencies(Enumeration e1, Enumeration e2) { if ((e1 == null || !e1.hasMoreElements())) if ((e2 == null || !e2.hasMoreElements())) return null; StringBuffer sb = new StringBuffer("dependencies=\""); if (e1 != null) while (e1.hasMoreElements()) { sb.append(" "); sb.append((String) e1.nextElement()); } if (e2 != null) while (e2.hasMoreElements()) { sb.append(" "); sb.append((String) e2.nextElement()); } //don't append a trailing double quote, since we have to add the cache id later return sb.toString(); }
[ "public", "static", "String", "getESIDependencies", "(", "Enumeration", "e1", ",", "Enumeration", "e2", ")", "{", "if", "(", "(", "e1", "==", "null", "||", "!", "e1", ".", "hasMoreElements", "(", ")", ")", ")", "if", "(", "(", "e2", "==", "null", "||", "!", "e2", ".", "hasMoreElements", "(", ")", ")", ")", "return", "null", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "\"dependencies=\\\"\"", ")", ";", "if", "(", "e1", "!=", "null", ")", "while", "(", "e1", ".", "hasMoreElements", "(", ")", ")", "{", "sb", ".", "append", "(", "\" \"", ")", ";", "sb", ".", "append", "(", "(", "String", ")", "e1", ".", "nextElement", "(", ")", ")", ";", "}", "if", "(", "e2", "!=", "null", ")", "while", "(", "e2", ".", "hasMoreElements", "(", ")", ")", "{", "sb", ".", "append", "(", "\" \"", ")", ";", "sb", ".", "append", "(", "(", "String", ")", "e2", ".", "nextElement", "(", ")", ")", ";", "}", "//don't append a trailing double quote, since we have to add the cache id later", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
expects an enumeration of data ids and an enumeration of templates
[ "expects", "an", "enumeration", "of", "data", "ids", "and", "an", "enumeration", "of", "templates" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/config/ConfigEntry.java#L127-L144
train
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java
ConfigElementList.getBy
public E getBy(String attributeName, String attributeValue) { String methodName = "get" + Character.toUpperCase(attributeName.charAt(0)) + attributeName.substring(1); for (E element : this) if (element != null) try { Object value = element.getClass().getMethod(methodName).invoke(element); if (value == attributeValue || value != null && value.equals(attributeValue)) return element; } catch (Exception x) { } return null; }
java
public E getBy(String attributeName, String attributeValue) { String methodName = "get" + Character.toUpperCase(attributeName.charAt(0)) + attributeName.substring(1); for (E element : this) if (element != null) try { Object value = element.getClass().getMethod(methodName).invoke(element); if (value == attributeValue || value != null && value.equals(attributeValue)) return element; } catch (Exception x) { } return null; }
[ "public", "E", "getBy", "(", "String", "attributeName", ",", "String", "attributeValue", ")", "{", "String", "methodName", "=", "\"get\"", "+", "Character", ".", "toUpperCase", "(", "attributeName", ".", "charAt", "(", "0", ")", ")", "+", "attributeName", ".", "substring", "(", "1", ")", ";", "for", "(", "E", "element", ":", "this", ")", "if", "(", "element", "!=", "null", ")", "try", "{", "Object", "value", "=", "element", ".", "getClass", "(", ")", ".", "getMethod", "(", "methodName", ")", ".", "invoke", "(", "element", ")", ";", "if", "(", "value", "==", "attributeValue", "||", "value", "!=", "null", "&&", "value", ".", "equals", "(", "attributeValue", ")", ")", "return", "element", ";", "}", "catch", "(", "Exception", "x", ")", "{", "}", "return", "null", ";", "}" ]
Returns the first element in this list with a matching attribute value. @param attributeName the attribute for which to search (Example: jndiName) @param attributeValue the value to match @return the first element in this list with a matching attribute name/value, or null of no such element is found
[ "Returns", "the", "first", "element", "in", "this", "list", "with", "a", "matching", "attribute", "value", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java#L69-L80
train
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java
ConfigElementList.getById
public E getById(String id) { if (id == null) { for (E element : this) { if (element != null && element.getId() == null) { return element; } } } else { for (E element : this) { if (element != null && id.equals(element.getId())) { return element; } } } return null; }
java
public E getById(String id) { if (id == null) { for (E element : this) { if (element != null && element.getId() == null) { return element; } } } else { for (E element : this) { if (element != null && id.equals(element.getId())) { return element; } } } return null; }
[ "public", "E", "getById", "(", "String", "id", ")", "{", "if", "(", "id", "==", "null", ")", "{", "for", "(", "E", "element", ":", "this", ")", "{", "if", "(", "element", "!=", "null", "&&", "element", ".", "getId", "(", ")", "==", "null", ")", "{", "return", "element", ";", "}", "}", "}", "else", "{", "for", "(", "E", "element", ":", "this", ")", "{", "if", "(", "element", "!=", "null", "&&", "id", ".", "equals", "(", "element", ".", "getId", "(", ")", ")", ")", "{", "return", "element", ";", "}", "}", "}", "return", "null", ";", "}" ]
Returns the first element in this list with a matching identifier @param id the identifier to search for @return the first element in this list with a matching identifier, or null of no such element is found
[ "Returns", "the", "first", "element", "in", "this", "list", "with", "a", "matching", "identifier" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java#L88-L103
train
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java
ConfigElementList.removeById
public E removeById(String id) { // traverses the list twice, but reuse code E element = this.getById(id); if (element != null) { this.remove(element); // this should always return true since we already found the element } return element; }
java
public E removeById(String id) { // traverses the list twice, but reuse code E element = this.getById(id); if (element != null) { this.remove(element); // this should always return true since we already found the element } return element; }
[ "public", "E", "removeById", "(", "String", "id", ")", "{", "// traverses the list twice, but reuse code", "E", "element", "=", "this", ".", "getById", "(", "id", ")", ";", "if", "(", "element", "!=", "null", ")", "{", "this", ".", "remove", "(", "element", ")", ";", "// this should always return true since we already found the element", "}", "return", "element", ";", "}" ]
Removes the first element in this list with a matching identifier @param id the identifier to search for @return the removed element, or null of no element was removed
[ "Removes", "the", "first", "element", "in", "this", "list", "with", "a", "matching", "identifier" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java#L127-L134
train
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java
ConfigElementList.getOrCreateById
public E getOrCreateById(String id, Class<E> type) throws IllegalAccessException, InstantiationException { E element = this.getById(id); if (element == null) { element = type.newInstance(); element.setId(id); this.add(element); } return element; }
java
public E getOrCreateById(String id, Class<E> type) throws IllegalAccessException, InstantiationException { E element = this.getById(id); if (element == null) { element = type.newInstance(); element.setId(id); this.add(element); } return element; }
[ "public", "E", "getOrCreateById", "(", "String", "id", ",", "Class", "<", "E", ">", "type", ")", "throws", "IllegalAccessException", ",", "InstantiationException", "{", "E", "element", "=", "this", ".", "getById", "(", "id", ")", ";", "if", "(", "element", "==", "null", ")", "{", "element", "=", "type", ".", "newInstance", "(", ")", ";", "element", ".", "setId", "(", "id", ")", ";", "this", ".", "add", "(", "element", ")", ";", "}", "return", "element", ";", "}" ]
Returns the first element in this list with a matching identifier, or adds a new element to the end of this list and sets the identifier @param id the identifier to search for @param type the type of the element to add when no existing element is found. The type MUST have a public no-argument constructor (but it probably does since JAXB requires it anyway) @return the first element in this list with a matching identifier. Never returns null. @throws InstantiationException if the public no-argument constructor of the element type is not visible @throws IllegalAccessException if the instance could not be created
[ "Returns", "the", "first", "element", "in", "this", "list", "with", "a", "matching", "identifier", "or", "adds", "a", "new", "element", "to", "the", "end", "of", "this", "list", "and", "sets", "the", "identifier" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java#L146-L154
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/trm/TrmMessageType.java
TrmMessageType.getTrmMessageType
public final static TrmMessageType getTrmMessageType(int aValue) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc,"Value = " + aValue); return set[aValue]; }
java
public final static TrmMessageType getTrmMessageType(int aValue) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc,"Value = " + aValue); return set[aValue]; }
[ "public", "final", "static", "TrmMessageType", "getTrmMessageType", "(", "int", "aValue", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Value = \"", "+", "aValue", ")", ";", "return", "set", "[", "aValue", "]", ";", "}" ]
Returns the corresponding TrmMessageType for a given integer. This method should NOT be called by any code outside the MFP component. It is only public so that it can be accessed by sub-packages. @param aValue The integer for which an TrmMessageType is required. @return The corresponding TrmMessageType
[ "Returns", "the", "corresponding", "TrmMessageType", "for", "a", "given", "integer", ".", "This", "method", "should", "NOT", "be", "called", "by", "any", "code", "outside", "the", "MFP", "component", ".", "It", "is", "only", "public", "so", "that", "it", "can", "be", "accessed", "by", "sub", "-", "packages", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/trm/TrmMessageType.java#L59-L62
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceMap.java
ConcurrentServiceReferenceMap.getService
public V getService(K key) { ComponentContext ctx = context; if (ctx == null || key == null) return null; ConcurrentServiceReferenceElement<V> e = elementMap.get(key); if (e == null) { return null; } else { return e.getService(ctx); } }
java
public V getService(K key) { ComponentContext ctx = context; if (ctx == null || key == null) return null; ConcurrentServiceReferenceElement<V> e = elementMap.get(key); if (e == null) { return null; } else { return e.getService(ctx); } }
[ "public", "V", "getService", "(", "K", "key", ")", "{", "ComponentContext", "ctx", "=", "context", ";", "if", "(", "ctx", "==", "null", "||", "key", "==", "null", ")", "return", "null", ";", "ConcurrentServiceReferenceElement", "<", "V", ">", "e", "=", "elementMap", ".", "get", "(", "key", ")", ";", "if", "(", "e", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "e", ".", "getService", "(", "ctx", ")", ";", "}", "}" ]
Retrieve the service associated with key. @param key The key associated with the requested service @return The service if available, null otherwise.
[ "Retrieve", "the", "service", "associated", "with", "key", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceMap.java#L235-L247
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceMap.java
ConcurrentServiceReferenceMap.getReference
public ServiceReference<V> getReference(K key) { if (key == null) return null; ConcurrentServiceReferenceElement<V> e = elementMap.get(key); if (e == null) { return null; } else { return e.getReference(); } }
java
public ServiceReference<V> getReference(K key) { if (key == null) return null; ConcurrentServiceReferenceElement<V> e = elementMap.get(key); if (e == null) { return null; } else { return e.getReference(); } }
[ "public", "ServiceReference", "<", "V", ">", "getReference", "(", "K", "key", ")", "{", "if", "(", "key", "==", "null", ")", "return", "null", ";", "ConcurrentServiceReferenceElement", "<", "V", ">", "e", "=", "elementMap", ".", "get", "(", "key", ")", ";", "if", "(", "e", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "e", ".", "getReference", "(", ")", ";", "}", "}" ]
Returns the ServiceReference associated with key @param key The key associated with the service @return ServiceRerefence associated with key, or null
[ "Returns", "the", "ServiceReference", "associated", "with", "key" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceMap.java#L280-L290
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/provisioning/ProductExtension.java
ProductExtension.getProductExtensions
public static List<ProductExtensionInfo> getProductExtensions(File installDir) { ArrayList<ProductExtensionInfo> productList = new ArrayList<ProductExtensionInfo>(); Set<String> extensionsSoFar = new HashSet<String>(); // Get the embedder SPI product extensions HashMap<String, Properties> embedderProductExtensions = getExtraProductExtensions(); if (embedderProductExtensions != null) { ProductExtensionInfo prodInfo; for (Entry<String, Properties> entry : embedderProductExtensions.entrySet()) { String name = entry.getKey(); Properties featureProperties = entry.getValue(); if (ExtensionConstants.USER_EXTENSION.equalsIgnoreCase(name) == false) { String installLocation = featureProperties.getProperty(ProductExtension.PRODUCT_EXTENSIONS_INSTALL); String productId = featureProperties.getProperty(ProductExtension.PRODUCT_EXTENSIONS_ID); prodInfo = new ProductExtensionInfoImpl(name, productId, installLocation); productList.add(prodInfo); extensionsSoFar.add(name); } } } // Apply any product extensions specified from the WLP_PRODUCT_EXT_DIR environment variable String extensionEnv = System.getenv(PRODUCT_EXTENSIONS_ENV); if (extensionEnv != null) { File productExtensionEnvDir = new File(extensionEnv); if (!!!productExtensionEnvDir.isAbsolute()) { productExtensionEnvDir = getFileFromDirectory(installDir.getParentFile(), extensionEnv); } // Extensions added by the embedder SPI will override extensions from the WLP_PRODUCT_EXT_DIR env of the same name. String envData = mergeExtensions(productList, extensionsSoFar, productExtensionEnvDir); // Push Env Product Extension information found via Env to FrameworkManager for issuing a Message. System.clearProperty(BootstrapConstants.ENV_PRODUCT_EXTENSIONS_ADDED_BY_ENV); if (!!!envData.isEmpty()) { System.setProperty(BootstrapConstants.ENV_PRODUCT_EXTENSIONS_ADDED_BY_ENV, envData); } } // Get the installed etc/extensions. File productExtensionsDir = getExtensionDir(installDir); // Extensions added by the embedder SPI or WLP_PRODUCT_EXT_DIR // will override extensions of the same name that exist in the install root. mergeExtensions(productList, extensionsSoFar, productExtensionsDir); return productList; }
java
public static List<ProductExtensionInfo> getProductExtensions(File installDir) { ArrayList<ProductExtensionInfo> productList = new ArrayList<ProductExtensionInfo>(); Set<String> extensionsSoFar = new HashSet<String>(); // Get the embedder SPI product extensions HashMap<String, Properties> embedderProductExtensions = getExtraProductExtensions(); if (embedderProductExtensions != null) { ProductExtensionInfo prodInfo; for (Entry<String, Properties> entry : embedderProductExtensions.entrySet()) { String name = entry.getKey(); Properties featureProperties = entry.getValue(); if (ExtensionConstants.USER_EXTENSION.equalsIgnoreCase(name) == false) { String installLocation = featureProperties.getProperty(ProductExtension.PRODUCT_EXTENSIONS_INSTALL); String productId = featureProperties.getProperty(ProductExtension.PRODUCT_EXTENSIONS_ID); prodInfo = new ProductExtensionInfoImpl(name, productId, installLocation); productList.add(prodInfo); extensionsSoFar.add(name); } } } // Apply any product extensions specified from the WLP_PRODUCT_EXT_DIR environment variable String extensionEnv = System.getenv(PRODUCT_EXTENSIONS_ENV); if (extensionEnv != null) { File productExtensionEnvDir = new File(extensionEnv); if (!!!productExtensionEnvDir.isAbsolute()) { productExtensionEnvDir = getFileFromDirectory(installDir.getParentFile(), extensionEnv); } // Extensions added by the embedder SPI will override extensions from the WLP_PRODUCT_EXT_DIR env of the same name. String envData = mergeExtensions(productList, extensionsSoFar, productExtensionEnvDir); // Push Env Product Extension information found via Env to FrameworkManager for issuing a Message. System.clearProperty(BootstrapConstants.ENV_PRODUCT_EXTENSIONS_ADDED_BY_ENV); if (!!!envData.isEmpty()) { System.setProperty(BootstrapConstants.ENV_PRODUCT_EXTENSIONS_ADDED_BY_ENV, envData); } } // Get the installed etc/extensions. File productExtensionsDir = getExtensionDir(installDir); // Extensions added by the embedder SPI or WLP_PRODUCT_EXT_DIR // will override extensions of the same name that exist in the install root. mergeExtensions(productList, extensionsSoFar, productExtensionsDir); return productList; }
[ "public", "static", "List", "<", "ProductExtensionInfo", ">", "getProductExtensions", "(", "File", "installDir", ")", "{", "ArrayList", "<", "ProductExtensionInfo", ">", "productList", "=", "new", "ArrayList", "<", "ProductExtensionInfo", ">", "(", ")", ";", "Set", "<", "String", ">", "extensionsSoFar", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "// Get the embedder SPI product extensions", "HashMap", "<", "String", ",", "Properties", ">", "embedderProductExtensions", "=", "getExtraProductExtensions", "(", ")", ";", "if", "(", "embedderProductExtensions", "!=", "null", ")", "{", "ProductExtensionInfo", "prodInfo", ";", "for", "(", "Entry", "<", "String", ",", "Properties", ">", "entry", ":", "embedderProductExtensions", ".", "entrySet", "(", ")", ")", "{", "String", "name", "=", "entry", ".", "getKey", "(", ")", ";", "Properties", "featureProperties", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "ExtensionConstants", ".", "USER_EXTENSION", ".", "equalsIgnoreCase", "(", "name", ")", "==", "false", ")", "{", "String", "installLocation", "=", "featureProperties", ".", "getProperty", "(", "ProductExtension", ".", "PRODUCT_EXTENSIONS_INSTALL", ")", ";", "String", "productId", "=", "featureProperties", ".", "getProperty", "(", "ProductExtension", ".", "PRODUCT_EXTENSIONS_ID", ")", ";", "prodInfo", "=", "new", "ProductExtensionInfoImpl", "(", "name", ",", "productId", ",", "installLocation", ")", ";", "productList", ".", "add", "(", "prodInfo", ")", ";", "extensionsSoFar", ".", "add", "(", "name", ")", ";", "}", "}", "}", "// Apply any product extensions specified from the WLP_PRODUCT_EXT_DIR environment variable", "String", "extensionEnv", "=", "System", ".", "getenv", "(", "PRODUCT_EXTENSIONS_ENV", ")", ";", "if", "(", "extensionEnv", "!=", "null", ")", "{", "File", "productExtensionEnvDir", "=", "new", "File", "(", "extensionEnv", ")", ";", "if", "(", "!", "!", "!", "productExtensionEnvDir", ".", "isAbsolute", "(", ")", ")", "{", "productExtensionEnvDir", "=", "getFileFromDirectory", "(", "installDir", ".", "getParentFile", "(", ")", ",", "extensionEnv", ")", ";", "}", "// Extensions added by the embedder SPI will override extensions from the WLP_PRODUCT_EXT_DIR env of the same name.", "String", "envData", "=", "mergeExtensions", "(", "productList", ",", "extensionsSoFar", ",", "productExtensionEnvDir", ")", ";", "// Push Env Product Extension information found via Env to FrameworkManager for issuing a Message.", "System", ".", "clearProperty", "(", "BootstrapConstants", ".", "ENV_PRODUCT_EXTENSIONS_ADDED_BY_ENV", ")", ";", "if", "(", "!", "!", "!", "envData", ".", "isEmpty", "(", ")", ")", "{", "System", ".", "setProperty", "(", "BootstrapConstants", ".", "ENV_PRODUCT_EXTENSIONS_ADDED_BY_ENV", ",", "envData", ")", ";", "}", "}", "// Get the installed etc/extensions.", "File", "productExtensionsDir", "=", "getExtensionDir", "(", "installDir", ")", ";", "// Extensions added by the embedder SPI or WLP_PRODUCT_EXT_DIR", "// will override extensions of the same name that exist in the install root.", "mergeExtensions", "(", "productList", ",", "extensionsSoFar", ",", "productExtensionsDir", ")", ";", "return", "productList", ";", "}" ]
Get a list of configured product extensions. Merge any Product Extensions from: 1) Embedder SPI; 2) WLP_PRODUCT_EXT_DIR environment variable; and 3) etc/extensions. The order listed is the order of override when gathering the list of ProductExtensionInfo. @param installDir File representing the install path. @return List of ProductExtensionInfo objects.
[ "Get", "a", "list", "of", "configured", "product", "extensions", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/provisioning/ProductExtension.java#L87-L134
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/provisioning/ProductExtension.java
ProductExtension.getProductExtension
public static ProductExtensionInfo getProductExtension(String extensionName) throws IOException { ProductExtensionInfo productExtensionInfo = null; List<ProductExtensionInfo> productExtensionList = getProductExtensions(Utils.getInstallDir()); for (ProductExtensionInfo currentProductExtension : productExtensionList) { if (currentProductExtension.getName().equalsIgnoreCase(extensionName)) { productExtensionInfo = currentProductExtension; break; } } return productExtensionInfo; }
java
public static ProductExtensionInfo getProductExtension(String extensionName) throws IOException { ProductExtensionInfo productExtensionInfo = null; List<ProductExtensionInfo> productExtensionList = getProductExtensions(Utils.getInstallDir()); for (ProductExtensionInfo currentProductExtension : productExtensionList) { if (currentProductExtension.getName().equalsIgnoreCase(extensionName)) { productExtensionInfo = currentProductExtension; break; } } return productExtensionInfo; }
[ "public", "static", "ProductExtensionInfo", "getProductExtension", "(", "String", "extensionName", ")", "throws", "IOException", "{", "ProductExtensionInfo", "productExtensionInfo", "=", "null", ";", "List", "<", "ProductExtensionInfo", ">", "productExtensionList", "=", "getProductExtensions", "(", "Utils", ".", "getInstallDir", "(", ")", ")", ";", "for", "(", "ProductExtensionInfo", "currentProductExtension", ":", "productExtensionList", ")", "{", "if", "(", "currentProductExtension", ".", "getName", "(", ")", ".", "equalsIgnoreCase", "(", "extensionName", ")", ")", "{", "productExtensionInfo", "=", "currentProductExtension", ";", "break", ";", "}", "}", "return", "productExtensionInfo", ";", "}" ]
Find and return a particular configured product extension. @return
[ "Find", "and", "return", "a", "particular", "configured", "product", "extension", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/provisioning/ProductExtension.java#L197-L210
train
OpenLiberty/open-liberty
dev/com.ibm.ws.org.apache.aries.jndi.core/src/org/apache/aries/jndi/startup/Activator.java
Activator.start
@Override public void start(BundleContext context) { initialContextFactories = initServiceTracker(context, InitialContextFactory.class, ServiceTrackerCustomizers.ICF_CACHE); objectFactories = initServiceTracker(context, ObjectFactory.class, ServiceTrackerCustomizers.URL_FACTORY_CACHE); icfBuilders = initServiceTracker(context, InitialContextFactoryBuilder.class, ServiceTrackerCustomizers.LAZY); urlObjectFactoryFinders = initServiceTracker(context, URLObjectFactoryFinder.class, ServiceTrackerCustomizers.LAZY); environmentAugmentors = initServiceTracker(context, EnvironmentAugmentation.class, null); environmentUnaugmentors = initServiceTracker(context, EnvironmentUnaugmentation.class, null); try { OSGiInitialContextFactoryBuilder builder = new OSGiInitialContextFactoryBuilder(); setField(InitialContextFactoryBuilder.class, builder, true); icfBuilder = builder; } catch (IllegalStateException e) { // Log the problem at info level, but only log the exception at debug level, as in many cases this is not a real issue and people // don't want to see stack traces at info level when everything it working as expected. LOGGER.info(Utils.MESSAGES.getMessage("unable.to.set.static.ICFB.already.exists", getClassName(InitialContextFactoryBuilder.class))); LOGGER.debug(Utils.MESSAGES.getMessage("unable.to.set.static.ICFB.already.exists", getClassName(InitialContextFactoryBuilder.class)), e); } try { OSGiObjectFactoryBuilder builder = new OSGiObjectFactoryBuilder(context); setField(ObjectFactoryBuilder.class, builder, true); ofBuilder = builder; } catch (IllegalStateException e) { // Log the problem at info level, but only log the exception at debug level, as in many cases this is not a real issue and people // don't want to see stack traces at info level when everything it working as expected. LOGGER.info(Utils.MESSAGES.getMessage("unable.to.set.static.OFB.already.exists", getClassName(ObjectFactoryBuilder.class))); LOGGER.debug(Utils.MESSAGES.getMessage("unable.to.set.static.OFB.already.exists", getClassName(ObjectFactoryBuilder.class)), e); } context.registerService(JNDIProviderAdmin.class.getName(), new ProviderAdminServiceFactory(context), null); context.registerService(InitialContextFactoryBuilder.class.getName(), new JREInitialContextFactoryBuilder(), null); context.registerService(JNDIContextManager.class.getName(), new ContextManagerServiceFactory(), null); context.registerService(AugmenterInvoker.class.getName(), AugmenterInvokerImpl.getInstance(), null); //Start the bundletracker that clears out the cache. (only interested in stopping events) // bt = new BundleTracker(context, Bundle.STOPPING, new ServiceTrackerCustomizers.CacheBundleTrackerCustomizer()); // bt.open(); }
java
@Override public void start(BundleContext context) { initialContextFactories = initServiceTracker(context, InitialContextFactory.class, ServiceTrackerCustomizers.ICF_CACHE); objectFactories = initServiceTracker(context, ObjectFactory.class, ServiceTrackerCustomizers.URL_FACTORY_CACHE); icfBuilders = initServiceTracker(context, InitialContextFactoryBuilder.class, ServiceTrackerCustomizers.LAZY); urlObjectFactoryFinders = initServiceTracker(context, URLObjectFactoryFinder.class, ServiceTrackerCustomizers.LAZY); environmentAugmentors = initServiceTracker(context, EnvironmentAugmentation.class, null); environmentUnaugmentors = initServiceTracker(context, EnvironmentUnaugmentation.class, null); try { OSGiInitialContextFactoryBuilder builder = new OSGiInitialContextFactoryBuilder(); setField(InitialContextFactoryBuilder.class, builder, true); icfBuilder = builder; } catch (IllegalStateException e) { // Log the problem at info level, but only log the exception at debug level, as in many cases this is not a real issue and people // don't want to see stack traces at info level when everything it working as expected. LOGGER.info(Utils.MESSAGES.getMessage("unable.to.set.static.ICFB.already.exists", getClassName(InitialContextFactoryBuilder.class))); LOGGER.debug(Utils.MESSAGES.getMessage("unable.to.set.static.ICFB.already.exists", getClassName(InitialContextFactoryBuilder.class)), e); } try { OSGiObjectFactoryBuilder builder = new OSGiObjectFactoryBuilder(context); setField(ObjectFactoryBuilder.class, builder, true); ofBuilder = builder; } catch (IllegalStateException e) { // Log the problem at info level, but only log the exception at debug level, as in many cases this is not a real issue and people // don't want to see stack traces at info level when everything it working as expected. LOGGER.info(Utils.MESSAGES.getMessage("unable.to.set.static.OFB.already.exists", getClassName(ObjectFactoryBuilder.class))); LOGGER.debug(Utils.MESSAGES.getMessage("unable.to.set.static.OFB.already.exists", getClassName(ObjectFactoryBuilder.class)), e); } context.registerService(JNDIProviderAdmin.class.getName(), new ProviderAdminServiceFactory(context), null); context.registerService(InitialContextFactoryBuilder.class.getName(), new JREInitialContextFactoryBuilder(), null); context.registerService(JNDIContextManager.class.getName(), new ContextManagerServiceFactory(), null); context.registerService(AugmenterInvoker.class.getName(), AugmenterInvokerImpl.getInstance(), null); //Start the bundletracker that clears out the cache. (only interested in stopping events) // bt = new BundleTracker(context, Bundle.STOPPING, new ServiceTrackerCustomizers.CacheBundleTrackerCustomizer()); // bt.open(); }
[ "@", "Override", "public", "void", "start", "(", "BundleContext", "context", ")", "{", "initialContextFactories", "=", "initServiceTracker", "(", "context", ",", "InitialContextFactory", ".", "class", ",", "ServiceTrackerCustomizers", ".", "ICF_CACHE", ")", ";", "objectFactories", "=", "initServiceTracker", "(", "context", ",", "ObjectFactory", ".", "class", ",", "ServiceTrackerCustomizers", ".", "URL_FACTORY_CACHE", ")", ";", "icfBuilders", "=", "initServiceTracker", "(", "context", ",", "InitialContextFactoryBuilder", ".", "class", ",", "ServiceTrackerCustomizers", ".", "LAZY", ")", ";", "urlObjectFactoryFinders", "=", "initServiceTracker", "(", "context", ",", "URLObjectFactoryFinder", ".", "class", ",", "ServiceTrackerCustomizers", ".", "LAZY", ")", ";", "environmentAugmentors", "=", "initServiceTracker", "(", "context", ",", "EnvironmentAugmentation", ".", "class", ",", "null", ")", ";", "environmentUnaugmentors", "=", "initServiceTracker", "(", "context", ",", "EnvironmentUnaugmentation", ".", "class", ",", "null", ")", ";", "try", "{", "OSGiInitialContextFactoryBuilder", "builder", "=", "new", "OSGiInitialContextFactoryBuilder", "(", ")", ";", "setField", "(", "InitialContextFactoryBuilder", ".", "class", ",", "builder", ",", "true", ")", ";", "icfBuilder", "=", "builder", ";", "}", "catch", "(", "IllegalStateException", "e", ")", "{", "// Log the problem at info level, but only log the exception at debug level, as in many cases this is not a real issue and people", "// don't want to see stack traces at info level when everything it working as expected.", "LOGGER", ".", "info", "(", "Utils", ".", "MESSAGES", ".", "getMessage", "(", "\"unable.to.set.static.ICFB.already.exists\"", ",", "getClassName", "(", "InitialContextFactoryBuilder", ".", "class", ")", ")", ")", ";", "LOGGER", ".", "debug", "(", "Utils", ".", "MESSAGES", ".", "getMessage", "(", "\"unable.to.set.static.ICFB.already.exists\"", ",", "getClassName", "(", "InitialContextFactoryBuilder", ".", "class", ")", ")", ",", "e", ")", ";", "}", "try", "{", "OSGiObjectFactoryBuilder", "builder", "=", "new", "OSGiObjectFactoryBuilder", "(", "context", ")", ";", "setField", "(", "ObjectFactoryBuilder", ".", "class", ",", "builder", ",", "true", ")", ";", "ofBuilder", "=", "builder", ";", "}", "catch", "(", "IllegalStateException", "e", ")", "{", "// Log the problem at info level, but only log the exception at debug level, as in many cases this is not a real issue and people", "// don't want to see stack traces at info level when everything it working as expected.", "LOGGER", ".", "info", "(", "Utils", ".", "MESSAGES", ".", "getMessage", "(", "\"unable.to.set.static.OFB.already.exists\"", ",", "getClassName", "(", "ObjectFactoryBuilder", ".", "class", ")", ")", ")", ";", "LOGGER", ".", "debug", "(", "Utils", ".", "MESSAGES", ".", "getMessage", "(", "\"unable.to.set.static.OFB.already.exists\"", ",", "getClassName", "(", "ObjectFactoryBuilder", ".", "class", ")", ")", ",", "e", ")", ";", "}", "context", ".", "registerService", "(", "JNDIProviderAdmin", ".", "class", ".", "getName", "(", ")", ",", "new", "ProviderAdminServiceFactory", "(", "context", ")", ",", "null", ")", ";", "context", ".", "registerService", "(", "InitialContextFactoryBuilder", ".", "class", ".", "getName", "(", ")", ",", "new", "JREInitialContextFactoryBuilder", "(", ")", ",", "null", ")", ";", "context", ".", "registerService", "(", "JNDIContextManager", ".", "class", ".", "getName", "(", ")", ",", "new", "ContextManagerServiceFactory", "(", ")", ",", "null", ")", ";", "context", ".", "registerService", "(", "AugmenterInvoker", ".", "class", ".", "getName", "(", ")", ",", "AugmenterInvokerImpl", ".", "getInstance", "(", ")", ",", "null", ")", ";", "//Start the bundletracker that clears out the cache. (only interested in stopping events)", "// bt = new BundleTracker(context, Bundle.STOPPING, new ServiceTrackerCustomizers.CacheBundleTrackerCustomizer());", "// bt.open();", "}" ]
private BundleTracker bt = null;
[ "private", "BundleTracker", "bt", "=", "null", ";" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.aries.jndi.core/src/org/apache/aries/jndi/startup/Activator.java#L83-L134
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java
URBridge.initialize
public void initialize(Map<String, Object> configProps) throws WIMException { try { reposId = (String) configProps.get(KEY_ID); setCustomProperties((List<Map<String, String>>) configProps.get(ConfigConstants.CONFIG_DO_CUSTOM_PROPERTIES)); setMapping(); setBaseEntry(configProps); setConfigEntityMapping(configProps); propsMap = new HashMap<String, String>(); propsMap.putAll(attrMap); propsMap.putAll(customPropertyMap); URBridgeHelper.mapSupportedEntityTypeList(getSupportedEntityTypes()); personAccountType = URBridgeHelper.getPersonAccountType(); groupAccountType = URBridgeHelper.getGroupAccountType(); /* * Properties supportedRegistries = new Properties(); * String registryImplClass = customPropertyMap.get(URBridgeConstants.CUSTOM_REGISTRY_IMPL_CLASS) == null * ? null : (String) customPropertyMap.get(URBridgeConstants.CUSTOM_REGISTRY_IMPL_CLASS); * * if (registryImplClass == null) { * String osType = System.getProperty("os.name"); * if (osType.startsWith("Windows")) { * osType = "Windows"; * } * supportedRegistries.load(getClass().getResourceAsStream(registryPropsFile)); * registryImplClass = supportedRegistries.getProperty(osType); * } * if (registryImplClass == null) { * throw new WIMApplicationException(WIMMessageKey.MISSING_OR_INVALID_CUSTOM_REGISTRY_CLASS_NAME, * Tr.formatMessage(tc, WIMMessageKey.MISSING_OR_INVALID_CUSTOM_REGISTRY_CLASS_NAME, * WIMMessageHelper.generateMsgParms(registryImplClass))); * } * * ClassLoader contextCL = Thread.currentThread().getContextClassLoader(); * if (contextCL == null) { * contextCL = this.getClass().getClassLoader(); * } * * Class wrapperClass = Class.forName(registryImplClass, true, contextCL); * Object wrapperObj = wrapperClass.newInstance(); * * if (wrapperObj instanceof UserRegistry) { * userRegistry = (UserRegistry) wrapperObj; * Properties initProperties = new Properties(); * initProperties.putAll(customPropertyMap); * userRegistry.initialize(initProperties); * } * else { * throw new WIMApplicationException(WIMMessageKey.MISSING_OR_INVALID_CUSTOM_REGISTRY_CLASS_NAME, * Tr.formatMessage(tc, WIMMessageKey.MISSING_OR_INVALID_CUSTOM_REGISTRY_CLASS_NAME, * WIMMessageHelper.generateMsgParms(registryImplClass))); * } */ } catch (Throwable th) { throw new InitializationException(WIMMessageKey.REPOSITORY_INITIALIZATION_FAILED, Tr.formatMessage(tc, WIMMessageKey.REPOSITORY_INITIALIZATION_FAILED, WIMMessageHelper.generateMsgParms(reposId, th.toString()))); } }
java
public void initialize(Map<String, Object> configProps) throws WIMException { try { reposId = (String) configProps.get(KEY_ID); setCustomProperties((List<Map<String, String>>) configProps.get(ConfigConstants.CONFIG_DO_CUSTOM_PROPERTIES)); setMapping(); setBaseEntry(configProps); setConfigEntityMapping(configProps); propsMap = new HashMap<String, String>(); propsMap.putAll(attrMap); propsMap.putAll(customPropertyMap); URBridgeHelper.mapSupportedEntityTypeList(getSupportedEntityTypes()); personAccountType = URBridgeHelper.getPersonAccountType(); groupAccountType = URBridgeHelper.getGroupAccountType(); /* * Properties supportedRegistries = new Properties(); * String registryImplClass = customPropertyMap.get(URBridgeConstants.CUSTOM_REGISTRY_IMPL_CLASS) == null * ? null : (String) customPropertyMap.get(URBridgeConstants.CUSTOM_REGISTRY_IMPL_CLASS); * * if (registryImplClass == null) { * String osType = System.getProperty("os.name"); * if (osType.startsWith("Windows")) { * osType = "Windows"; * } * supportedRegistries.load(getClass().getResourceAsStream(registryPropsFile)); * registryImplClass = supportedRegistries.getProperty(osType); * } * if (registryImplClass == null) { * throw new WIMApplicationException(WIMMessageKey.MISSING_OR_INVALID_CUSTOM_REGISTRY_CLASS_NAME, * Tr.formatMessage(tc, WIMMessageKey.MISSING_OR_INVALID_CUSTOM_REGISTRY_CLASS_NAME, * WIMMessageHelper.generateMsgParms(registryImplClass))); * } * * ClassLoader contextCL = Thread.currentThread().getContextClassLoader(); * if (contextCL == null) { * contextCL = this.getClass().getClassLoader(); * } * * Class wrapperClass = Class.forName(registryImplClass, true, contextCL); * Object wrapperObj = wrapperClass.newInstance(); * * if (wrapperObj instanceof UserRegistry) { * userRegistry = (UserRegistry) wrapperObj; * Properties initProperties = new Properties(); * initProperties.putAll(customPropertyMap); * userRegistry.initialize(initProperties); * } * else { * throw new WIMApplicationException(WIMMessageKey.MISSING_OR_INVALID_CUSTOM_REGISTRY_CLASS_NAME, * Tr.formatMessage(tc, WIMMessageKey.MISSING_OR_INVALID_CUSTOM_REGISTRY_CLASS_NAME, * WIMMessageHelper.generateMsgParms(registryImplClass))); * } */ } catch (Throwable th) { throw new InitializationException(WIMMessageKey.REPOSITORY_INITIALIZATION_FAILED, Tr.formatMessage(tc, WIMMessageKey.REPOSITORY_INITIALIZATION_FAILED, WIMMessageHelper.generateMsgParms(reposId, th.toString()))); } }
[ "public", "void", "initialize", "(", "Map", "<", "String", ",", "Object", ">", "configProps", ")", "throws", "WIMException", "{", "try", "{", "reposId", "=", "(", "String", ")", "configProps", ".", "get", "(", "KEY_ID", ")", ";", "setCustomProperties", "(", "(", "List", "<", "Map", "<", "String", ",", "String", ">", ">", ")", "configProps", ".", "get", "(", "ConfigConstants", ".", "CONFIG_DO_CUSTOM_PROPERTIES", ")", ")", ";", "setMapping", "(", ")", ";", "setBaseEntry", "(", "configProps", ")", ";", "setConfigEntityMapping", "(", "configProps", ")", ";", "propsMap", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "propsMap", ".", "putAll", "(", "attrMap", ")", ";", "propsMap", ".", "putAll", "(", "customPropertyMap", ")", ";", "URBridgeHelper", ".", "mapSupportedEntityTypeList", "(", "getSupportedEntityTypes", "(", ")", ")", ";", "personAccountType", "=", "URBridgeHelper", ".", "getPersonAccountType", "(", ")", ";", "groupAccountType", "=", "URBridgeHelper", ".", "getGroupAccountType", "(", ")", ";", "/*\n * Properties supportedRegistries = new Properties();\n * String registryImplClass = customPropertyMap.get(URBridgeConstants.CUSTOM_REGISTRY_IMPL_CLASS) == null\n * ? null : (String) customPropertyMap.get(URBridgeConstants.CUSTOM_REGISTRY_IMPL_CLASS);\n *\n * if (registryImplClass == null) {\n * String osType = System.getProperty(\"os.name\");\n * if (osType.startsWith(\"Windows\")) {\n * osType = \"Windows\";\n * }\n * supportedRegistries.load(getClass().getResourceAsStream(registryPropsFile));\n * registryImplClass = supportedRegistries.getProperty(osType);\n * }\n * if (registryImplClass == null) {\n * throw new WIMApplicationException(WIMMessageKey.MISSING_OR_INVALID_CUSTOM_REGISTRY_CLASS_NAME,\n * Tr.formatMessage(tc, WIMMessageKey.MISSING_OR_INVALID_CUSTOM_REGISTRY_CLASS_NAME,\n * WIMMessageHelper.generateMsgParms(registryImplClass)));\n * }\n *\n * ClassLoader contextCL = Thread.currentThread().getContextClassLoader();\n * if (contextCL == null) {\n * contextCL = this.getClass().getClassLoader();\n * }\n *\n * Class wrapperClass = Class.forName(registryImplClass, true, contextCL);\n * Object wrapperObj = wrapperClass.newInstance();\n *\n * if (wrapperObj instanceof UserRegistry) {\n * userRegistry = (UserRegistry) wrapperObj;\n * Properties initProperties = new Properties();\n * initProperties.putAll(customPropertyMap);\n * userRegistry.initialize(initProperties);\n * }\n * else {\n * throw new WIMApplicationException(WIMMessageKey.MISSING_OR_INVALID_CUSTOM_REGISTRY_CLASS_NAME,\n * Tr.formatMessage(tc, WIMMessageKey.MISSING_OR_INVALID_CUSTOM_REGISTRY_CLASS_NAME,\n * WIMMessageHelper.generateMsgParms(registryImplClass)));\n * }\n */", "}", "catch", "(", "Throwable", "th", ")", "{", "throw", "new", "InitializationException", "(", "WIMMessageKey", ".", "REPOSITORY_INITIALIZATION_FAILED", ",", "Tr", ".", "formatMessage", "(", "tc", ",", "WIMMessageKey", ".", "REPOSITORY_INITIALIZATION_FAILED", ",", "WIMMessageHelper", ".", "generateMsgParms", "(", "reposId", ",", "th", ".", "toString", "(", ")", ")", ")", ")", ";", "}", "}" ]
Initializes the user registry for use by the adapter. @param configProps @return
[ "Initializes", "the", "user", "registry", "for", "use", "by", "the", "adapter", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java#L226-L283
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java
URBridge.setBaseEntry
private void setBaseEntry(Map<String, Object> configProps) throws WIMException { /* * Map<String, List<Map<String, Object>>> configMap = Nester.nest(configProps, BASE_ENTRY); * * for (Map<String, Object> entry : configMap.get(BASE_ENTRY)) { * baseEntryName = (String) entry.get(BASE_ENTRY_NAME); * } */ baseEntryName = (String) configProps.get(BASE_ENTRY); if (baseEntryName == null) { throw new WIMApplicationException(WIMMessageKey.MISSING_BASE_ENTRY, Tr.formatMessage(tc, WIMMessageKey.MISSING_BASE_ENTRY, WIMMessageHelper.generateMsgParms(reposId))); } }
java
private void setBaseEntry(Map<String, Object> configProps) throws WIMException { /* * Map<String, List<Map<String, Object>>> configMap = Nester.nest(configProps, BASE_ENTRY); * * for (Map<String, Object> entry : configMap.get(BASE_ENTRY)) { * baseEntryName = (String) entry.get(BASE_ENTRY_NAME); * } */ baseEntryName = (String) configProps.get(BASE_ENTRY); if (baseEntryName == null) { throw new WIMApplicationException(WIMMessageKey.MISSING_BASE_ENTRY, Tr.formatMessage(tc, WIMMessageKey.MISSING_BASE_ENTRY, WIMMessageHelper.generateMsgParms(reposId))); } }
[ "private", "void", "setBaseEntry", "(", "Map", "<", "String", ",", "Object", ">", "configProps", ")", "throws", "WIMException", "{", "/*\n * Map<String, List<Map<String, Object>>> configMap = Nester.nest(configProps, BASE_ENTRY);\n *\n * for (Map<String, Object> entry : configMap.get(BASE_ENTRY)) {\n * baseEntryName = (String) entry.get(BASE_ENTRY_NAME);\n * }\n */", "baseEntryName", "=", "(", "String", ")", "configProps", ".", "get", "(", "BASE_ENTRY", ")", ";", "if", "(", "baseEntryName", "==", "null", ")", "{", "throw", "new", "WIMApplicationException", "(", "WIMMessageKey", ".", "MISSING_BASE_ENTRY", ",", "Tr", ".", "formatMessage", "(", "tc", ",", "WIMMessageKey", ".", "MISSING_BASE_ENTRY", ",", "WIMMessageHelper", ".", "generateMsgParms", "(", "reposId", ")", ")", ")", ";", "}", "}" ]
Set the baseEntryname from the configuration. The configuration should have only 1 baseEntry @param configProps Map containing the configuration information for the baseEntries. @throws WIMException Exception is thrown if no baseEntry is set.
[ "Set", "the", "baseEntryname", "from", "the", "configuration", ".", "The", "configuration", "should", "have", "only", "1", "baseEntry" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java#L293-L307
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java
URBridge.setCustomProperties
private void setCustomProperties(List<Map<String, String>> propList) throws WIMException { final String METHODNAME = "setCustomProperties"; customPropertyMap = new HashMap<String, String>(); if (propList == null) { return; } Iterator<Map<String, String>> itr = propList.iterator(); while (itr.hasNext()) { Map<String, String> propMap = itr.next(); String propName = propMap.get(ConfigConstants.CONFIG_PROP_NAME); // String propValue = expandVar(propMap.get(ConfigConstants.CONFIG_PROP_VALUE)); String propValue = propMap.get(ConfigConstants.CONFIG_PROP_VALUE); customPropertyMap.put(propName, propValue); } if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " custom properties " + customPropertyMap); } }
java
private void setCustomProperties(List<Map<String, String>> propList) throws WIMException { final String METHODNAME = "setCustomProperties"; customPropertyMap = new HashMap<String, String>(); if (propList == null) { return; } Iterator<Map<String, String>> itr = propList.iterator(); while (itr.hasNext()) { Map<String, String> propMap = itr.next(); String propName = propMap.get(ConfigConstants.CONFIG_PROP_NAME); // String propValue = expandVar(propMap.get(ConfigConstants.CONFIG_PROP_VALUE)); String propValue = propMap.get(ConfigConstants.CONFIG_PROP_VALUE); customPropertyMap.put(propName, propValue); } if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " custom properties " + customPropertyMap); } }
[ "private", "void", "setCustomProperties", "(", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "propList", ")", "throws", "WIMException", "{", "final", "String", "METHODNAME", "=", "\"setCustomProperties\"", ";", "customPropertyMap", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "if", "(", "propList", "==", "null", ")", "{", "return", ";", "}", "Iterator", "<", "Map", "<", "String", ",", "String", ">", ">", "itr", "=", "propList", ".", "iterator", "(", ")", ";", "while", "(", "itr", ".", "hasNext", "(", ")", ")", "{", "Map", "<", "String", ",", "String", ">", "propMap", "=", "itr", ".", "next", "(", ")", ";", "String", "propName", "=", "propMap", ".", "get", "(", "ConfigConstants", ".", "CONFIG_PROP_NAME", ")", ";", "// String propValue = expandVar(propMap.get(ConfigConstants.CONFIG_PROP_VALUE));", "String", "propValue", "=", "propMap", ".", "get", "(", "ConfigConstants", ".", "CONFIG_PROP_VALUE", ")", ";", "customPropertyMap", ".", "put", "(", "propName", ",", "propValue", ")", ";", "}", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "METHODNAME", "+", "\" custom properties \"", "+", "customPropertyMap", ")", ";", "}", "}" ]
Set Custom UR Bridge properties. @param propList @throws WIMException
[ "Set", "Custom", "UR", "Bridge", "properties", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java#L315-L333
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java
URBridge.setConfigEntityMapping
private void setConfigEntityMapping(Map<String, Object> configProps) throws WIMException { List<String> entityTypes = getSupportedEntityTypes(); String rdnProp; String type = null; entityConfigMap = new HashMap<String, String>(); for (int i = 0; i < entityTypes.size(); i++) { type = entityTypes.get(i); rdnProp = (getRDNProperties(type) == null) ? null : getRDNProperties(type)[0]; entityConfigMap.put(type, rdnProp); } if (entityConfigMap.get(Service.DO_LOGIN_ACCOUNT) == null && entityConfigMap.get(personAccountType) != null) entityConfigMap.put(Service.DO_LOGIN_ACCOUNT, entityConfigMap.get(personAccountType)); if (tc.isDebugEnabled()) Tr.debug(tc, "setConfigEntityMapping entityConfigMap:" + entityConfigMap); }
java
private void setConfigEntityMapping(Map<String, Object> configProps) throws WIMException { List<String> entityTypes = getSupportedEntityTypes(); String rdnProp; String type = null; entityConfigMap = new HashMap<String, String>(); for (int i = 0; i < entityTypes.size(); i++) { type = entityTypes.get(i); rdnProp = (getRDNProperties(type) == null) ? null : getRDNProperties(type)[0]; entityConfigMap.put(type, rdnProp); } if (entityConfigMap.get(Service.DO_LOGIN_ACCOUNT) == null && entityConfigMap.get(personAccountType) != null) entityConfigMap.put(Service.DO_LOGIN_ACCOUNT, entityConfigMap.get(personAccountType)); if (tc.isDebugEnabled()) Tr.debug(tc, "setConfigEntityMapping entityConfigMap:" + entityConfigMap); }
[ "private", "void", "setConfigEntityMapping", "(", "Map", "<", "String", ",", "Object", ">", "configProps", ")", "throws", "WIMException", "{", "List", "<", "String", ">", "entityTypes", "=", "getSupportedEntityTypes", "(", ")", ";", "String", "rdnProp", ";", "String", "type", "=", "null", ";", "entityConfigMap", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entityTypes", ".", "size", "(", ")", ";", "i", "++", ")", "{", "type", "=", "entityTypes", ".", "get", "(", "i", ")", ";", "rdnProp", "=", "(", "getRDNProperties", "(", "type", ")", "==", "null", ")", "?", "null", ":", "getRDNProperties", "(", "type", ")", "[", "0", "]", ";", "entityConfigMap", ".", "put", "(", "type", ",", "rdnProp", ")", ";", "}", "if", "(", "entityConfigMap", ".", "get", "(", "Service", ".", "DO_LOGIN_ACCOUNT", ")", "==", "null", "&&", "entityConfigMap", ".", "get", "(", "personAccountType", ")", "!=", "null", ")", "entityConfigMap", ".", "put", "(", "Service", ".", "DO_LOGIN_ACCOUNT", ",", "entityConfigMap", ".", "get", "(", "personAccountType", ")", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"setConfigEntityMapping entityConfigMap:\"", "+", "entityConfigMap", ")", ";", "}" ]
Set the mapping of RDN properties for each entity type. A map is created with the key as the entity type and the value as the RDN property to be used. This information is taken from the configuration. @param configProps map containing the configuration information. @throws WIMException throw when there is not a mapping for a user or not a mapping for a group.
[ "Set", "the", "mapping", "of", "RDN", "properties", "for", "each", "entity", "type", ".", "A", "map", "is", "created", "with", "the", "key", "as", "the", "entity", "type", "and", "the", "value", "as", "the", "RDN", "property", "to", "be", "used", ".", "This", "information", "is", "taken", "from", "the", "configuration", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java#L345-L360
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java
URBridge.validateEntity
private String validateEntity(Entity entity) throws WIMException { String METHODNAME = "validateEntity"; String type = null; String secName = null; String uniqueId = null; String uniqueName = null; if (entity.getIdentifier().isSet(SchemaConstants.PROP_UNIQUE_NAME)) { uniqueName = entity.getIdentifier().getUniqueName(); } else if (entity.getIdentifier().isSet(SchemaConstants.PROP_EXTERNAL_NAME)) { uniqueName = entity.getIdentifier().getExternalName(); } else if (entity.getIdentifier().isSet(SchemaConstants.PROP_UNIQUE_ID)) { uniqueId = entity.getIdentifier().getUniqueId(); } else if (entity.getIdentifier().isSet(SchemaConstants.PROP_EXTERNAL_ID)) { uniqueId = entity.getIdentifier().getExternalId(); } if (uniqueName != null) { secName = uniqueName; // stripRDN(uniqueName); } if (uniqueId != null && uniqueId.trim().length() > 0) { if (isValidUserOrGroup(uniqueId)) { uniqueName = uniqueId; secName = uniqueId; } else { secName = getSecNameFromUniqueID(uniqueId); uniqueName = secName; } } if (secName != null && secName.trim().length() > 0) { String rdnAttr = getRDN(entity.getIdentifier().getUniqueName()); Set<String> EntityTypes = entityConfigMap.keySet(); List<String> entities = new ArrayList<String>(); Iterator<String> it = EntityTypes.iterator(); while (it.hasNext()) { String entityType = it.next(); if ((rdnAttr == null) || (rdnAttr.equalsIgnoreCase(entityConfigMap.get(entityType)))) { entities.add(entityType); } } //handle if entities.size== or >1 then respect entity.getType from input DO //this is better than just letting the last matching type be returned. String inputType = entity.getTypeName(); type = getEntityTypeFromUniqueName(secName, entities, inputType); entity.getIdentifier().setUniqueName(uniqueName); } if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " The entity type for " + secName + " is " + type); } if (type == null) { throw new EntityNotFoundException(WIMMessageKey.ENTITY_NOT_FOUND, Tr.formatMessage(tc, WIMMessageKey.ENTITY_NOT_FOUND, WIMMessageHelper.generateMsgParms(secName))); } return type; }
java
private String validateEntity(Entity entity) throws WIMException { String METHODNAME = "validateEntity"; String type = null; String secName = null; String uniqueId = null; String uniqueName = null; if (entity.getIdentifier().isSet(SchemaConstants.PROP_UNIQUE_NAME)) { uniqueName = entity.getIdentifier().getUniqueName(); } else if (entity.getIdentifier().isSet(SchemaConstants.PROP_EXTERNAL_NAME)) { uniqueName = entity.getIdentifier().getExternalName(); } else if (entity.getIdentifier().isSet(SchemaConstants.PROP_UNIQUE_ID)) { uniqueId = entity.getIdentifier().getUniqueId(); } else if (entity.getIdentifier().isSet(SchemaConstants.PROP_EXTERNAL_ID)) { uniqueId = entity.getIdentifier().getExternalId(); } if (uniqueName != null) { secName = uniqueName; // stripRDN(uniqueName); } if (uniqueId != null && uniqueId.trim().length() > 0) { if (isValidUserOrGroup(uniqueId)) { uniqueName = uniqueId; secName = uniqueId; } else { secName = getSecNameFromUniqueID(uniqueId); uniqueName = secName; } } if (secName != null && secName.trim().length() > 0) { String rdnAttr = getRDN(entity.getIdentifier().getUniqueName()); Set<String> EntityTypes = entityConfigMap.keySet(); List<String> entities = new ArrayList<String>(); Iterator<String> it = EntityTypes.iterator(); while (it.hasNext()) { String entityType = it.next(); if ((rdnAttr == null) || (rdnAttr.equalsIgnoreCase(entityConfigMap.get(entityType)))) { entities.add(entityType); } } //handle if entities.size== or >1 then respect entity.getType from input DO //this is better than just letting the last matching type be returned. String inputType = entity.getTypeName(); type = getEntityTypeFromUniqueName(secName, entities, inputType); entity.getIdentifier().setUniqueName(uniqueName); } if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " The entity type for " + secName + " is " + type); } if (type == null) { throw new EntityNotFoundException(WIMMessageKey.ENTITY_NOT_FOUND, Tr.formatMessage(tc, WIMMessageKey.ENTITY_NOT_FOUND, WIMMessageHelper.generateMsgParms(secName))); } return type; }
[ "private", "String", "validateEntity", "(", "Entity", "entity", ")", "throws", "WIMException", "{", "String", "METHODNAME", "=", "\"validateEntity\"", ";", "String", "type", "=", "null", ";", "String", "secName", "=", "null", ";", "String", "uniqueId", "=", "null", ";", "String", "uniqueName", "=", "null", ";", "if", "(", "entity", ".", "getIdentifier", "(", ")", ".", "isSet", "(", "SchemaConstants", ".", "PROP_UNIQUE_NAME", ")", ")", "{", "uniqueName", "=", "entity", ".", "getIdentifier", "(", ")", ".", "getUniqueName", "(", ")", ";", "}", "else", "if", "(", "entity", ".", "getIdentifier", "(", ")", ".", "isSet", "(", "SchemaConstants", ".", "PROP_EXTERNAL_NAME", ")", ")", "{", "uniqueName", "=", "entity", ".", "getIdentifier", "(", ")", ".", "getExternalName", "(", ")", ";", "}", "else", "if", "(", "entity", ".", "getIdentifier", "(", ")", ".", "isSet", "(", "SchemaConstants", ".", "PROP_UNIQUE_ID", ")", ")", "{", "uniqueId", "=", "entity", ".", "getIdentifier", "(", ")", ".", "getUniqueId", "(", ")", ";", "}", "else", "if", "(", "entity", ".", "getIdentifier", "(", ")", ".", "isSet", "(", "SchemaConstants", ".", "PROP_EXTERNAL_ID", ")", ")", "{", "uniqueId", "=", "entity", ".", "getIdentifier", "(", ")", ".", "getExternalId", "(", ")", ";", "}", "if", "(", "uniqueName", "!=", "null", ")", "{", "secName", "=", "uniqueName", ";", "// stripRDN(uniqueName);", "}", "if", "(", "uniqueId", "!=", "null", "&&", "uniqueId", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "if", "(", "isValidUserOrGroup", "(", "uniqueId", ")", ")", "{", "uniqueName", "=", "uniqueId", ";", "secName", "=", "uniqueId", ";", "}", "else", "{", "secName", "=", "getSecNameFromUniqueID", "(", "uniqueId", ")", ";", "uniqueName", "=", "secName", ";", "}", "}", "if", "(", "secName", "!=", "null", "&&", "secName", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "String", "rdnAttr", "=", "getRDN", "(", "entity", ".", "getIdentifier", "(", ")", ".", "getUniqueName", "(", ")", ")", ";", "Set", "<", "String", ">", "EntityTypes", "=", "entityConfigMap", ".", "keySet", "(", ")", ";", "List", "<", "String", ">", "entities", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "Iterator", "<", "String", ">", "it", "=", "EntityTypes", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "String", "entityType", "=", "it", ".", "next", "(", ")", ";", "if", "(", "(", "rdnAttr", "==", "null", ")", "||", "(", "rdnAttr", ".", "equalsIgnoreCase", "(", "entityConfigMap", ".", "get", "(", "entityType", ")", ")", ")", ")", "{", "entities", ".", "add", "(", "entityType", ")", ";", "}", "}", "//handle if entities.size== or >1 then respect entity.getType from input DO", "//this is better than just letting the last matching type be returned.", "String", "inputType", "=", "entity", ".", "getTypeName", "(", ")", ";", "type", "=", "getEntityTypeFromUniqueName", "(", "secName", ",", "entities", ",", "inputType", ")", ";", "entity", ".", "getIdentifier", "(", ")", ".", "setUniqueName", "(", "uniqueName", ")", ";", "}", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "METHODNAME", "+", "\" The entity type for \"", "+", "secName", "+", "\" is \"", "+", "type", ")", ";", "}", "if", "(", "type", "==", "null", ")", "{", "throw", "new", "EntityNotFoundException", "(", "WIMMessageKey", ".", "ENTITY_NOT_FOUND", ",", "Tr", ".", "formatMessage", "(", "tc", ",", "WIMMessageKey", ".", "ENTITY_NOT_FOUND", ",", "WIMMessageHelper", ".", "generateMsgParms", "(", "secName", ")", ")", ")", ";", "}", "return", "type", ";", "}" ]
if type is null throw ENFE to be handled by get API.
[ "if", "type", "is", "null", "throw", "ENFE", "to", "be", "handled", "by", "get", "API", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java#L577-L635
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java
URBridge.getSecNameFromUniqueID
private String getSecNameFromUniqueID(String uniqueId) throws WIMException { String METHODNAME = "getSecNameFromUniqueID"; String secName = null; try { secName = getUserSecurityName(uniqueId); } catch (EntryNotFoundException e) { try { secName = getGroupSecurityName(uniqueId); } catch (com.ibm.ws.security.registry.EntryNotFoundException renf) { throw new EntityNotFoundException(WIMMessageKey.ENTITY_NOT_FOUND, Tr.formatMessage(tc, WIMMessageKey.ENTITY_NOT_FOUND, WIMMessageHelper.generateMsgParms(uniqueId))); } catch (RegistryException re) { throw new EntityNotFoundException(WIMMessageKey.ENTITY_NOT_FOUND, Tr.formatMessage(tc, WIMMessageKey.ENTITY_NOT_FOUND, WIMMessageHelper.generateMsgParms(uniqueId))); } } catch (RegistryException e) { throw new EntityNotFoundException(WIMMessageKey.ENTITY_NOT_FOUND, Tr.formatMessage(tc, WIMMessageKey.ENTITY_NOT_FOUND, WIMMessageHelper.generateMsgParms(uniqueId))); } if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " The Security Name for " + uniqueId + " is " + secName); } return secName; }
java
private String getSecNameFromUniqueID(String uniqueId) throws WIMException { String METHODNAME = "getSecNameFromUniqueID"; String secName = null; try { secName = getUserSecurityName(uniqueId); } catch (EntryNotFoundException e) { try { secName = getGroupSecurityName(uniqueId); } catch (com.ibm.ws.security.registry.EntryNotFoundException renf) { throw new EntityNotFoundException(WIMMessageKey.ENTITY_NOT_FOUND, Tr.formatMessage(tc, WIMMessageKey.ENTITY_NOT_FOUND, WIMMessageHelper.generateMsgParms(uniqueId))); } catch (RegistryException re) { throw new EntityNotFoundException(WIMMessageKey.ENTITY_NOT_FOUND, Tr.formatMessage(tc, WIMMessageKey.ENTITY_NOT_FOUND, WIMMessageHelper.generateMsgParms(uniqueId))); } } catch (RegistryException e) { throw new EntityNotFoundException(WIMMessageKey.ENTITY_NOT_FOUND, Tr.formatMessage(tc, WIMMessageKey.ENTITY_NOT_FOUND, WIMMessageHelper.generateMsgParms(uniqueId))); } if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " The Security Name for " + uniqueId + " is " + secName); } return secName; }
[ "private", "String", "getSecNameFromUniqueID", "(", "String", "uniqueId", ")", "throws", "WIMException", "{", "String", "METHODNAME", "=", "\"getSecNameFromUniqueID\"", ";", "String", "secName", "=", "null", ";", "try", "{", "secName", "=", "getUserSecurityName", "(", "uniqueId", ")", ";", "}", "catch", "(", "EntryNotFoundException", "e", ")", "{", "try", "{", "secName", "=", "getGroupSecurityName", "(", "uniqueId", ")", ";", "}", "catch", "(", "com", ".", "ibm", ".", "ws", ".", "security", ".", "registry", ".", "EntryNotFoundException", "renf", ")", "{", "throw", "new", "EntityNotFoundException", "(", "WIMMessageKey", ".", "ENTITY_NOT_FOUND", ",", "Tr", ".", "formatMessage", "(", "tc", ",", "WIMMessageKey", ".", "ENTITY_NOT_FOUND", ",", "WIMMessageHelper", ".", "generateMsgParms", "(", "uniqueId", ")", ")", ")", ";", "}", "catch", "(", "RegistryException", "re", ")", "{", "throw", "new", "EntityNotFoundException", "(", "WIMMessageKey", ".", "ENTITY_NOT_FOUND", ",", "Tr", ".", "formatMessage", "(", "tc", ",", "WIMMessageKey", ".", "ENTITY_NOT_FOUND", ",", "WIMMessageHelper", ".", "generateMsgParms", "(", "uniqueId", ")", ")", ")", ";", "}", "}", "catch", "(", "RegistryException", "e", ")", "{", "throw", "new", "EntityNotFoundException", "(", "WIMMessageKey", ".", "ENTITY_NOT_FOUND", ",", "Tr", ".", "formatMessage", "(", "tc", ",", "WIMMessageKey", ".", "ENTITY_NOT_FOUND", ",", "WIMMessageHelper", ".", "generateMsgParms", "(", "uniqueId", ")", ")", ")", ";", "}", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "METHODNAME", "+", "\" The Security Name for \"", "+", "uniqueId", "+", "\" is \"", "+", "secName", ")", ";", "}", "return", "secName", ";", "}" ]
Since UserRegistry throws CustomRegistryException in case of secName not found modify code to handle CustomRegistryException similar to EntryNotFoundException. @param uniqueId @return @throws WIMException
[ "Since", "UserRegistry", "throws", "CustomRegistryException", "in", "case", "of", "secName", "not", "found", "modify", "code", "to", "handle", "CustomRegistryException", "similar", "to", "EntryNotFoundException", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java#L645-L670
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java
URBridge.getRDN
private String getRDN(String name) { if (name == null) { return name; } int indexOfEqual = name.indexOf('='); if (indexOfEqual < 0) { return name; } String rdnValue = name.substring(0, indexOfEqual); return rdnValue; }
java
private String getRDN(String name) { if (name == null) { return name; } int indexOfEqual = name.indexOf('='); if (indexOfEqual < 0) { return name; } String rdnValue = name.substring(0, indexOfEqual); return rdnValue; }
[ "private", "String", "getRDN", "(", "String", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "return", "name", ";", "}", "int", "indexOfEqual", "=", "name", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "indexOfEqual", "<", "0", ")", "{", "return", "name", ";", "}", "String", "rdnValue", "=", "name", ".", "substring", "(", "0", ",", "indexOfEqual", ")", ";", "return", "rdnValue", ";", "}" ]
The method reads the uniqueName of the user and returns the rdn property
[ "The", "method", "reads", "the", "uniqueName", "of", "the", "user", "and", "returns", "the", "rdn", "property" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java#L738-L748
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java
URBridge.isEntityInRealm
@FFDCIgnore(Exception.class) public boolean isEntityInRealm(String uniqueName) { if (isSafRegistry()) { try { return userRegistry.isValidUser(uniqueName); } catch (Exception e) { /* Ignore. */ } try { return userRegistry.isValidGroup(uniqueName); } catch (Exception e) { /* Ignore. */ } } else { try { SearchResult result = userRegistry.getUsers(uniqueName, 1); if (result != null && result.getList().size() > 0) return true; } catch (Exception e) { /* Ignore. */ } try { SearchResult result = userRegistry.getGroups(uniqueName, 1); if (result != null && result.getList().size() > 0) return true; } catch (Exception e) { /* Ignore. */ } } return false; }
java
@FFDCIgnore(Exception.class) public boolean isEntityInRealm(String uniqueName) { if (isSafRegistry()) { try { return userRegistry.isValidUser(uniqueName); } catch (Exception e) { /* Ignore. */ } try { return userRegistry.isValidGroup(uniqueName); } catch (Exception e) { /* Ignore. */ } } else { try { SearchResult result = userRegistry.getUsers(uniqueName, 1); if (result != null && result.getList().size() > 0) return true; } catch (Exception e) { /* Ignore. */ } try { SearchResult result = userRegistry.getGroups(uniqueName, 1); if (result != null && result.getList().size() > 0) return true; } catch (Exception e) { /* Ignore. */ } } return false; }
[ "@", "FFDCIgnore", "(", "Exception", ".", "class", ")", "public", "boolean", "isEntityInRealm", "(", "String", "uniqueName", ")", "{", "if", "(", "isSafRegistry", "(", ")", ")", "{", "try", "{", "return", "userRegistry", ".", "isValidUser", "(", "uniqueName", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "/* Ignore. */", "}", "try", "{", "return", "userRegistry", ".", "isValidGroup", "(", "uniqueName", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "/* Ignore. */", "}", "}", "else", "{", "try", "{", "SearchResult", "result", "=", "userRegistry", ".", "getUsers", "(", "uniqueName", ",", "1", ")", ";", "if", "(", "result", "!=", "null", "&&", "result", ".", "getList", "(", ")", ".", "size", "(", ")", ">", "0", ")", "return", "true", ";", "}", "catch", "(", "Exception", "e", ")", "{", "/* Ignore. */", "}", "try", "{", "SearchResult", "result", "=", "userRegistry", ".", "getGroups", "(", "uniqueName", ",", "1", ")", ";", "if", "(", "result", "!=", "null", "&&", "result", ".", "getList", "(", ")", ".", "size", "(", ")", ">", "0", ")", "return", "true", ";", "}", "catch", "(", "Exception", "e", ")", "{", "/* Ignore. */", "}", "}", "return", "false", ";", "}" ]
Is the entity in this realm? @param uniqueName The entity unique name. @return True if the entity is in the realm, false if the entity is not.
[ "Is", "the", "entity", "in", "this", "realm?" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java#L1276-L1310
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java
TransmissionDataIterator.setFields
private void setFields(Connection connection, JFapByteBuffer buffer, int priority, boolean isPooled, boolean isExchange, int segmentType, int conversationId, int requestNumber, Conversation conversation, SendListener sendListener, boolean isTerminal, int size) { this.connection = connection; this.buffer = buffer; this.priority = priority; this.isPooled = isPooled; this.isExchange = isExchange; this.segmentType = segmentType; this.conversationId = conversationId; this.requestNumber = requestNumber; this.conversation = conversation; this.sendListener = sendListener; this.isTerminal = isTerminal; this.size = size; bytesRemaining = size; }
java
private void setFields(Connection connection, JFapByteBuffer buffer, int priority, boolean isPooled, boolean isExchange, int segmentType, int conversationId, int requestNumber, Conversation conversation, SendListener sendListener, boolean isTerminal, int size) { this.connection = connection; this.buffer = buffer; this.priority = priority; this.isPooled = isPooled; this.isExchange = isExchange; this.segmentType = segmentType; this.conversationId = conversationId; this.requestNumber = requestNumber; this.conversation = conversation; this.sendListener = sendListener; this.isTerminal = isTerminal; this.size = size; bytesRemaining = size; }
[ "private", "void", "setFields", "(", "Connection", "connection", ",", "JFapByteBuffer", "buffer", ",", "int", "priority", ",", "boolean", "isPooled", ",", "boolean", "isExchange", ",", "int", "segmentType", ",", "int", "conversationId", ",", "int", "requestNumber", ",", "Conversation", "conversation", ",", "SendListener", "sendListener", ",", "boolean", "isTerminal", ",", "int", "size", ")", "{", "this", ".", "connection", "=", "connection", ";", "this", ".", "buffer", "=", "buffer", ";", "this", ".", "priority", "=", "priority", ";", "this", ".", "isPooled", "=", "isPooled", ";", "this", ".", "isExchange", "=", "isExchange", ";", "this", ".", "segmentType", "=", "segmentType", ";", "this", ".", "conversationId", "=", "conversationId", ";", "this", ".", "requestNumber", "=", "requestNumber", ";", "this", ".", "conversation", "=", "conversation", ";", "this", ".", "sendListener", "=", "sendListener", ";", "this", ".", "isTerminal", "=", "isTerminal", ";", "this", ".", "size", "=", "size", ";", "bytesRemaining", "=", "size", ";", "}" ]
Helper method which sets up fields in this class. @param connection @param buffer @param priority @param isPooled @param isExchange @param segmentType @param conversationId @param requestNumber @param conversation @param sendListener @param isTerminal @param size
[ "Helper", "method", "which", "sets", "up", "fields", "in", "this", "class", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java#L116-L142
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java
TransmissionDataIterator.reset
private void reset(Connection connection, JFapByteBuffer buffer, int priority, boolean isPooled, boolean isExchange, int segmentType, int conversationId, int requestNumber, Conversation conversation, SendListener sendListener, boolean isTerminal, int size) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "reset", new Object[]{connection, buffer, ""+priority, ""+isPooled, ""+isExchange, ""+segmentType, ""+conversationId, ""+requestNumber, conversation, sendListener, ""+isTerminal, ""+size}); setFields(connection, buffer, priority, isPooled, isExchange, segmentType, conversationId, requestNumber, conversation, sendListener, isTerminal, size); int sizeIncludingHeaders = size + JFapChannelConstants.SIZEOF_PRIMARY_HEADER + JFapChannelConstants.SIZEOF_CONVERSATION_HEADER; transmissionsRemaining = true; if (sizeIncludingHeaders > connection.getMaxTransmissionSize()) { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "segmenting"); layout = JFapChannelConstants.XMIT_SEGMENT_START; } else layout = JFapChannelConstants.XMIT_CONVERSATION; if (tc.isEntryEnabled()) SibTr.exit(this, tc, "reset"); }
java
private void reset(Connection connection, JFapByteBuffer buffer, int priority, boolean isPooled, boolean isExchange, int segmentType, int conversationId, int requestNumber, Conversation conversation, SendListener sendListener, boolean isTerminal, int size) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "reset", new Object[]{connection, buffer, ""+priority, ""+isPooled, ""+isExchange, ""+segmentType, ""+conversationId, ""+requestNumber, conversation, sendListener, ""+isTerminal, ""+size}); setFields(connection, buffer, priority, isPooled, isExchange, segmentType, conversationId, requestNumber, conversation, sendListener, isTerminal, size); int sizeIncludingHeaders = size + JFapChannelConstants.SIZEOF_PRIMARY_HEADER + JFapChannelConstants.SIZEOF_CONVERSATION_HEADER; transmissionsRemaining = true; if (sizeIncludingHeaders > connection.getMaxTransmissionSize()) { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "segmenting"); layout = JFapChannelConstants.XMIT_SEGMENT_START; } else layout = JFapChannelConstants.XMIT_CONVERSATION; if (tc.isEntryEnabled()) SibTr.exit(this, tc, "reset"); }
[ "private", "void", "reset", "(", "Connection", "connection", ",", "JFapByteBuffer", "buffer", ",", "int", "priority", ",", "boolean", "isPooled", ",", "boolean", "isExchange", ",", "int", "segmentType", ",", "int", "conversationId", ",", "int", "requestNumber", ",", "Conversation", "conversation", ",", "SendListener", "sendListener", ",", "boolean", "isTerminal", ",", "int", "size", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"reset\"", ",", "new", "Object", "[", "]", "{", "connection", ",", "buffer", ",", "\"\"", "+", "priority", ",", "\"\"", "+", "isPooled", ",", "\"\"", "+", "isExchange", ",", "\"\"", "+", "segmentType", ",", "\"\"", "+", "conversationId", ",", "\"\"", "+", "requestNumber", ",", "conversation", ",", "sendListener", ",", "\"\"", "+", "isTerminal", ",", "\"\"", "+", "size", "}", ")", ";", "setFields", "(", "connection", ",", "buffer", ",", "priority", ",", "isPooled", ",", "isExchange", ",", "segmentType", ",", "conversationId", ",", "requestNumber", ",", "conversation", ",", "sendListener", ",", "isTerminal", ",", "size", ")", ";", "int", "sizeIncludingHeaders", "=", "size", "+", "JFapChannelConstants", ".", "SIZEOF_PRIMARY_HEADER", "+", "JFapChannelConstants", ".", "SIZEOF_CONVERSATION_HEADER", ";", "transmissionsRemaining", "=", "true", ";", "if", "(", "sizeIncludingHeaders", ">", "connection", ".", "getMaxTransmissionSize", "(", ")", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"segmenting\"", ")", ";", "layout", "=", "JFapChannelConstants", ".", "XMIT_SEGMENT_START", ";", "}", "else", "layout", "=", "JFapChannelConstants", ".", "XMIT_CONVERSATION", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"reset\"", ")", ";", "}" ]
Resets the iterator so it is read for use with a new piece of user data. @param connection @param data @param priority @param isPooled @param isExchange @param segmentType @param conversationId @param requestNumber @param conversation @param sendListener @param isUserRequest @param isTerminal @param size
[ "Resets", "the", "iterator", "so", "it", "is", "read", "for", "use", "with", "a", "new", "piece", "of", "user", "data", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java#L160-L190
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java
TransmissionDataIterator.hasNext
public boolean hasNext() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "hasNext"); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "hasNext", ""+transmissionsRemaining); return transmissionsRemaining; }
java
public boolean hasNext() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "hasNext"); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "hasNext", ""+transmissionsRemaining); return transmissionsRemaining; }
[ "public", "boolean", "hasNext", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"hasNext\"", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"hasNext\"", ",", "\"\"", "+", "transmissionsRemaining", ")", ";", "return", "transmissionsRemaining", ";", "}" ]
Returns true if this iterator contains more transmission data objects. @return Returns true if this iterator contains more transmission data objects.
[ "Returns", "true", "if", "this", "iterator", "contains", "more", "transmission", "data", "objects", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java#L196-L201
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java
TransmissionDataIterator.allocateFromPool
protected static TransmissionDataIterator allocateFromPool(Connection connection, JFapByteBuffer buffer, int priority, boolean isPooled, boolean isExchange, int segmentType, int conversationId, int requestNumber, Conversation conversation, SendListener sendListener, boolean isTerminal, int size) { if (tc.isEntryEnabled()) SibTr.entry(tc, "allocateFromPool"); TransmissionDataIterator retValue = (TransmissionDataIterator)pool.remove(); if (retValue == null) retValue = new TransmissionDataIterator(); retValue.reset(connection, buffer, priority, isPooled, isExchange, segmentType, conversationId, requestNumber, conversation, sendListener, isTerminal, size); if (tc.isEntryEnabled()) SibTr.exit(tc, "allocateFromPool", retValue); return retValue; }
java
protected static TransmissionDataIterator allocateFromPool(Connection connection, JFapByteBuffer buffer, int priority, boolean isPooled, boolean isExchange, int segmentType, int conversationId, int requestNumber, Conversation conversation, SendListener sendListener, boolean isTerminal, int size) { if (tc.isEntryEnabled()) SibTr.entry(tc, "allocateFromPool"); TransmissionDataIterator retValue = (TransmissionDataIterator)pool.remove(); if (retValue == null) retValue = new TransmissionDataIterator(); retValue.reset(connection, buffer, priority, isPooled, isExchange, segmentType, conversationId, requestNumber, conversation, sendListener, isTerminal, size); if (tc.isEntryEnabled()) SibTr.exit(tc, "allocateFromPool", retValue); return retValue; }
[ "protected", "static", "TransmissionDataIterator", "allocateFromPool", "(", "Connection", "connection", ",", "JFapByteBuffer", "buffer", ",", "int", "priority", ",", "boolean", "isPooled", ",", "boolean", "isExchange", ",", "int", "segmentType", ",", "int", "conversationId", ",", "int", "requestNumber", ",", "Conversation", "conversation", ",", "SendListener", "sendListener", ",", "boolean", "isTerminal", ",", "int", "size", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"allocateFromPool\"", ")", ";", "TransmissionDataIterator", "retValue", "=", "(", "TransmissionDataIterator", ")", "pool", ".", "remove", "(", ")", ";", "if", "(", "retValue", "==", "null", ")", "retValue", "=", "new", "TransmissionDataIterator", "(", ")", ";", "retValue", ".", "reset", "(", "connection", ",", "buffer", ",", "priority", ",", "isPooled", ",", "isExchange", ",", "segmentType", ",", "conversationId", ",", "requestNumber", ",", "conversation", ",", "sendListener", ",", "isTerminal", ",", "size", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"allocateFromPool\"", ",", "retValue", ")", ";", "return", "retValue", ";", "}" ]
Allocates an instance of this class from a pool
[ "Allocates", "an", "instance", "of", "this", "class", "from", "a", "pool" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java#L321-L341
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java
TransmissionDataIterator.release
protected void release() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "release"); if (!transmissionsRemaining) { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "no more transmissions remaining - repooling"); // Ensure we release the byte buffers back into the pool if (buffer != null) { buffer.release(); } connection = null; conversation = null; buffer = null; sendListener = null; pool.add(this); } if (tc.isEntryEnabled()) SibTr.exit(this, tc, "release"); }
java
protected void release() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "release"); if (!transmissionsRemaining) { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "no more transmissions remaining - repooling"); // Ensure we release the byte buffers back into the pool if (buffer != null) { buffer.release(); } connection = null; conversation = null; buffer = null; sendListener = null; pool.add(this); } if (tc.isEntryEnabled()) SibTr.exit(this, tc, "release"); }
[ "protected", "void", "release", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"release\"", ")", ";", "if", "(", "!", "transmissionsRemaining", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"no more transmissions remaining - repooling\"", ")", ";", "// Ensure we release the byte buffers back into the pool", "if", "(", "buffer", "!=", "null", ")", "{", "buffer", ".", "release", "(", ")", ";", "}", "connection", "=", "null", ";", "conversation", "=", "null", ";", "buffer", "=", "null", ";", "sendListener", "=", "null", ";", "pool", ".", "add", "(", "this", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"release\"", ")", ";", "}" ]
Returns a previously allocated instance of this class to the pool
[ "Returns", "a", "previously", "allocated", "instance", "of", "this", "class", "to", "the", "pool" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java#L345-L365
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java
TransmissionDataIterator.getPriority
protected int getPriority() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getPriority"); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getPriority", ""+priority); return priority; }
java
protected int getPriority() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getPriority"); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getPriority", ""+priority); return priority; }
[ "protected", "int", "getPriority", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"getPriority\"", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"getPriority\"", ",", "\"\"", "+", "priority", ")", ";", "return", "priority", ";", "}" ]
Returns the priority for data transmissions in this iterator
[ "Returns", "the", "priority", "for", "data", "transmissions", "in", "this", "iterator" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java#L368-L373
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java
TransmissionDataIterator.setPriority
protected void setPriority(int priority) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "setPriority", ""+priority); this.priority = priority; if (tc.isEntryEnabled()) SibTr.exit(this, tc, "setPriority"); }
java
protected void setPriority(int priority) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "setPriority", ""+priority); this.priority = priority; if (tc.isEntryEnabled()) SibTr.exit(this, tc, "setPriority"); }
[ "protected", "void", "setPriority", "(", "int", "priority", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"setPriority\"", ",", "\"\"", "+", "priority", ")", ";", "this", ".", "priority", "=", "priority", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"setPriority\"", ")", ";", "}" ]
Sets the priority for data transmissions in this iterator. This is used when data is enqueued to the priority queue with the "lowest available" option set - and we need to assigne it a hard priority
[ "Sets", "the", "priority", "for", "data", "transmissions", "in", "this", "iterator", ".", "This", "is", "used", "when", "data", "is", "enqueued", "to", "the", "priority", "queue", "with", "the", "lowest", "available", "option", "set", "-", "and", "we", "need", "to", "assigne", "it", "a", "hard", "priority" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java#L380-L385
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java
TransmissionDataIterator.getSize
protected int getSize() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getSize"); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getSize", ""+size); return size; }
java
protected int getSize() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getSize"); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getSize", ""+size); return size; }
[ "protected", "int", "getSize", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"getSize\"", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"getSize\"", ",", "\"\"", "+", "size", ")", ";", "return", "size", ";", "}" ]
Returns the size of the payload data the user requested tranmitted. @return Returns the size of the payload data the user requested tranmitted.
[ "Returns", "the", "size", "of", "the", "payload", "data", "the", "user", "requested", "tranmitted", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/TransmissionDataIterator.java#L391-L396
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.instrument.serialfilter/src/com/ibm/ws/kernel/instrument/serialfilter/agenthelper/PreMainUtil.java
PreMainUtil.isDebugEnabled
public static boolean isDebugEnabled() { String value = System.getProperty(DEBUG_PROPERTY); if (value != null && "true".equalsIgnoreCase(value)) { return true; } return false; }
java
public static boolean isDebugEnabled() { String value = System.getProperty(DEBUG_PROPERTY); if (value != null && "true".equalsIgnoreCase(value)) { return true; } return false; }
[ "public", "static", "boolean", "isDebugEnabled", "(", ")", "{", "String", "value", "=", "System", ".", "getProperty", "(", "DEBUG_PROPERTY", ")", ";", "if", "(", "value", "!=", "null", "&&", "\"true\"", ".", "equalsIgnoreCase", "(", "value", ")", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
Since logger is not activated while processing premain, the trace data needs to be logged by using System.out.
[ "Since", "logger", "is", "not", "activated", "while", "processing", "premain", "the", "trace", "data", "needs", "to", "be", "logged", "by", "using", "System", ".", "out", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.instrument.serialfilter/src/com/ibm/ws/kernel/instrument/serialfilter/agenthelper/PreMainUtil.java#L33-L39
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/PackageCommand.java
PackageCommand.getDefaultPackageExtension
private String getDefaultPackageExtension() { // Default package format on z/OS is a pax if ("z/OS".equalsIgnoreCase(bootProps.get("os.name"))) { return "pax"; } if (PackageProcessor.IncludeOption.RUNNABLE.matches(includeOption)) { return "jar"; } return "zip"; }
java
private String getDefaultPackageExtension() { // Default package format on z/OS is a pax if ("z/OS".equalsIgnoreCase(bootProps.get("os.name"))) { return "pax"; } if (PackageProcessor.IncludeOption.RUNNABLE.matches(includeOption)) { return "jar"; } return "zip"; }
[ "private", "String", "getDefaultPackageExtension", "(", ")", "{", "// Default package format on z/OS is a pax", "if", "(", "\"z/OS\"", ".", "equalsIgnoreCase", "(", "bootProps", ".", "get", "(", "\"os.name\"", ")", ")", ")", "{", "return", "\"pax\"", ";", "}", "if", "(", "PackageProcessor", ".", "IncludeOption", ".", "RUNNABLE", ".", "matches", "(", "includeOption", ")", ")", "{", "return", "\"jar\"", ";", "}", "return", "\"zip\"", ";", "}" ]
Determine the default package format for the current operating system. @return "pax" on z/OS and "zip" for all others
[ "Determine", "the", "default", "package", "format", "for", "the", "current", "operating", "system", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/PackageCommand.java#L322-L334
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/ASN1Set.java
ASN1Set.getInstance
public static ASN1Set getInstance( Object obj) { if (obj == null || obj instanceof ASN1Set) { return (ASN1Set)obj; } throw new IllegalArgumentException("unknown object in getInstance"); }
java
public static ASN1Set getInstance( Object obj) { if (obj == null || obj instanceof ASN1Set) { return (ASN1Set)obj; } throw new IllegalArgumentException("unknown object in getInstance"); }
[ "public", "static", "ASN1Set", "getInstance", "(", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", "||", "obj", "instanceof", "ASN1Set", ")", "{", "return", "(", "ASN1Set", ")", "obj", ";", "}", "throw", "new", "IllegalArgumentException", "(", "\"unknown object in getInstance\"", ")", ";", "}" ]
return an ASN1Set from the given object. @param obj the object we want converted. @exception IllegalArgumentException if the object cannot be converted.
[ "return", "an", "ASN1Set", "from", "the", "given", "object", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/ASN1Set.java#L33-L42
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/support/LibertyHTTPTransportFactory.java
LibertyHTTPTransportFactory.getConduit
@Override public Conduit getConduit(EndpointInfo endpointInfo, EndpointReferenceType target) throws IOException { //create our LibertyHTTPConduit so that we can set the TCCL when run the handleResponseInternal asynchronously LibertyHTTPConduit conduit = new LibertyHTTPConduit(bus, endpointInfo, target); //following are copied from the super class. //Spring configure the conduit. String address = conduit.getAddress(); if (address != null && address.indexOf('?') != -1) { address = address.substring(0, address.indexOf('?')); } HTTPConduitConfigurer c1 = bus.getExtension(HTTPConduitConfigurer.class); if (c1 != null) { c1.configure(conduit.getBeanName(), address, conduit); } configure(conduit, conduit.getBeanName(), address); conduit.finalizeConfig(); //copy end. //open the auto redirect when load wsdl, and close auto redirect when process soap message in default. //users can open the auto redirect for soap message with ibm-ws-bnd.xml if (conduit != null) { HTTPClientPolicy clientPolicy = conduit.getClient(); clientPolicy.setAutoRedirect(CXF_TRANSPORT_URI_RESOLVER_QNAME.equals(endpointInfo.getName())); } // Set defaultSSLConfig for this HTTP Conduit, in case it is needed when retrieve WSDL from HTTPS URL AtomicServiceReference<JaxWsSecurityConfigurationService> secConfigSR = securityConfigSR.get(); JaxWsSecurityConfigurationService securityConfigService = secConfigSR == null ? null : secConfigSR.getService(); if (null != securityConfigService) { // set null values for sslRef and certAlias so the default one will be used securityConfigService.configClientSSL(conduit, null, null); } return conduit; }
java
@Override public Conduit getConduit(EndpointInfo endpointInfo, EndpointReferenceType target) throws IOException { //create our LibertyHTTPConduit so that we can set the TCCL when run the handleResponseInternal asynchronously LibertyHTTPConduit conduit = new LibertyHTTPConduit(bus, endpointInfo, target); //following are copied from the super class. //Spring configure the conduit. String address = conduit.getAddress(); if (address != null && address.indexOf('?') != -1) { address = address.substring(0, address.indexOf('?')); } HTTPConduitConfigurer c1 = bus.getExtension(HTTPConduitConfigurer.class); if (c1 != null) { c1.configure(conduit.getBeanName(), address, conduit); } configure(conduit, conduit.getBeanName(), address); conduit.finalizeConfig(); //copy end. //open the auto redirect when load wsdl, and close auto redirect when process soap message in default. //users can open the auto redirect for soap message with ibm-ws-bnd.xml if (conduit != null) { HTTPClientPolicy clientPolicy = conduit.getClient(); clientPolicy.setAutoRedirect(CXF_TRANSPORT_URI_RESOLVER_QNAME.equals(endpointInfo.getName())); } // Set defaultSSLConfig for this HTTP Conduit, in case it is needed when retrieve WSDL from HTTPS URL AtomicServiceReference<JaxWsSecurityConfigurationService> secConfigSR = securityConfigSR.get(); JaxWsSecurityConfigurationService securityConfigService = secConfigSR == null ? null : secConfigSR.getService(); if (null != securityConfigService) { // set null values for sslRef and certAlias so the default one will be used securityConfigService.configClientSSL(conduit, null, null); } return conduit; }
[ "@", "Override", "public", "Conduit", "getConduit", "(", "EndpointInfo", "endpointInfo", ",", "EndpointReferenceType", "target", ")", "throws", "IOException", "{", "//create our LibertyHTTPConduit so that we can set the TCCL when run the handleResponseInternal asynchronously", "LibertyHTTPConduit", "conduit", "=", "new", "LibertyHTTPConduit", "(", "bus", ",", "endpointInfo", ",", "target", ")", ";", "//following are copied from the super class.", "//Spring configure the conduit. ", "String", "address", "=", "conduit", ".", "getAddress", "(", ")", ";", "if", "(", "address", "!=", "null", "&&", "address", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "{", "address", "=", "address", ".", "substring", "(", "0", ",", "address", ".", "indexOf", "(", "'", "'", ")", ")", ";", "}", "HTTPConduitConfigurer", "c1", "=", "bus", ".", "getExtension", "(", "HTTPConduitConfigurer", ".", "class", ")", ";", "if", "(", "c1", "!=", "null", ")", "{", "c1", ".", "configure", "(", "conduit", ".", "getBeanName", "(", ")", ",", "address", ",", "conduit", ")", ";", "}", "configure", "(", "conduit", ",", "conduit", ".", "getBeanName", "(", ")", ",", "address", ")", ";", "conduit", ".", "finalizeConfig", "(", ")", ";", "//copy end.", "//open the auto redirect when load wsdl, and close auto redirect when process soap message in default.", "//users can open the auto redirect for soap message with ibm-ws-bnd.xml", "if", "(", "conduit", "!=", "null", ")", "{", "HTTPClientPolicy", "clientPolicy", "=", "conduit", ".", "getClient", "(", ")", ";", "clientPolicy", ".", "setAutoRedirect", "(", "CXF_TRANSPORT_URI_RESOLVER_QNAME", ".", "equals", "(", "endpointInfo", ".", "getName", "(", ")", ")", ")", ";", "}", "// Set defaultSSLConfig for this HTTP Conduit, in case it is needed when retrieve WSDL from HTTPS URL", "AtomicServiceReference", "<", "JaxWsSecurityConfigurationService", ">", "secConfigSR", "=", "securityConfigSR", ".", "get", "(", ")", ";", "JaxWsSecurityConfigurationService", "securityConfigService", "=", "secConfigSR", "==", "null", "?", "null", ":", "secConfigSR", ".", "getService", "(", ")", ";", "if", "(", "null", "!=", "securityConfigService", ")", "{", "// set null values for sslRef and certAlias so the default one will be used", "securityConfigService", ".", "configClientSSL", "(", "conduit", ",", "null", ",", "null", ")", ";", "}", "return", "conduit", ";", "}" ]
set the auto-redirect to true
[ "set", "the", "auto", "-", "redirect", "to", "true" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/support/LibertyHTTPTransportFactory.java#L41-L77
train
OpenLiberty/open-liberty
dev/com.ibm.ws.crypto.ltpakeyutil/src/com/ibm/ws/crypto/ltpakeyutil/LTPACrypto.java
LTPACrypto.setRSAKey
protected static final void setRSAKey(byte[][] key) { BigInteger[] k = new BigInteger[8]; for (int i = 0; i < 8; i++) { if (key[i] != null) { k[i] = new BigInteger(1, key[i]); } } if (k[3].compareTo(k[4]) < 0) { BigInteger tmp; tmp = k[3]; k[3] = k[4]; k[4] = tmp; tmp = k[5]; k[5] = k[6]; k[6] = tmp; k[7] = null; } if (k[7] == null) { k[7] = k[4].modInverse(k[3]); } if (k[0] == null) { k[0] = k[3].multiply(k[4]); } if (k[1] == null) { k[1] = k[2].modInverse(k[3].subtract(BigInteger.valueOf(1)).multiply(k[4].subtract(BigInteger.valueOf(1)))); } if (k[5] == null) { k[5] = k[1].remainder(k[3].subtract(BigInteger.valueOf(1))); } if (k[6] == null) { k[6] = k[1].remainder(k[4].subtract(BigInteger.valueOf(1))); } for (int i = 0; i < 8; i++) { key[i] = k[i].toByteArray(); } }
java
protected static final void setRSAKey(byte[][] key) { BigInteger[] k = new BigInteger[8]; for (int i = 0; i < 8; i++) { if (key[i] != null) { k[i] = new BigInteger(1, key[i]); } } if (k[3].compareTo(k[4]) < 0) { BigInteger tmp; tmp = k[3]; k[3] = k[4]; k[4] = tmp; tmp = k[5]; k[5] = k[6]; k[6] = tmp; k[7] = null; } if (k[7] == null) { k[7] = k[4].modInverse(k[3]); } if (k[0] == null) { k[0] = k[3].multiply(k[4]); } if (k[1] == null) { k[1] = k[2].modInverse(k[3].subtract(BigInteger.valueOf(1)).multiply(k[4].subtract(BigInteger.valueOf(1)))); } if (k[5] == null) { k[5] = k[1].remainder(k[3].subtract(BigInteger.valueOf(1))); } if (k[6] == null) { k[6] = k[1].remainder(k[4].subtract(BigInteger.valueOf(1))); } for (int i = 0; i < 8; i++) { key[i] = k[i].toByteArray(); } }
[ "protected", "static", "final", "void", "setRSAKey", "(", "byte", "[", "]", "[", "]", "key", ")", "{", "BigInteger", "[", "]", "k", "=", "new", "BigInteger", "[", "8", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "8", ";", "i", "++", ")", "{", "if", "(", "key", "[", "i", "]", "!=", "null", ")", "{", "k", "[", "i", "]", "=", "new", "BigInteger", "(", "1", ",", "key", "[", "i", "]", ")", ";", "}", "}", "if", "(", "k", "[", "3", "]", ".", "compareTo", "(", "k", "[", "4", "]", ")", "<", "0", ")", "{", "BigInteger", "tmp", ";", "tmp", "=", "k", "[", "3", "]", ";", "k", "[", "3", "]", "=", "k", "[", "4", "]", ";", "k", "[", "4", "]", "=", "tmp", ";", "tmp", "=", "k", "[", "5", "]", ";", "k", "[", "5", "]", "=", "k", "[", "6", "]", ";", "k", "[", "6", "]", "=", "tmp", ";", "k", "[", "7", "]", "=", "null", ";", "}", "if", "(", "k", "[", "7", "]", "==", "null", ")", "{", "k", "[", "7", "]", "=", "k", "[", "4", "]", ".", "modInverse", "(", "k", "[", "3", "]", ")", ";", "}", "if", "(", "k", "[", "0", "]", "==", "null", ")", "{", "k", "[", "0", "]", "=", "k", "[", "3", "]", ".", "multiply", "(", "k", "[", "4", "]", ")", ";", "}", "if", "(", "k", "[", "1", "]", "==", "null", ")", "{", "k", "[", "1", "]", "=", "k", "[", "2", "]", ".", "modInverse", "(", "k", "[", "3", "]", ".", "subtract", "(", "BigInteger", ".", "valueOf", "(", "1", ")", ")", ".", "multiply", "(", "k", "[", "4", "]", ".", "subtract", "(", "BigInteger", ".", "valueOf", "(", "1", ")", ")", ")", ")", ";", "}", "if", "(", "k", "[", "5", "]", "==", "null", ")", "{", "k", "[", "5", "]", "=", "k", "[", "1", "]", ".", "remainder", "(", "k", "[", "3", "]", ".", "subtract", "(", "BigInteger", ".", "valueOf", "(", "1", ")", ")", ")", ";", "}", "if", "(", "k", "[", "6", "]", "==", "null", ")", "{", "k", "[", "6", "]", "=", "k", "[", "1", "]", ".", "remainder", "(", "k", "[", "4", "]", ".", "subtract", "(", "BigInteger", ".", "valueOf", "(", "1", ")", ")", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "8", ";", "i", "++", ")", "{", "key", "[", "i", "]", "=", "k", "[", "i", "]", ".", "toByteArray", "(", ")", ";", "}", "}" ]
Set the key for RSA algorithms. @param key The key
[ "Set", "the", "key", "for", "RSA", "algorithms", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.ltpakeyutil/src/com/ibm/ws/crypto/ltpakeyutil/LTPACrypto.java#L533-L570
train
OpenLiberty/open-liberty
dev/com.ibm.ws.crypto.ltpakeyutil/src/com/ibm/ws/crypto/ltpakeyutil/LTPACrypto.java
LTPACrypto.encrypt
protected static final byte[] encrypt(byte[] data, byte[] key, String cipher) throws Exception { SecretKey sKey = constructSecretKey(key, cipher); Cipher ci = createCipher(Cipher.ENCRYPT_MODE, key, cipher, sKey); return ci.doFinal(data); }
java
protected static final byte[] encrypt(byte[] data, byte[] key, String cipher) throws Exception { SecretKey sKey = constructSecretKey(key, cipher); Cipher ci = createCipher(Cipher.ENCRYPT_MODE, key, cipher, sKey); return ci.doFinal(data); }
[ "protected", "static", "final", "byte", "[", "]", "encrypt", "(", "byte", "[", "]", "data", ",", "byte", "[", "]", "key", ",", "String", "cipher", ")", "throws", "Exception", "{", "SecretKey", "sKey", "=", "constructSecretKey", "(", "key", ",", "cipher", ")", ";", "Cipher", "ci", "=", "createCipher", "(", "Cipher", ".", "ENCRYPT_MODE", ",", "key", ",", "cipher", ",", "sKey", ")", ";", "return", "ci", ".", "doFinal", "(", "data", ")", ";", "}" ]
Encrypt the data. @param data The byte representation of the data @param key The key used to encrypt the data @param cipher The cipher algorithm @return The encrypted data (ciphertext)
[ "Encrypt", "the", "data", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.ltpakeyutil/src/com/ibm/ws/crypto/ltpakeyutil/LTPACrypto.java#L643-L647
train
OpenLiberty/open-liberty
dev/com.ibm.ws.crypto.ltpakeyutil/src/com/ibm/ws/crypto/ltpakeyutil/LTPACrypto.java
LTPACrypto.decrypt
protected static final byte[] decrypt(byte[] msg, byte[] key, String cipher) throws Exception { SecretKey sKey = constructSecretKey(key, cipher); Cipher ci = createCipher(Cipher.DECRYPT_MODE, key, cipher, sKey); return ci.doFinal(msg); }
java
protected static final byte[] decrypt(byte[] msg, byte[] key, String cipher) throws Exception { SecretKey sKey = constructSecretKey(key, cipher); Cipher ci = createCipher(Cipher.DECRYPT_MODE, key, cipher, sKey); return ci.doFinal(msg); }
[ "protected", "static", "final", "byte", "[", "]", "decrypt", "(", "byte", "[", "]", "msg", ",", "byte", "[", "]", "key", ",", "String", "cipher", ")", "throws", "Exception", "{", "SecretKey", "sKey", "=", "constructSecretKey", "(", "key", ",", "cipher", ")", ";", "Cipher", "ci", "=", "createCipher", "(", "Cipher", ".", "DECRYPT_MODE", ",", "key", ",", "cipher", ",", "sKey", ")", ";", "return", "ci", ".", "doFinal", "(", "msg", ")", ";", "}" ]
Decrypt the specified msg. @param msg The byte representation of the data @param key The key used to decrypt the data @param cipher The cipher algorithm @return The decrypted data (plaintext)
[ "Decrypt", "the", "specified", "msg", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.ltpakeyutil/src/com/ibm/ws/crypto/ltpakeyutil/LTPACrypto.java#L657-L661
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaReferenceUtilsImpl.java
JmsJcaReferenceUtilsImpl.populatePrefixTable
public void populatePrefixTable() { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(TRACE, "populatePrefixTable"); } // Create the storage. prefixTable = new HashMap<Class,String>(); // Populate with the supported (non-null) data types. prefixTable.put(Boolean.class, PREFIX_BOOLEAN); prefixTable.put(Integer.class, PREFIX_INT); prefixTable.put(Byte.class, PREFIX_BYTE); prefixTable.put(Short.class, PREFIX_SHORT); prefixTable.put(String.class, PREFIX_STRING); prefixTable.put(Float.class, PREFIX_FLOAT); prefixTable.put(Double.class, PREFIX_DOUBLE); prefixTable.put(Long.class, PREFIX_LONG); prefixTable.put(StringArrayWrapper.class, PREFIX_ROUTING_PATH); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(TRACE, "populatePrefixTable"); } }
java
public void populatePrefixTable() { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(TRACE, "populatePrefixTable"); } // Create the storage. prefixTable = new HashMap<Class,String>(); // Populate with the supported (non-null) data types. prefixTable.put(Boolean.class, PREFIX_BOOLEAN); prefixTable.put(Integer.class, PREFIX_INT); prefixTable.put(Byte.class, PREFIX_BYTE); prefixTable.put(Short.class, PREFIX_SHORT); prefixTable.put(String.class, PREFIX_STRING); prefixTable.put(Float.class, PREFIX_FLOAT); prefixTable.put(Double.class, PREFIX_DOUBLE); prefixTable.put(Long.class, PREFIX_LONG); prefixTable.put(StringArrayWrapper.class, PREFIX_ROUTING_PATH); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(TRACE, "populatePrefixTable"); } }
[ "public", "void", "populatePrefixTable", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "TRACE", ",", "\"populatePrefixTable\"", ")", ";", "}", "// Create the storage.", "prefixTable", "=", "new", "HashMap", "<", "Class", ",", "String", ">", "(", ")", ";", "// Populate with the supported (non-null) data types.", "prefixTable", ".", "put", "(", "Boolean", ".", "class", ",", "PREFIX_BOOLEAN", ")", ";", "prefixTable", ".", "put", "(", "Integer", ".", "class", ",", "PREFIX_INT", ")", ";", "prefixTable", ".", "put", "(", "Byte", ".", "class", ",", "PREFIX_BYTE", ")", ";", "prefixTable", ".", "put", "(", "Short", ".", "class", ",", "PREFIX_SHORT", ")", ";", "prefixTable", ".", "put", "(", "String", ".", "class", ",", "PREFIX_STRING", ")", ";", "prefixTable", ".", "put", "(", "Float", ".", "class", ",", "PREFIX_FLOAT", ")", ";", "prefixTable", ".", "put", "(", "Double", ".", "class", ",", "PREFIX_DOUBLE", ")", ";", "prefixTable", ".", "put", "(", "Long", ".", "class", ",", "PREFIX_LONG", ")", ";", "prefixTable", ".", "put", "(", "StringArrayWrapper", ".", "class", ",", "PREFIX_ROUTING_PATH", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "TRACE", ",", "\"populatePrefixTable\"", ")", ";", "}", "}" ]
Populates the prefix table for use when creating a Reference to a ConnFactory. Creates a map between supported data types for properties and the prefix used to store them.
[ "Populates", "the", "prefix", "table", "for", "use", "when", "creating", "a", "Reference", "to", "a", "ConnFactory", ".", "Creates", "a", "map", "between", "supported", "data", "types", "for", "properties", "and", "the", "prefix", "used", "to", "store", "them", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaReferenceUtilsImpl.java#L76-L101
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaReferenceUtilsImpl.java
JmsJcaReferenceUtilsImpl.getMapFromReference
public Map getMapFromReference(final Reference ref, final Map defaults) { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, "getMapFromReference", new Object[] {ref,defaults}); } Map extractedProps = null; // Extract a Map of the properties from the Reference synchronized (ref) { Enumeration propsList = ref.getAll(); // This will be set up to contain a map representing all the // information that was previously stored in the Reference. final Map<String,String> encodedMap = new HashMap<String,String>(); // Look at each property in turn. while (propsList.hasMoreElements()) { // Get the coded version of the name. This will start with one // of the prefix values. The codedName must have been non-null. StringRefAddr refAddr = (StringRefAddr) propsList.nextElement(); String codedName = refAddr.getType(); String val = (String) refAddr.getContent(); // Store the coded information in the map. encodedMap.put(codedName, val); }//while // Decode the encoded map. extractedProps = getStringDecodedMap(encodedMap, defaults); }//sync if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, "getMapFromReference", extractedProps); } return extractedProps; }
java
public Map getMapFromReference(final Reference ref, final Map defaults) { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, "getMapFromReference", new Object[] {ref,defaults}); } Map extractedProps = null; // Extract a Map of the properties from the Reference synchronized (ref) { Enumeration propsList = ref.getAll(); // This will be set up to contain a map representing all the // information that was previously stored in the Reference. final Map<String,String> encodedMap = new HashMap<String,String>(); // Look at each property in turn. while (propsList.hasMoreElements()) { // Get the coded version of the name. This will start with one // of the prefix values. The codedName must have been non-null. StringRefAddr refAddr = (StringRefAddr) propsList.nextElement(); String codedName = refAddr.getType(); String val = (String) refAddr.getContent(); // Store the coded information in the map. encodedMap.put(codedName, val); }//while // Decode the encoded map. extractedProps = getStringDecodedMap(encodedMap, defaults); }//sync if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, "getMapFromReference", extractedProps); } return extractedProps; }
[ "public", "Map", "getMapFromReference", "(", "final", "Reference", "ref", ",", "final", "Map", "defaults", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "this", ",", "TRACE", ",", "\"getMapFromReference\"", ",", "new", "Object", "[", "]", "{", "ref", ",", "defaults", "}", ")", ";", "}", "Map", "extractedProps", "=", "null", ";", "// Extract a Map of the properties from the Reference", "synchronized", "(", "ref", ")", "{", "Enumeration", "propsList", "=", "ref", ".", "getAll", "(", ")", ";", "// This will be set up to contain a map representing all the", "// information that was previously stored in the Reference.", "final", "Map", "<", "String", ",", "String", ">", "encodedMap", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "// Look at each property in turn.", "while", "(", "propsList", ".", "hasMoreElements", "(", ")", ")", "{", "// Get the coded version of the name. This will start with one", "// of the prefix values. The codedName must have been non-null.", "StringRefAddr", "refAddr", "=", "(", "StringRefAddr", ")", "propsList", ".", "nextElement", "(", ")", ";", "String", "codedName", "=", "refAddr", ".", "getType", "(", ")", ";", "String", "val", "=", "(", "String", ")", "refAddr", ".", "getContent", "(", ")", ";", "// Store the coded information in the map.", "encodedMap", ".", "put", "(", "codedName", ",", "val", ")", ";", "}", "//while", "// Decode the encoded map.", "extractedProps", "=", "getStringDecodedMap", "(", "encodedMap", ",", "defaults", ")", ";", "}", "//sync", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "this", ",", "TRACE", ",", "\"getMapFromReference\"", ",", "extractedProps", ")", ";", "}", "return", "extractedProps", ";", "}" ]
Uses the reference passed in to extract a map of properties which have been stored in this Reference. @param ref the reference @param defaults the default set of properties to be used (those in the reference will override these) @return the map of properties
[ "Uses", "the", "reference", "passed", "in", "to", "extract", "a", "map", "of", "properties", "which", "have", "been", "stored", "in", "this", "Reference", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaReferenceUtilsImpl.java#L386-L427
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaReferenceUtilsImpl.java
JmsJcaReferenceUtilsImpl.populateReference
public void populateReference(final Reference reference, final Map properties, final Map defaults) { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, "populateReference", new Object[] { reference, properties, defaults}); } // Make sure no-one can pull the rug from beneath us. synchronized (properties) { // Convert the map of properties into an encoded form, where the // keys have the necessary prefix on the front, and the values are // all Strings. Map<String,String> encodedMap = getStringEncodedMap(properties,defaults); for(Map.Entry<String,String> entry : encodedMap.entrySet()) { reference.add(new StringRefAddr(entry.getKey(),entry.getValue())); } }//sync if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, "populateReference"); } }
java
public void populateReference(final Reference reference, final Map properties, final Map defaults) { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, "populateReference", new Object[] { reference, properties, defaults}); } // Make sure no-one can pull the rug from beneath us. synchronized (properties) { // Convert the map of properties into an encoded form, where the // keys have the necessary prefix on the front, and the values are // all Strings. Map<String,String> encodedMap = getStringEncodedMap(properties,defaults); for(Map.Entry<String,String> entry : encodedMap.entrySet()) { reference.add(new StringRefAddr(entry.getKey(),entry.getValue())); } }//sync if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, "populateReference"); } }
[ "public", "void", "populateReference", "(", "final", "Reference", "reference", ",", "final", "Map", "properties", ",", "final", "Map", "defaults", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "this", ",", "TRACE", ",", "\"populateReference\"", ",", "new", "Object", "[", "]", "{", "reference", ",", "properties", ",", "defaults", "}", ")", ";", "}", "// Make sure no-one can pull the rug from beneath us.", "synchronized", "(", "properties", ")", "{", "// Convert the map of properties into an encoded form, where the", "// keys have the necessary prefix on the front, and the values are", "// all Strings.", "Map", "<", "String", ",", "String", ">", "encodedMap", "=", "getStringEncodedMap", "(", "properties", ",", "defaults", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "encodedMap", ".", "entrySet", "(", ")", ")", "{", "reference", ".", "add", "(", "new", "StringRefAddr", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ")", ";", "}", "}", "//sync", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "this", ",", "TRACE", ",", "\"populateReference\"", ")", ";", "}", "}" ]
Dynamically populates the reference that it has been given using the properties currently stored in this ConnectionFactory. Note that this way of doing things automatically handles the adding of extra properties without the need to change this code. @param reference the reference to populate @param properties the properties to populate the reference with @param defaults the default set of properties to be used (if properties in theProps are set to these defaults, they will be omitted from the reference)
[ "Dynamically", "populates", "the", "reference", "that", "it", "has", "been", "given", "using", "the", "properties", "currently", "stored", "in", "this", "ConnectionFactory", ".", "Note", "that", "this", "way", "of", "doing", "things", "automatically", "handles", "the", "adding", "of", "extra", "properties", "without", "the", "need", "to", "change", "this", "code", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaReferenceUtilsImpl.java#L443-L470
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/ServerJFapCommunicator.java
ServerJFapCommunicator.setCommsConnection
@Override protected void setCommsConnection(CommsConnection cc) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "setCommsConnection"); // Retrieve Client Conversation State if necessary validateConversationState(); sConState.setCommsConnection(cc); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "setCommsConnection"); }
java
@Override protected void setCommsConnection(CommsConnection cc) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "setCommsConnection"); // Retrieve Client Conversation State if necessary validateConversationState(); sConState.setCommsConnection(cc); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "setCommsConnection"); }
[ "@", "Override", "protected", "void", "setCommsConnection", "(", "CommsConnection", "cc", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"setCommsConnection\"", ")", ";", "// Retrieve Client Conversation State if necessary", "validateConversationState", "(", ")", ";", "sConState", ".", "setCommsConnection", "(", "cc", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"setCommsConnection\"", ")", ";", "}" ]
Sets the CommsConnection associated with this Conversation @param cc
[ "Sets", "the", "CommsConnection", "associated", "with", "this", "Conversation" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/ServerJFapCommunicator.java#L108-L120
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/GenericTransportAcceptListener.java
GenericTransportAcceptListener.acceptConnection
public ConversationReceiveListener acceptConnection(Conversation cfConversation) { if (tc.isEntryEnabled()) SibTr.entry(tc, "acceptConnection"); // Return new instance of a GenericTransportReceiveListener. This listener // determines whether data has been received from a client or ME and routes it // accordingly to the ServerTransportReceiveListener or MEConnectionListener if (tc.isEntryEnabled()) SibTr.exit(tc, "acceptConnection"); return genericTransportRecieveListnerInstance; // F193735.3 }
java
public ConversationReceiveListener acceptConnection(Conversation cfConversation) { if (tc.isEntryEnabled()) SibTr.entry(tc, "acceptConnection"); // Return new instance of a GenericTransportReceiveListener. This listener // determines whether data has been received from a client or ME and routes it // accordingly to the ServerTransportReceiveListener or MEConnectionListener if (tc.isEntryEnabled()) SibTr.exit(tc, "acceptConnection"); return genericTransportRecieveListnerInstance; // F193735.3 }
[ "public", "ConversationReceiveListener", "acceptConnection", "(", "Conversation", "cfConversation", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"acceptConnection\"", ")", ";", "// Return new instance of a GenericTransportReceiveListener. This listener", "// determines whether data has been received from a client or ME and routes it", "// accordingly to the ServerTransportReceiveListener or MEConnectionListener", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"acceptConnection\"", ")", ";", "return", "genericTransportRecieveListnerInstance", ";", "// F193735.3", "}" ]
Notified when a new conversation is accepted by a listening socket. @param cfConversation The new conversation. @return The conversation receive listener to use for asynchronous receive notification for this whole conversation.
[ "Notified", "when", "a", "new", "conversation", "is", "accepted", "by", "a", "listening", "socket", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/GenericTransportAcceptListener.java#L67-L79
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/SIBMBeanResultFactory.java
SIBMBeanResultFactory.createSIBQueuedMessage
public static QueuedMessage createSIBQueuedMessage(SIMPQueuedMessageControllable qmc) { String id = null; int jsApproximateLength = 0; String name = null; String state = null; String transactionId = null; String type = null; String busSystemMessageId = null; id = qmc.getId(); name = qmc.getName(); state = null; transactionId = null; try { if (qmc.getState() != null) { state = qmc.getState().toString(); } transactionId = qmc.getTransactionId(); } catch (SIMPException e) { // No FFDC code needed } try { JsMessage jsMessage = qmc.getJsMessage(); jsApproximateLength = jsMessage.getApproximateLength(); busSystemMessageId = jsMessage.getSystemMessageId(); type = jsMessage.getJsMessageType().toString(); } catch (SIMPControllableNotFoundException e) { // No FFDC code needed } catch (SIMPException e) { // No FFDC code needed } return new QueuedMessage(id, name, jsApproximateLength, state, transactionId, type, busSystemMessageId); }
java
public static QueuedMessage createSIBQueuedMessage(SIMPQueuedMessageControllable qmc) { String id = null; int jsApproximateLength = 0; String name = null; String state = null; String transactionId = null; String type = null; String busSystemMessageId = null; id = qmc.getId(); name = qmc.getName(); state = null; transactionId = null; try { if (qmc.getState() != null) { state = qmc.getState().toString(); } transactionId = qmc.getTransactionId(); } catch (SIMPException e) { // No FFDC code needed } try { JsMessage jsMessage = qmc.getJsMessage(); jsApproximateLength = jsMessage.getApproximateLength(); busSystemMessageId = jsMessage.getSystemMessageId(); type = jsMessage.getJsMessageType().toString(); } catch (SIMPControllableNotFoundException e) { // No FFDC code needed } catch (SIMPException e) { // No FFDC code needed } return new QueuedMessage(id, name, jsApproximateLength, state, transactionId, type, busSystemMessageId); }
[ "public", "static", "QueuedMessage", "createSIBQueuedMessage", "(", "SIMPQueuedMessageControllable", "qmc", ")", "{", "String", "id", "=", "null", ";", "int", "jsApproximateLength", "=", "0", ";", "String", "name", "=", "null", ";", "String", "state", "=", "null", ";", "String", "transactionId", "=", "null", ";", "String", "type", "=", "null", ";", "String", "busSystemMessageId", "=", "null", ";", "id", "=", "qmc", ".", "getId", "(", ")", ";", "name", "=", "qmc", ".", "getName", "(", ")", ";", "state", "=", "null", ";", "transactionId", "=", "null", ";", "try", "{", "if", "(", "qmc", ".", "getState", "(", ")", "!=", "null", ")", "{", "state", "=", "qmc", ".", "getState", "(", ")", ".", "toString", "(", ")", ";", "}", "transactionId", "=", "qmc", ".", "getTransactionId", "(", ")", ";", "}", "catch", "(", "SIMPException", "e", ")", "{", "// No FFDC code needed", "}", "try", "{", "JsMessage", "jsMessage", "=", "qmc", ".", "getJsMessage", "(", ")", ";", "jsApproximateLength", "=", "jsMessage", ".", "getApproximateLength", "(", ")", ";", "busSystemMessageId", "=", "jsMessage", ".", "getSystemMessageId", "(", ")", ";", "type", "=", "jsMessage", ".", "getJsMessageType", "(", ")", ".", "toString", "(", ")", ";", "}", "catch", "(", "SIMPControllableNotFoundException", "e", ")", "{", "// No FFDC code needed", "}", "catch", "(", "SIMPException", "e", ")", "{", "// No FFDC code needed", "}", "return", "new", "QueuedMessage", "(", "id", ",", "name", ",", "jsApproximateLength", ",", "state", ",", "transactionId", ",", "type", ",", "busSystemMessageId", ")", ";", "}" ]
Create a SIBQueuedMessageImpl instance from the supplied SIMPQueuedMessageControllable. @param qmc @return
[ "Create", "a", "SIBQueuedMessageImpl", "instance", "from", "the", "supplied", "SIMPQueuedMessageControllable", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/SIBMBeanResultFactory.java#L43-L79
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/SIBMBeanResultFactory.java
SIBMBeanResultFactory.createSIBSubscription
public static MessagingSubscription createSIBSubscription(SIMPLocalSubscriptionControllable ls) { long depth = 0; String id = null; int maxMsgs = 0; String name = null; String selector = null; String subscriberId = null; String[] topics = null; depth = ls.getNumberOfQueuedMessages(); id = ls.getId(); name = ls.getName(); selector = ls.getSelector(); subscriberId = ls.getSubscriberID(); topics = ls.getTopics(); return new MessagingSubscription(depth, id, maxMsgs, name, selector, subscriberId, topics); }
java
public static MessagingSubscription createSIBSubscription(SIMPLocalSubscriptionControllable ls) { long depth = 0; String id = null; int maxMsgs = 0; String name = null; String selector = null; String subscriberId = null; String[] topics = null; depth = ls.getNumberOfQueuedMessages(); id = ls.getId(); name = ls.getName(); selector = ls.getSelector(); subscriberId = ls.getSubscriberID(); topics = ls.getTopics(); return new MessagingSubscription(depth, id, maxMsgs, name, selector, subscriberId, topics); }
[ "public", "static", "MessagingSubscription", "createSIBSubscription", "(", "SIMPLocalSubscriptionControllable", "ls", ")", "{", "long", "depth", "=", "0", ";", "String", "id", "=", "null", ";", "int", "maxMsgs", "=", "0", ";", "String", "name", "=", "null", ";", "String", "selector", "=", "null", ";", "String", "subscriberId", "=", "null", ";", "String", "[", "]", "topics", "=", "null", ";", "depth", "=", "ls", ".", "getNumberOfQueuedMessages", "(", ")", ";", "id", "=", "ls", ".", "getId", "(", ")", ";", "name", "=", "ls", ".", "getName", "(", ")", ";", "selector", "=", "ls", ".", "getSelector", "(", ")", ";", "subscriberId", "=", "ls", ".", "getSubscriberID", "(", ")", ";", "topics", "=", "ls", ".", "getTopics", "(", ")", ";", "return", "new", "MessagingSubscription", "(", "depth", ",", "id", ",", "maxMsgs", ",", "name", ",", "selector", ",", "subscriberId", ",", "topics", ")", ";", "}" ]
Create a MessagingSubscription instance from the supplied SIMPLocalSubscriptionControllable. @param ls @return
[ "Create", "a", "MessagingSubscription", "instance", "from", "the", "supplied", "SIMPLocalSubscriptionControllable", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/SIBMBeanResultFactory.java#L296-L314
train
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java
StatsConfigHelper.getNLS
private static NLS getNLS(Locale l, String resourceBundle, String statsType) { // init Locale boolean bDefaultLocale = false; if (l == null || l == Locale.getDefault()) { bDefaultLocale = true; l = Locale.getDefault(); } NLS aNLS = null; if (resourceBundle == null) { // resourceBundle is NULL // trial 1: try prepending the 5.0 default resourcebundle location prefix (to support commerce, portal, etc.) // trial 2: if that fails return default 6.0 PMI resourcebundle int trial = 1; do { if (trial == 1) resourceBundle = PMI_RESOURCE_BUNDLE_PREFIX_50 + statsType; else if (trial == 2) resourceBundle = PMI_RESOURCE_BUNDLE; // 234782 - JPM: Check in NLS cache aNLS = (NLS) nlsMap.get(getNlsKey(resourceBundle, l)); if (aNLS != null) return aNLS; else aNLS = new NLS(resourceBundle, l, true, false); // first time create if (aNLS.isResourceLoaded()) break; ++trial; } while (trial <= 2); } else { // resourcebundle != null // Custom resource bundle // 234782 - JPM: Check in NLS cache aNLS = (NLS) nlsMap.get(getNlsKey(resourceBundle, l)); if (aNLS != null) return aNLS; else aNLS = new NLS(resourceBundle, l, true, false); // first time create // resourcebundle not loaded. so try using contextClassLoader to support // custom pmi in applications (war/ear file) // custom pmi resource bundle that is not found in the path // may its an application so use context classloader if (!aNLS.isResourceLoaded()) { // ------ security code final String _rbName = resourceBundle; final Locale _locale = l; try { aNLS = (NLS) AccessController.doPrivileged( new PrivilegedExceptionAction() { @Override public Object run() throws Exception { return new NLS(_rbName, _locale, Thread.currentThread().getContextClassLoader()); } }); } catch (Exception e1) { Tr.warning(tc, "PMI0030W", resourceBundle); if (tc.isDebugEnabled()) Tr.debug(tc, "Error loading custom resource bundle using context classloader: " + e1.getMessage()); } if (aNLS == null || !aNLS.isResourceLoaded()) { aNLS = null; } // ------ security code } } // 234782 - JPM: Cache NLS object if successfully created if (aNLS != null && aNLS.isResourceLoaded()) { if (tc.isDebugEnabled()) Tr.debug(tc, "Caching resource bundle: " + resourceBundle + " locale: " + l); // 234782 - JPM: Cache resourcebundle for this locale nlsMap.put(getNlsKey(resourceBundle, l), aNLS); } return aNLS; }
java
private static NLS getNLS(Locale l, String resourceBundle, String statsType) { // init Locale boolean bDefaultLocale = false; if (l == null || l == Locale.getDefault()) { bDefaultLocale = true; l = Locale.getDefault(); } NLS aNLS = null; if (resourceBundle == null) { // resourceBundle is NULL // trial 1: try prepending the 5.0 default resourcebundle location prefix (to support commerce, portal, etc.) // trial 2: if that fails return default 6.0 PMI resourcebundle int trial = 1; do { if (trial == 1) resourceBundle = PMI_RESOURCE_BUNDLE_PREFIX_50 + statsType; else if (trial == 2) resourceBundle = PMI_RESOURCE_BUNDLE; // 234782 - JPM: Check in NLS cache aNLS = (NLS) nlsMap.get(getNlsKey(resourceBundle, l)); if (aNLS != null) return aNLS; else aNLS = new NLS(resourceBundle, l, true, false); // first time create if (aNLS.isResourceLoaded()) break; ++trial; } while (trial <= 2); } else { // resourcebundle != null // Custom resource bundle // 234782 - JPM: Check in NLS cache aNLS = (NLS) nlsMap.get(getNlsKey(resourceBundle, l)); if (aNLS != null) return aNLS; else aNLS = new NLS(resourceBundle, l, true, false); // first time create // resourcebundle not loaded. so try using contextClassLoader to support // custom pmi in applications (war/ear file) // custom pmi resource bundle that is not found in the path // may its an application so use context classloader if (!aNLS.isResourceLoaded()) { // ------ security code final String _rbName = resourceBundle; final Locale _locale = l; try { aNLS = (NLS) AccessController.doPrivileged( new PrivilegedExceptionAction() { @Override public Object run() throws Exception { return new NLS(_rbName, _locale, Thread.currentThread().getContextClassLoader()); } }); } catch (Exception e1) { Tr.warning(tc, "PMI0030W", resourceBundle); if (tc.isDebugEnabled()) Tr.debug(tc, "Error loading custom resource bundle using context classloader: " + e1.getMessage()); } if (aNLS == null || !aNLS.isResourceLoaded()) { aNLS = null; } // ------ security code } } // 234782 - JPM: Cache NLS object if successfully created if (aNLS != null && aNLS.isResourceLoaded()) { if (tc.isDebugEnabled()) Tr.debug(tc, "Caching resource bundle: " + resourceBundle + " locale: " + l); // 234782 - JPM: Cache resourcebundle for this locale nlsMap.put(getNlsKey(resourceBundle, l), aNLS); } return aNLS; }
[ "private", "static", "NLS", "getNLS", "(", "Locale", "l", ",", "String", "resourceBundle", ",", "String", "statsType", ")", "{", "// init Locale", "boolean", "bDefaultLocale", "=", "false", ";", "if", "(", "l", "==", "null", "||", "l", "==", "Locale", ".", "getDefault", "(", ")", ")", "{", "bDefaultLocale", "=", "true", ";", "l", "=", "Locale", ".", "getDefault", "(", ")", ";", "}", "NLS", "aNLS", "=", "null", ";", "if", "(", "resourceBundle", "==", "null", ")", "{", "// resourceBundle is NULL", "// trial 1: try prepending the 5.0 default resourcebundle location prefix (to support commerce, portal, etc.)", "// trial 2: if that fails return default 6.0 PMI resourcebundle", "int", "trial", "=", "1", ";", "do", "{", "if", "(", "trial", "==", "1", ")", "resourceBundle", "=", "PMI_RESOURCE_BUNDLE_PREFIX_50", "+", "statsType", ";", "else", "if", "(", "trial", "==", "2", ")", "resourceBundle", "=", "PMI_RESOURCE_BUNDLE", ";", "// 234782 - JPM: Check in NLS cache", "aNLS", "=", "(", "NLS", ")", "nlsMap", ".", "get", "(", "getNlsKey", "(", "resourceBundle", ",", "l", ")", ")", ";", "if", "(", "aNLS", "!=", "null", ")", "return", "aNLS", ";", "else", "aNLS", "=", "new", "NLS", "(", "resourceBundle", ",", "l", ",", "true", ",", "false", ")", ";", "// first time create ", "if", "(", "aNLS", ".", "isResourceLoaded", "(", ")", ")", "break", ";", "++", "trial", ";", "}", "while", "(", "trial", "<=", "2", ")", ";", "}", "else", "{", "// resourcebundle != null", "// Custom resource bundle", "// 234782 - JPM: Check in NLS cache", "aNLS", "=", "(", "NLS", ")", "nlsMap", ".", "get", "(", "getNlsKey", "(", "resourceBundle", ",", "l", ")", ")", ";", "if", "(", "aNLS", "!=", "null", ")", "return", "aNLS", ";", "else", "aNLS", "=", "new", "NLS", "(", "resourceBundle", ",", "l", ",", "true", ",", "false", ")", ";", "// first time create ", "// resourcebundle not loaded. so try using contextClassLoader to support", "// custom pmi in applications (war/ear file)", "// custom pmi resource bundle that is not found in the path", "// may its an application so use context classloader ", "if", "(", "!", "aNLS", ".", "isResourceLoaded", "(", ")", ")", "{", "// ------ security code", "final", "String", "_rbName", "=", "resourceBundle", ";", "final", "Locale", "_locale", "=", "l", ";", "try", "{", "aNLS", "=", "(", "NLS", ")", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedExceptionAction", "(", ")", "{", "@", "Override", "public", "Object", "run", "(", ")", "throws", "Exception", "{", "return", "new", "NLS", "(", "_rbName", ",", "_locale", ",", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ")", ";", "}", "}", ")", ";", "}", "catch", "(", "Exception", "e1", ")", "{", "Tr", ".", "warning", "(", "tc", ",", "\"PMI0030W\"", ",", "resourceBundle", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Error loading custom resource bundle using context classloader: \"", "+", "e1", ".", "getMessage", "(", ")", ")", ";", "}", "if", "(", "aNLS", "==", "null", "||", "!", "aNLS", ".", "isResourceLoaded", "(", ")", ")", "{", "aNLS", "=", "null", ";", "}", "// ------ security code", "}", "}", "// 234782 - JPM: Cache NLS object if successfully created", "if", "(", "aNLS", "!=", "null", "&&", "aNLS", ".", "isResourceLoaded", "(", ")", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Caching resource bundle: \"", "+", "resourceBundle", "+", "\" locale: \"", "+", "l", ")", ";", "// 234782 - JPM: Cache resourcebundle for this locale", "nlsMap", ".", "put", "(", "getNlsKey", "(", "resourceBundle", ",", "l", ")", ",", "aNLS", ")", ";", "}", "return", "aNLS", ";", "}" ]
in which case we dont cache
[ "in", "which", "case", "we", "dont", "cache" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java#L76-L159
train
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java
StatsConfigHelper.getStatsConfig
public static PmiModuleConfig getStatsConfig(String statsType) { PmiModuleConfig cfg = (PmiModuleConfig) rawConfigMap.get(statsType); if (cfg == null) cfg = _getStatsConfig(statsType, false, null); return cfg; }
java
public static PmiModuleConfig getStatsConfig(String statsType) { PmiModuleConfig cfg = (PmiModuleConfig) rawConfigMap.get(statsType); if (cfg == null) cfg = _getStatsConfig(statsType, false, null); return cfg; }
[ "public", "static", "PmiModuleConfig", "getStatsConfig", "(", "String", "statsType", ")", "{", "PmiModuleConfig", "cfg", "=", "(", "PmiModuleConfig", ")", "rawConfigMap", ".", "get", "(", "statsType", ")", ";", "if", "(", "cfg", "==", "null", ")", "cfg", "=", "_getStatsConfig", "(", "statsType", ",", "false", ",", "null", ")", ";", "return", "cfg", ";", "}" ]
No translation.
[ "No", "translation", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java#L190-L195
train
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java
StatsConfigHelper.getTranslatedStatsConfig
public static PmiModuleConfig getTranslatedStatsConfig(String statsType, Locale locale) { PmiModuleConfig aCfg = getConfig(locale, statsType); if (aCfg == null) aCfg = _getStatsConfig(statsType, true, locale); return aCfg; }
java
public static PmiModuleConfig getTranslatedStatsConfig(String statsType, Locale locale) { PmiModuleConfig aCfg = getConfig(locale, statsType); if (aCfg == null) aCfg = _getStatsConfig(statsType, true, locale); return aCfg; }
[ "public", "static", "PmiModuleConfig", "getTranslatedStatsConfig", "(", "String", "statsType", ",", "Locale", "locale", ")", "{", "PmiModuleConfig", "aCfg", "=", "getConfig", "(", "locale", ",", "statsType", ")", ";", "if", "(", "aCfg", "==", "null", ")", "aCfg", "=", "_getStatsConfig", "(", "statsType", ",", "true", ",", "locale", ")", ";", "return", "aCfg", ";", "}" ]
Translated based on the server locale
[ "Translated", "based", "on", "the", "server", "locale" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java#L203-L209
train
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java
StatsConfigHelper.translateAndCache
public static void translateAndCache(PmiModuleConfig cfg, Locale l) { PmiModuleConfig aCfg = getConfig(l, cfg.getUID()); if (aCfg == null) { aCfg = cfg.copy(); // create a copy before translating // filter sub-module entry if (aCfg != null) { PmiDataInfo[] data = aCfg.listData(null); for (int k = data.length - 1; k >= 0; k--) { if (data[k].getType() == PmiConstants.TYPE_SUBMODULE) aCfg.removeData(data[k]); } } aCfg = translate(aCfg, l); //getNLS (l, cfg.getResourceBundle())); getConfigMap(l).put(aCfg.getUID(), aCfg); } }
java
public static void translateAndCache(PmiModuleConfig cfg, Locale l) { PmiModuleConfig aCfg = getConfig(l, cfg.getUID()); if (aCfg == null) { aCfg = cfg.copy(); // create a copy before translating // filter sub-module entry if (aCfg != null) { PmiDataInfo[] data = aCfg.listData(null); for (int k = data.length - 1; k >= 0; k--) { if (data[k].getType() == PmiConstants.TYPE_SUBMODULE) aCfg.removeData(data[k]); } } aCfg = translate(aCfg, l); //getNLS (l, cfg.getResourceBundle())); getConfigMap(l).put(aCfg.getUID(), aCfg); } }
[ "public", "static", "void", "translateAndCache", "(", "PmiModuleConfig", "cfg", ",", "Locale", "l", ")", "{", "PmiModuleConfig", "aCfg", "=", "getConfig", "(", "l", ",", "cfg", ".", "getUID", "(", ")", ")", ";", "if", "(", "aCfg", "==", "null", ")", "{", "aCfg", "=", "cfg", ".", "copy", "(", ")", ";", "// create a copy before translating", "// filter sub-module entry ", "if", "(", "aCfg", "!=", "null", ")", "{", "PmiDataInfo", "[", "]", "data", "=", "aCfg", ".", "listData", "(", "null", ")", ";", "for", "(", "int", "k", "=", "data", ".", "length", "-", "1", ";", "k", ">=", "0", ";", "k", "--", ")", "{", "if", "(", "data", "[", "k", "]", ".", "getType", "(", ")", "==", "PmiConstants", ".", "TYPE_SUBMODULE", ")", "aCfg", ".", "removeData", "(", "data", "[", "k", "]", ")", ";", "}", "}", "aCfg", "=", "translate", "(", "aCfg", ",", "l", ")", ";", "//getNLS (l, cfg.getResourceBundle()));", "getConfigMap", "(", "l", ")", ".", "put", "(", "aCfg", ".", "getUID", "(", ")", ",", "aCfg", ")", ";", "}", "}" ]
called by PmiRegistry.
[ "called", "by", "PmiRegistry", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java#L430-L447
train
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/ModuleAggregate.java
ModuleAggregate.getPath
public String[] getPath() { if (path != null) return path; else if (instanceName == null && type == TYPE_SUBMODULE) return new String[] { moduleID, submoduleName }; else return super.getPath(); }
java
public String[] getPath() { if (path != null) return path; else if (instanceName == null && type == TYPE_SUBMODULE) return new String[] { moduleID, submoduleName }; else return super.getPath(); }
[ "public", "String", "[", "]", "getPath", "(", ")", "{", "if", "(", "path", "!=", "null", ")", "return", "path", ";", "else", "if", "(", "instanceName", "==", "null", "&&", "type", "==", "TYPE_SUBMODULE", ")", "return", "new", "String", "[", "]", "{", "moduleID", ",", "submoduleName", "}", ";", "else", "return", "super", ".", "getPath", "(", ")", ";", "}" ]
overwrite getPath method
[ "overwrite", "getPath", "method" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/ModuleAggregate.java#L114-L121
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/control/SubscriptionMessageType.java
SubscriptionMessageType.getSubscriptionMessageType
public final static SubscriptionMessageType getSubscriptionMessageType(int aValue) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc,"Value = " + aValue); return set[aValue]; }
java
public final static SubscriptionMessageType getSubscriptionMessageType(int aValue) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc,"Value = " + aValue); return set[aValue]; }
[ "public", "final", "static", "SubscriptionMessageType", "getSubscriptionMessageType", "(", "int", "aValue", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Value = \"", "+", "aValue", ")", ";", "return", "set", "[", "aValue", "]", ";", "}" ]
Returns the corresponding SubscriptionMessageType for a given integer. This method should NOT be called by any code outside the MFP component. It is only public so that it can be accessed by sub-packages. @param aValue The integer for which an SubscriptionMessageType is required. @return The corresponding SubscriptionMessageType
[ "Returns", "the", "corresponding", "SubscriptionMessageType", "for", "a", "given", "integer", ".", "This", "method", "should", "NOT", "be", "called", "by", "any", "code", "outside", "the", "MFP", "component", ".", "It", "is", "only", "public", "so", "that", "it", "can", "be", "accessed", "by", "sub", "-", "packages", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/control/SubscriptionMessageType.java#L78-L81
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/BlockingList.java
BlockingList.fail
private void fail(final K key) { final String methodName = "fail(): "; stateLock.writeLock().lock(); try { Integer index = actualIndices.remove(key); if (index == null) throw new IllegalArgumentException("unknown key: " + key); elements[index] = FAILED; // register that this key failed (failedKeys == null ? failedKeys = new ArrayList<K>(actualIndices.size() + 1) : failedKeys).add(key); checkForCompletion(); if (tc.isDebugEnabled()) Tr.debug(tc, methodName, "permanent fail for key " + key); stateLock.postEvent(); } finally { stateLock.writeLock().unlock(); } }
java
private void fail(final K key) { final String methodName = "fail(): "; stateLock.writeLock().lock(); try { Integer index = actualIndices.remove(key); if (index == null) throw new IllegalArgumentException("unknown key: " + key); elements[index] = FAILED; // register that this key failed (failedKeys == null ? failedKeys = new ArrayList<K>(actualIndices.size() + 1) : failedKeys).add(key); checkForCompletion(); if (tc.isDebugEnabled()) Tr.debug(tc, methodName, "permanent fail for key " + key); stateLock.postEvent(); } finally { stateLock.writeLock().unlock(); } }
[ "private", "void", "fail", "(", "final", "K", "key", ")", "{", "final", "String", "methodName", "=", "\"fail(): \"", ";", "stateLock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "Integer", "index", "=", "actualIndices", ".", "remove", "(", "key", ")", ";", "if", "(", "index", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"unknown key: \"", "+", "key", ")", ";", "elements", "[", "index", "]", "=", "FAILED", ";", "// register that this key failed", "(", "failedKeys", "==", "null", "?", "failedKeys", "=", "new", "ArrayList", "<", "K", ">", "(", "actualIndices", ".", "size", "(", ")", "+", "1", ")", ":", "failedKeys", ")", ".", "add", "(", "key", ")", ";", "checkForCompletion", "(", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "methodName", ",", "\"permanent fail for key \"", "+", "key", ")", ";", "stateLock", ".", "postEvent", "(", ")", ";", "}", "finally", "{", "stateLock", ".", "writeLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}" ]
Permanently fail to retrieve the element associated with the key, independently of any timeout.
[ "Permanently", "fail", "to", "retrieve", "the", "element", "associated", "with", "the", "key", "independently", "of", "any", "timeout", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/BlockingList.java#L445-L462
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/BlockingList.java
BlockingList.checkForCompletion
private void checkForCompletion() { final String methodName = "checkForCompletion(): "; // mark the list complete if that was the last awaited key if (actualIndices.isEmpty()) { if (tc.isDebugEnabled()) Tr.debug(tc, methodName + "setting state=COMPLETE"); state = failedKeys == null ? COMPLETE : COMPLETE_WITH_FAILURES; // state change must be last action } }
java
private void checkForCompletion() { final String methodName = "checkForCompletion(): "; // mark the list complete if that was the last awaited key if (actualIndices.isEmpty()) { if (tc.isDebugEnabled()) Tr.debug(tc, methodName + "setting state=COMPLETE"); state = failedKeys == null ? COMPLETE : COMPLETE_WITH_FAILURES; // state change must be last action } }
[ "private", "void", "checkForCompletion", "(", ")", "{", "final", "String", "methodName", "=", "\"checkForCompletion(): \"", ";", "// mark the list complete if that was the last awaited key", "if", "(", "actualIndices", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "methodName", "+", "\"setting state=COMPLETE\"", ")", ";", "state", "=", "failedKeys", "==", "null", "?", "COMPLETE", ":", "COMPLETE_WITH_FAILURES", ";", "// state change must be last action", "}", "}" ]
if all the keys have been satisfied or permanently failed, mark this list as being complete
[ "if", "all", "the", "keys", "have", "been", "satisfied", "or", "permanently", "failed", "mark", "this", "list", "as", "being", "complete" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/BlockingList.java#L465-L475
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/BlockingList.java
BlockingList.size
@Override public int size() { stateLock.readLock().lock(); try { switch (state) { default: // This list might be empty or full or somewhere in between: // we don't know until we look! preFetchAll(); // The list is now either complete or timed out - recurse to find the result. return size(); case TIMED_OUT: return currentSize(); case COMPLETE_WITH_FAILURES: return elements.length - failedKeys.size(); case COMPLETE: return elements.length; } } finally { stateLock.readLock().unlock(); } }
java
@Override public int size() { stateLock.readLock().lock(); try { switch (state) { default: // This list might be empty or full or somewhere in between: // we don't know until we look! preFetchAll(); // The list is now either complete or timed out - recurse to find the result. return size(); case TIMED_OUT: return currentSize(); case COMPLETE_WITH_FAILURES: return elements.length - failedKeys.size(); case COMPLETE: return elements.length; } } finally { stateLock.readLock().unlock(); } }
[ "@", "Override", "public", "int", "size", "(", ")", "{", "stateLock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "switch", "(", "state", ")", "{", "default", ":", "// This list might be empty or full or somewhere in between:", "// we don't know until we look!", "preFetchAll", "(", ")", ";", "// The list is now either complete or timed out - recurse to find the result.", "return", "size", "(", ")", ";", "case", "TIMED_OUT", ":", "return", "currentSize", "(", ")", ";", "case", "COMPLETE_WITH_FAILURES", ":", "return", "elements", ".", "length", "-", "failedKeys", ".", "size", "(", ")", ";", "case", "COMPLETE", ":", "return", "elements", ".", "length", ";", "}", "}", "finally", "{", "stateLock", ".", "readLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}" ]
Find the size of this list, attempting to retrieve all elements if necessary.
[ "Find", "the", "size", "of", "this", "list", "attempting", "to", "retrieve", "all", "elements", "if", "necessary", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/BlockingList.java#L497-L518
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/BlockingList.java
BlockingList.ensureElement
@FFDCIgnore(IndexOutOfBoundsException.class) private boolean ensureElement(int index) { try { get(index); return true; } catch (IndexOutOfBoundsException e) { return false; } }
java
@FFDCIgnore(IndexOutOfBoundsException.class) private boolean ensureElement(int index) { try { get(index); return true; } catch (IndexOutOfBoundsException e) { return false; } }
[ "@", "FFDCIgnore", "(", "IndexOutOfBoundsException", ".", "class", ")", "private", "boolean", "ensureElement", "(", "int", "index", ")", "{", "try", "{", "get", "(", "index", ")", ";", "return", "true", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "return", "false", ";", "}", "}" ]
Blocking call to ensure an element is available @return false if the element is unavailable and the list has timed out
[ "Blocking", "call", "to", "ensure", "an", "element", "is", "available" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/BlockingList.java#L565-L573
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/BlockingList.java
BlockingList.getUnmatchedKeys
public Set<K> getUnmatchedKeys() { stateLock.readLock().lock(); try { return new HashSet<K>(this.actualIndices.keySet()); } finally { stateLock.readLock().unlock(); } }
java
public Set<K> getUnmatchedKeys() { stateLock.readLock().lock(); try { return new HashSet<K>(this.actualIndices.keySet()); } finally { stateLock.readLock().unlock(); } }
[ "public", "Set", "<", "K", ">", "getUnmatchedKeys", "(", ")", "{", "stateLock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "return", "new", "HashSet", "<", "K", ">", "(", "this", ".", "actualIndices", ".", "keySet", "(", ")", ")", ";", "}", "finally", "{", "stateLock", ".", "readLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}" ]
Get a point-in-time view of the unmatched keys. This may be immediately out of date unless additional synchronization is performed to prevent concurrent updates.
[ "Get", "a", "point", "-", "in", "-", "time", "view", "of", "the", "unmatched", "keys", ".", "This", "may", "be", "immediately", "out", "of", "date", "unless", "additional", "synchronization", "is", "performed", "to", "prevent", "concurrent", "updates", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/BlockingList.java#L659-L666
train
OpenLiberty/open-liberty
dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/adapter/FrameworkEventAdapter.java
FrameworkEventAdapter.getTopic
private String getTopic(FrameworkEvent frameworkEvent) { StringBuilder topic = new StringBuilder(FRAMEWORK_EVENT_TOPIC_PREFIX); switch (frameworkEvent.getType()) { case FrameworkEvent.STARTED: topic.append("STARTED"); break; case FrameworkEvent.ERROR: topic.append("ERROR"); break; case FrameworkEvent.PACKAGES_REFRESHED: topic.append("PACKAGES_REFRESHED"); break; case FrameworkEvent.STARTLEVEL_CHANGED: topic.append("STARTLEVEL_CHANGED"); break; case FrameworkEvent.WARNING: topic.append("WARNING"); break; case FrameworkEvent.INFO: topic.append("INFO"); break; default: return null; } return topic.toString(); }
java
private String getTopic(FrameworkEvent frameworkEvent) { StringBuilder topic = new StringBuilder(FRAMEWORK_EVENT_TOPIC_PREFIX); switch (frameworkEvent.getType()) { case FrameworkEvent.STARTED: topic.append("STARTED"); break; case FrameworkEvent.ERROR: topic.append("ERROR"); break; case FrameworkEvent.PACKAGES_REFRESHED: topic.append("PACKAGES_REFRESHED"); break; case FrameworkEvent.STARTLEVEL_CHANGED: topic.append("STARTLEVEL_CHANGED"); break; case FrameworkEvent.WARNING: topic.append("WARNING"); break; case FrameworkEvent.INFO: topic.append("INFO"); break; default: return null; } return topic.toString(); }
[ "private", "String", "getTopic", "(", "FrameworkEvent", "frameworkEvent", ")", "{", "StringBuilder", "topic", "=", "new", "StringBuilder", "(", "FRAMEWORK_EVENT_TOPIC_PREFIX", ")", ";", "switch", "(", "frameworkEvent", ".", "getType", "(", ")", ")", "{", "case", "FrameworkEvent", ".", "STARTED", ":", "topic", ".", "append", "(", "\"STARTED\"", ")", ";", "break", ";", "case", "FrameworkEvent", ".", "ERROR", ":", "topic", ".", "append", "(", "\"ERROR\"", ")", ";", "break", ";", "case", "FrameworkEvent", ".", "PACKAGES_REFRESHED", ":", "topic", ".", "append", "(", "\"PACKAGES_REFRESHED\"", ")", ";", "break", ";", "case", "FrameworkEvent", ".", "STARTLEVEL_CHANGED", ":", "topic", ".", "append", "(", "\"STARTLEVEL_CHANGED\"", ")", ";", "break", ";", "case", "FrameworkEvent", ".", "WARNING", ":", "topic", ".", "append", "(", "\"WARNING\"", ")", ";", "break", ";", "case", "FrameworkEvent", ".", "INFO", ":", "topic", ".", "append", "(", "\"INFO\"", ")", ";", "break", ";", "default", ":", "return", "null", ";", "}", "return", "topic", ".", "toString", "(", ")", ";", "}" ]
Determine the appropriate topic to use for the Framework Event. @param frameworkEvent the framework event that is being adapted @return the topic or null if the event is not supported
[ "Determine", "the", "appropriate", "topic", "to", "use", "for", "the", "Framework", "Event", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/adapter/FrameworkEventAdapter.java#L107-L134
train
OpenLiberty/open-liberty
dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/ThreadPoolController.java
ThreadPoolController.resetStatistics
void resetStatistics(boolean clearHistory) { lastTimerPop = System.currentTimeMillis(); previousCompleted = threadPool == null ? 0 : threadPool.getCompletedTaskCount(); previousThroughput = 0; consecutiveQueueEmptyCount = 0; consecutiveNoAdjustment = 0; consecutiveOutlierAfterAdjustment = 0; consecutiveIdleCount = 0; if (clearHistory) { threadStats = new TreeMap<Integer, ThroughputDistribution>(); } lastAction = LastAction.NONE; }
java
void resetStatistics(boolean clearHistory) { lastTimerPop = System.currentTimeMillis(); previousCompleted = threadPool == null ? 0 : threadPool.getCompletedTaskCount(); previousThroughput = 0; consecutiveQueueEmptyCount = 0; consecutiveNoAdjustment = 0; consecutiveOutlierAfterAdjustment = 0; consecutiveIdleCount = 0; if (clearHistory) { threadStats = new TreeMap<Integer, ThroughputDistribution>(); } lastAction = LastAction.NONE; }
[ "void", "resetStatistics", "(", "boolean", "clearHistory", ")", "{", "lastTimerPop", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "previousCompleted", "=", "threadPool", "==", "null", "?", "0", ":", "threadPool", ".", "getCompletedTaskCount", "(", ")", ";", "previousThroughput", "=", "0", ";", "consecutiveQueueEmptyCount", "=", "0", ";", "consecutiveNoAdjustment", "=", "0", ";", "consecutiveOutlierAfterAdjustment", "=", "0", ";", "consecutiveIdleCount", "=", "0", ";", "if", "(", "clearHistory", ")", "{", "threadStats", "=", "new", "TreeMap", "<", "Integer", ",", "ThroughputDistribution", ">", "(", ")", ";", "}", "lastAction", "=", "LastAction", ".", "NONE", ";", "}" ]
Reset all statistics associated with the target thread pool.
[ "Reset", "all", "statistics", "associated", "with", "the", "target", "thread", "pool", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/ThreadPoolController.java#L651-L667
train
OpenLiberty/open-liberty
dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/ThreadPoolController.java
ThreadPoolController.resetThreadPool
void resetThreadPool() { if (threadPool == null) return; // if no pool (during shutdown), nothing to retune/reset // 8/22/2012: Introduced factor - was hard coded at 2 final int availableProcessors = NUMBER_CPUS; int factor = 2500 * availableProcessors / Math.max(1, (int) previousThroughput); factor = Math.min(factor, 4); factor = Math.max(factor, 2); int newThreads = Math.min(factor * availableProcessors, maxThreads); newThreads = Math.max(newThreads, coreThreads); targetPoolSize = newThreads; setPoolSize(newThreads); resetStatistics(true); }
java
void resetThreadPool() { if (threadPool == null) return; // if no pool (during shutdown), nothing to retune/reset // 8/22/2012: Introduced factor - was hard coded at 2 final int availableProcessors = NUMBER_CPUS; int factor = 2500 * availableProcessors / Math.max(1, (int) previousThroughput); factor = Math.min(factor, 4); factor = Math.max(factor, 2); int newThreads = Math.min(factor * availableProcessors, maxThreads); newThreads = Math.max(newThreads, coreThreads); targetPoolSize = newThreads; setPoolSize(newThreads); resetStatistics(true); }
[ "void", "resetThreadPool", "(", ")", "{", "if", "(", "threadPool", "==", "null", ")", "return", ";", "// if no pool (during shutdown), nothing to retune/reset", "// 8/22/2012: Introduced factor - was hard coded at 2", "final", "int", "availableProcessors", "=", "NUMBER_CPUS", ";", "int", "factor", "=", "2500", "*", "availableProcessors", "/", "Math", ".", "max", "(", "1", ",", "(", "int", ")", "previousThroughput", ")", ";", "factor", "=", "Math", ".", "min", "(", "factor", ",", "4", ")", ";", "factor", "=", "Math", ".", "max", "(", "factor", ",", "2", ")", ";", "int", "newThreads", "=", "Math", ".", "min", "(", "factor", "*", "availableProcessors", ",", "maxThreads", ")", ";", "newThreads", "=", "Math", ".", "max", "(", "newThreads", ",", "coreThreads", ")", ";", "targetPoolSize", "=", "newThreads", ";", "setPoolSize", "(", "newThreads", ")", ";", "resetStatistics", "(", "true", ")", ";", "}" ]
Reset all statistics associated with the thread pool and reset the pool size to a value that's based on the number of hardware threads available to the JVM.
[ "Reset", "all", "statistics", "associated", "with", "the", "thread", "pool", "and", "reset", "the", "pool", "size", "to", "a", "value", "that", "s", "based", "on", "the", "number", "of", "hardware", "threads", "available", "to", "the", "JVM", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/ThreadPoolController.java#L674-L691
train