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.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/ConversationTable.java | ConversationTable.get | public synchronized ConversationImpl get(int id)
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "get", ""+id);
mutableKey.setValue(id);
ConversationImpl retValue = idToConvTable.get(mutableKey);
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "get", retValue);
return retValue;
} | java | public synchronized ConversationImpl get(int id)
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "get", ""+id);
mutableKey.setValue(id);
ConversationImpl retValue = idToConvTable.get(mutableKey);
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "get", retValue);
return retValue;
} | [
"public",
"synchronized",
"ConversationImpl",
"get",
"(",
"int",
"id",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"get\"",
",",
"\"\"",
"+",
"id",
")",
";",
"mutableKey",
".",
"setValue",
"(",
"id",
")",
";",
"ConversationImpl",
"retValue",
"=",
"idToConvTable",
".",
"get",
"(",
"mutableKey",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"get\"",
",",
"retValue",
")",
";",
"return",
"retValue",
";",
"}"
] | Retrieve a conversation from the table by ID
@param id
@return ConversationImpl | [
"Retrieve",
"a",
"conversation",
"from",
"the",
"table",
"by",
"ID"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/ConversationTable.java#L174-L181 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/ConversationTable.java | ConversationTable.remove | public synchronized boolean remove(int id)
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "remove", ""+id);
final boolean result = contains(id);
if (result)
{
mutableKey.setValue(id);
idToConvTable.remove(mutableKey);
}
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "remove", ""+result);
return result;
} | java | public synchronized boolean remove(int id)
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "remove", ""+id);
final boolean result = contains(id);
if (result)
{
mutableKey.setValue(id);
idToConvTable.remove(mutableKey);
}
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "remove", ""+result);
return result;
} | [
"public",
"synchronized",
"boolean",
"remove",
"(",
"int",
"id",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"remove\"",
",",
"\"\"",
"+",
"id",
")",
";",
"final",
"boolean",
"result",
"=",
"contains",
"(",
"id",
")",
";",
"if",
"(",
"result",
")",
"{",
"mutableKey",
".",
"setValue",
"(",
"id",
")",
";",
"idToConvTable",
".",
"remove",
"(",
"mutableKey",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"remove\"",
",",
"\"\"",
"+",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Remove a conversation from the table by ID
@param id | [
"Remove",
"a",
"conversation",
"from",
"the",
"table",
"by",
"ID"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/ConversationTable.java#L187-L199 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/ConversationTable.java | ConversationTable.iterator | public synchronized Iterator iterator()
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "iterator");
Iterator returnValue = idToConvTable.values().iterator();
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "iterator", returnValue);
return returnValue;
} | java | public synchronized Iterator iterator()
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "iterator");
Iterator returnValue = idToConvTable.values().iterator();
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "iterator", returnValue);
return returnValue;
} | [
"public",
"synchronized",
"Iterator",
"iterator",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"iterator\"",
")",
";",
"Iterator",
"returnValue",
"=",
"idToConvTable",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"iterator\"",
",",
"returnValue",
")",
";",
"return",
"returnValue",
";",
"}"
] | Returns an iterator which iterates over the tables
contents. The values returned by this iterator are
objects of type Conversation.
@return Iterator | [
"Returns",
"an",
"iterator",
"which",
"iterates",
"over",
"the",
"tables",
"contents",
".",
"The",
"values",
"returned",
"by",
"this",
"iterator",
"are",
"objects",
"of",
"type",
"Conversation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/ConversationTable.java#L207-L213 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxXATerminator.java | TxXATerminator.instance | public static TxXATerminator instance(String providerId)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "instance", providerId);
final TxXATerminator xat;
synchronized(_txXATerminators)
{
if(_txXATerminators.containsKey(providerId))
{
xat = (TxXATerminator)_txXATerminators.get(providerId);
}
else
{
xat = new TxXATerminator(providerId);
_txXATerminators.put(providerId, xat);
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "instance", xat);
return xat;
} | java | public static TxXATerminator instance(String providerId)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "instance", providerId);
final TxXATerminator xat;
synchronized(_txXATerminators)
{
if(_txXATerminators.containsKey(providerId))
{
xat = (TxXATerminator)_txXATerminators.get(providerId);
}
else
{
xat = new TxXATerminator(providerId);
_txXATerminators.put(providerId, xat);
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "instance", xat);
return xat;
} | [
"public",
"static",
"TxXATerminator",
"instance",
"(",
"String",
"providerId",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"instance\"",
",",
"providerId",
")",
";",
"final",
"TxXATerminator",
"xat",
";",
"synchronized",
"(",
"_txXATerminators",
")",
"{",
"if",
"(",
"_txXATerminators",
".",
"containsKey",
"(",
"providerId",
")",
")",
"{",
"xat",
"=",
"(",
"TxXATerminator",
")",
"_txXATerminators",
".",
"get",
"(",
"providerId",
")",
";",
"}",
"else",
"{",
"xat",
"=",
"new",
"TxXATerminator",
"(",
"providerId",
")",
";",
"_txXATerminators",
".",
"put",
"(",
"providerId",
",",
"xat",
")",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"instance\"",
",",
"xat",
")",
";",
"return",
"xat",
";",
"}"
] | Return the TxXATerminator instance specific to the given providerId
@param providerId
@return | [
"Return",
"the",
"TxXATerminator",
"instance",
"specific",
"to",
"the",
"given",
"providerId"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxXATerminator.java#L63-L84 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxXATerminator.java | TxXATerminator.getTxWrapper | protected JCATranWrapper getTxWrapper(Xid xid, boolean addAssociation) throws XAException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getTxWrapper", xid);
final JCATranWrapper txWrapper = TxExecutionContextHandler.getTxWrapper(xid, addAssociation);
if(txWrapper.getTransaction() == null)
{
// there was no Transaction for this XID
if(tc.isEntryEnabled()) Tr.exit(tc, "getTxWrapper", "no transaction was found for the specified XID");
throw new XAException(XAException.XAER_NOTA);
}
if(tc.isEntryEnabled()) Tr.exit(tc, "getTxWrapper", txWrapper);
return txWrapper;
} | java | protected JCATranWrapper getTxWrapper(Xid xid, boolean addAssociation) throws XAException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getTxWrapper", xid);
final JCATranWrapper txWrapper = TxExecutionContextHandler.getTxWrapper(xid, addAssociation);
if(txWrapper.getTransaction() == null)
{
// there was no Transaction for this XID
if(tc.isEntryEnabled()) Tr.exit(tc, "getTxWrapper", "no transaction was found for the specified XID");
throw new XAException(XAException.XAER_NOTA);
}
if(tc.isEntryEnabled()) Tr.exit(tc, "getTxWrapper", txWrapper);
return txWrapper;
} | [
"protected",
"JCATranWrapper",
"getTxWrapper",
"(",
"Xid",
"xid",
",",
"boolean",
"addAssociation",
")",
"throws",
"XAException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getTxWrapper\"",
",",
"xid",
")",
";",
"final",
"JCATranWrapper",
"txWrapper",
"=",
"TxExecutionContextHandler",
".",
"getTxWrapper",
"(",
"xid",
",",
"addAssociation",
")",
";",
"if",
"(",
"txWrapper",
".",
"getTransaction",
"(",
")",
"==",
"null",
")",
"{",
"// there was no Transaction for this XID",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getTxWrapper\"",
",",
"\"no transaction was found for the specified XID\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_NOTA",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getTxWrapper\"",
",",
"txWrapper",
")",
";",
"return",
"txWrapper",
";",
"}"
] | Gets the Transaction from the TxExecutionContextHandler that imported it
@param xid
@param addAssociation
@return
@throws XAException (XAER_NOTA) - thrown if the specified XID is invalid | [
"Gets",
"the",
"Transaction",
"from",
"the",
"TxExecutionContextHandler",
"that",
"imported",
"it"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxXATerminator.java#L260-L275 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/visitor/validator/FVVisitor.java | FVVisitor.getMethod | private String getMethod(ELNode.Function func) throws JspTranslationException {
FunctionInfo funcInfo = func.getFunctionInfo();
String signature = funcInfo.getFunctionSignature();
int start = signature.indexOf(' ');
if (start < 0) {
throw new JspTranslationException("jsp.error.tld.fn.invalid.signature " + func.getPrefix()+" "+ func.getName());
}
int end = signature.indexOf('(');
if (end < 0) {
throw new JspTranslationException("jsp.error.tld.fn.invalid.signature.parenexpected " + func.getPrefix()+" "+ func.getName());
}
return signature.substring(start + 1, end).trim();
} | java | private String getMethod(ELNode.Function func) throws JspTranslationException {
FunctionInfo funcInfo = func.getFunctionInfo();
String signature = funcInfo.getFunctionSignature();
int start = signature.indexOf(' ');
if (start < 0) {
throw new JspTranslationException("jsp.error.tld.fn.invalid.signature " + func.getPrefix()+" "+ func.getName());
}
int end = signature.indexOf('(');
if (end < 0) {
throw new JspTranslationException("jsp.error.tld.fn.invalid.signature.parenexpected " + func.getPrefix()+" "+ func.getName());
}
return signature.substring(start + 1, end).trim();
} | [
"private",
"String",
"getMethod",
"(",
"ELNode",
".",
"Function",
"func",
")",
"throws",
"JspTranslationException",
"{",
"FunctionInfo",
"funcInfo",
"=",
"func",
".",
"getFunctionInfo",
"(",
")",
";",
"String",
"signature",
"=",
"funcInfo",
".",
"getFunctionSignature",
"(",
")",
";",
"int",
"start",
"=",
"signature",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"start",
"<",
"0",
")",
"{",
"throw",
"new",
"JspTranslationException",
"(",
"\"jsp.error.tld.fn.invalid.signature \"",
"+",
"func",
".",
"getPrefix",
"(",
")",
"+",
"\" \"",
"+",
"func",
".",
"getName",
"(",
")",
")",
";",
"}",
"int",
"end",
"=",
"signature",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"end",
"<",
"0",
")",
"{",
"throw",
"new",
"JspTranslationException",
"(",
"\"jsp.error.tld.fn.invalid.signature.parenexpected \"",
"+",
"func",
".",
"getPrefix",
"(",
")",
"+",
"\" \"",
"+",
"func",
".",
"getName",
"(",
")",
")",
";",
"}",
"return",
"signature",
".",
"substring",
"(",
"start",
"+",
"1",
",",
"end",
")",
".",
"trim",
"(",
")",
";",
"}"
] | Get the method name from the signature. | [
"Get",
"the",
"method",
"name",
"from",
"the",
"signature",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/visitor/validator/FVVisitor.java#L89-L102 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/tsx/tag/DefinedIndexManager.java | DefinedIndexManager.exists | public boolean exists(String index) {
boolean exists = false;
if (indexNames.isEmpty() == false) {
for (i = 0; i < indexNames.size(); i++) {
if (index.equals((String) indexNames.elementAt(i))) {
exists = true;
break;
}
}
}
return exists;
} | java | public boolean exists(String index) {
boolean exists = false;
if (indexNames.isEmpty() == false) {
for (i = 0; i < indexNames.size(); i++) {
if (index.equals((String) indexNames.elementAt(i))) {
exists = true;
break;
}
}
}
return exists;
} | [
"public",
"boolean",
"exists",
"(",
"String",
"index",
")",
"{",
"boolean",
"exists",
"=",
"false",
";",
"if",
"(",
"indexNames",
".",
"isEmpty",
"(",
")",
"==",
"false",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"indexNames",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"index",
".",
"equals",
"(",
"(",
"String",
")",
"indexNames",
".",
"elementAt",
"(",
"i",
")",
")",
")",
"{",
"exists",
"=",
"true",
";",
"break",
";",
"}",
"}",
"}",
"return",
"exists",
";",
"}"
] | see if the passed in index exists in the vector | [
"see",
"if",
"the",
"passed",
"in",
"index",
"exists",
"in",
"the",
"vector"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/tsx/tag/DefinedIndexManager.java#L43-L56 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/webapp/AbstractFacesInitializer.java | AbstractFacesInitializer._createEagerBeans | private void _createEagerBeans(FacesContext facesContext)
{
ExternalContext externalContext = facesContext.getExternalContext();
RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(externalContext);
List<ManagedBean> eagerBeans = new ArrayList<ManagedBean>();
// check all registered managed-beans
for (ManagedBean bean : runtimeConfig.getManagedBeans().values())
{
String eager = bean.getEager();
if (eager != null && "true".equals(eager))
{
// eager beans are only allowed for application scope
if (ManagedBeanBuilder.APPLICATION.equals(bean.getManagedBeanScope()))
{
// add to eager beans
eagerBeans.add(bean);
}
else
{
// log warning and continue (the bean will be lazy loaded)
log.log(Level.WARNING, "The managed-bean with name "
+ bean.getManagedBeanName()
+ " must be application scoped to support eager=true.");
}
}
}
// check if there are any eager beans
if (!eagerBeans.isEmpty())
{
ManagedBeanBuilder managedBeanBuilder = new ManagedBeanBuilder();
Map<String, Object> applicationMap = externalContext.getApplicationMap();
for (ManagedBean bean : eagerBeans)
{
// check application scope for bean instance
if (applicationMap.containsKey(bean.getManagedBeanName()))
{
// do not build bean, because it already exists
// (e.g. @ManagedProperty from previous managed bean already created it)
continue;
}
// create instance
Object beanInstance = managedBeanBuilder.buildManagedBean(facesContext, bean);
// put in application scope
applicationMap.put(bean.getManagedBeanName(), beanInstance);
}
}
} | java | private void _createEagerBeans(FacesContext facesContext)
{
ExternalContext externalContext = facesContext.getExternalContext();
RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(externalContext);
List<ManagedBean> eagerBeans = new ArrayList<ManagedBean>();
// check all registered managed-beans
for (ManagedBean bean : runtimeConfig.getManagedBeans().values())
{
String eager = bean.getEager();
if (eager != null && "true".equals(eager))
{
// eager beans are only allowed for application scope
if (ManagedBeanBuilder.APPLICATION.equals(bean.getManagedBeanScope()))
{
// add to eager beans
eagerBeans.add(bean);
}
else
{
// log warning and continue (the bean will be lazy loaded)
log.log(Level.WARNING, "The managed-bean with name "
+ bean.getManagedBeanName()
+ " must be application scoped to support eager=true.");
}
}
}
// check if there are any eager beans
if (!eagerBeans.isEmpty())
{
ManagedBeanBuilder managedBeanBuilder = new ManagedBeanBuilder();
Map<String, Object> applicationMap = externalContext.getApplicationMap();
for (ManagedBean bean : eagerBeans)
{
// check application scope for bean instance
if (applicationMap.containsKey(bean.getManagedBeanName()))
{
// do not build bean, because it already exists
// (e.g. @ManagedProperty from previous managed bean already created it)
continue;
}
// create instance
Object beanInstance = managedBeanBuilder.buildManagedBean(facesContext, bean);
// put in application scope
applicationMap.put(bean.getManagedBeanName(), beanInstance);
}
}
} | [
"private",
"void",
"_createEagerBeans",
"(",
"FacesContext",
"facesContext",
")",
"{",
"ExternalContext",
"externalContext",
"=",
"facesContext",
".",
"getExternalContext",
"(",
")",
";",
"RuntimeConfig",
"runtimeConfig",
"=",
"RuntimeConfig",
".",
"getCurrentInstance",
"(",
"externalContext",
")",
";",
"List",
"<",
"ManagedBean",
">",
"eagerBeans",
"=",
"new",
"ArrayList",
"<",
"ManagedBean",
">",
"(",
")",
";",
"// check all registered managed-beans",
"for",
"(",
"ManagedBean",
"bean",
":",
"runtimeConfig",
".",
"getManagedBeans",
"(",
")",
".",
"values",
"(",
")",
")",
"{",
"String",
"eager",
"=",
"bean",
".",
"getEager",
"(",
")",
";",
"if",
"(",
"eager",
"!=",
"null",
"&&",
"\"true\"",
".",
"equals",
"(",
"eager",
")",
")",
"{",
"// eager beans are only allowed for application scope",
"if",
"(",
"ManagedBeanBuilder",
".",
"APPLICATION",
".",
"equals",
"(",
"bean",
".",
"getManagedBeanScope",
"(",
")",
")",
")",
"{",
"// add to eager beans",
"eagerBeans",
".",
"add",
"(",
"bean",
")",
";",
"}",
"else",
"{",
"// log warning and continue (the bean will be lazy loaded)",
"log",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"The managed-bean with name \"",
"+",
"bean",
".",
"getManagedBeanName",
"(",
")",
"+",
"\" must be application scoped to support eager=true.\"",
")",
";",
"}",
"}",
"}",
"// check if there are any eager beans",
"if",
"(",
"!",
"eagerBeans",
".",
"isEmpty",
"(",
")",
")",
"{",
"ManagedBeanBuilder",
"managedBeanBuilder",
"=",
"new",
"ManagedBeanBuilder",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"applicationMap",
"=",
"externalContext",
".",
"getApplicationMap",
"(",
")",
";",
"for",
"(",
"ManagedBean",
"bean",
":",
"eagerBeans",
")",
"{",
"// check application scope for bean instance",
"if",
"(",
"applicationMap",
".",
"containsKey",
"(",
"bean",
".",
"getManagedBeanName",
"(",
")",
")",
")",
"{",
"// do not build bean, because it already exists",
"// (e.g. @ManagedProperty from previous managed bean already created it)",
"continue",
";",
"}",
"// create instance",
"Object",
"beanInstance",
"=",
"managedBeanBuilder",
".",
"buildManagedBean",
"(",
"facesContext",
",",
"bean",
")",
";",
"// put in application scope",
"applicationMap",
".",
"put",
"(",
"bean",
".",
"getManagedBeanName",
"(",
")",
",",
"beanInstance",
")",
";",
"}",
"}",
"}"
] | Checks for application scoped managed-beans with eager=true,
creates them and stores them in the application map.
@param facesContext | [
"Checks",
"for",
"application",
"scoped",
"managed",
"-",
"beans",
"with",
"eager",
"=",
"true",
"creates",
"them",
"and",
"stores",
"them",
"in",
"the",
"application",
"map",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/webapp/AbstractFacesInitializer.java#L272-L323 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/webapp/AbstractFacesInitializer.java | AbstractFacesInitializer.loadExpressionFactory | protected static ExpressionFactory loadExpressionFactory(String expressionFactoryClassName)
{
try
{
Class<?> expressionFactoryClass = Class.forName(expressionFactoryClassName);
return (ExpressionFactory) expressionFactoryClass.newInstance();
}
catch (Exception ex)
{
if (log.isLoggable(Level.FINE))
{
log.log(Level.FINE, "An error occured while instantiating a new ExpressionFactory. "
+ "Attempted to load class '" + expressionFactoryClassName + "'.", ex);
}
}
return null;
} | java | protected static ExpressionFactory loadExpressionFactory(String expressionFactoryClassName)
{
try
{
Class<?> expressionFactoryClass = Class.forName(expressionFactoryClassName);
return (ExpressionFactory) expressionFactoryClass.newInstance();
}
catch (Exception ex)
{
if (log.isLoggable(Level.FINE))
{
log.log(Level.FINE, "An error occured while instantiating a new ExpressionFactory. "
+ "Attempted to load class '" + expressionFactoryClassName + "'.", ex);
}
}
return null;
} | [
"protected",
"static",
"ExpressionFactory",
"loadExpressionFactory",
"(",
"String",
"expressionFactoryClassName",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"expressionFactoryClass",
"=",
"Class",
".",
"forName",
"(",
"expressionFactoryClassName",
")",
";",
"return",
"(",
"ExpressionFactory",
")",
"expressionFactoryClass",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"log",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"An error occured while instantiating a new ExpressionFactory. \"",
"+",
"\"Attempted to load class '\"",
"+",
"expressionFactoryClassName",
"+",
"\"'.\"",
",",
"ex",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Loads and instantiates the given ExpressionFactory implementation.
@param expressionFactoryClassName the class name of the ExpressionFactory implementation
@return the newly created ExpressionFactory implementation, or
<code>null</code>, if an error occurred | [
"Loads",
"and",
"instantiates",
"the",
"given",
"ExpressionFactory",
"implementation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/webapp/AbstractFacesInitializer.java#L493-L510 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/webapp/AbstractFacesInitializer.java | AbstractFacesInitializer.initCDIIntegration | protected void initCDIIntegration(
ServletContext servletContext, ExternalContext externalContext)
{
// Lookup bean manager and put it into an application scope attribute to
// access it later. Remember the trick here is do not call any CDI api
// directly, so if no CDI api is on the classpath no exception will be thrown.
// Try with servlet context
Object beanManager = servletContext.getAttribute(
CDI_SERVLET_CONTEXT_BEAN_MANAGER_ATTRIBUTE);
if (beanManager == null)
{
// Use reflection to avoid restricted API in GAE
Class icclazz = null;
Method lookupMethod = null;
try
{
icclazz = ClassUtils.simpleClassForName("javax.naming.InitialContext");
if (icclazz != null)
{
lookupMethod = icclazz.getMethod("doLookup", String.class);
}
}
catch (Throwable t)
{
//
}
if (lookupMethod != null)
{
// Try with JNDI
try
{
// in an application server
//beanManager = InitialContext.doLookup("java:comp/BeanManager");
beanManager = lookupMethod.invoke(icclazz, "java:comp/BeanManager");
}
catch (Exception e)
{
// silently ignore
}
catch (NoClassDefFoundError e)
{
//On Google App Engine, javax.naming.Context is a restricted class.
//In that case, NoClassDefFoundError is thrown. stageName needs to be configured
//below by context parameter.
}
if (beanManager == null)
{
try
{
// in a servlet container
//beanManager = InitialContext.doLookup("java:comp/env/BeanManager");
beanManager = lookupMethod.invoke(icclazz, "java:comp/env/BeanManager");
}
catch (Exception e)
{
// silently ignore
}
catch (NoClassDefFoundError e)
{
//On Google App Engine, javax.naming.Context is a restricted class.
//In that case, NoClassDefFoundError is thrown. stageName needs to be configured
//below by context parameter.
}
}
}
}
if (beanManager != null)
{
externalContext.getApplicationMap().put(CDI_BEAN_MANAGER_INSTANCE,
beanManager);
}
} | java | protected void initCDIIntegration(
ServletContext servletContext, ExternalContext externalContext)
{
// Lookup bean manager and put it into an application scope attribute to
// access it later. Remember the trick here is do not call any CDI api
// directly, so if no CDI api is on the classpath no exception will be thrown.
// Try with servlet context
Object beanManager = servletContext.getAttribute(
CDI_SERVLET_CONTEXT_BEAN_MANAGER_ATTRIBUTE);
if (beanManager == null)
{
// Use reflection to avoid restricted API in GAE
Class icclazz = null;
Method lookupMethod = null;
try
{
icclazz = ClassUtils.simpleClassForName("javax.naming.InitialContext");
if (icclazz != null)
{
lookupMethod = icclazz.getMethod("doLookup", String.class);
}
}
catch (Throwable t)
{
//
}
if (lookupMethod != null)
{
// Try with JNDI
try
{
// in an application server
//beanManager = InitialContext.doLookup("java:comp/BeanManager");
beanManager = lookupMethod.invoke(icclazz, "java:comp/BeanManager");
}
catch (Exception e)
{
// silently ignore
}
catch (NoClassDefFoundError e)
{
//On Google App Engine, javax.naming.Context is a restricted class.
//In that case, NoClassDefFoundError is thrown. stageName needs to be configured
//below by context parameter.
}
if (beanManager == null)
{
try
{
// in a servlet container
//beanManager = InitialContext.doLookup("java:comp/env/BeanManager");
beanManager = lookupMethod.invoke(icclazz, "java:comp/env/BeanManager");
}
catch (Exception e)
{
// silently ignore
}
catch (NoClassDefFoundError e)
{
//On Google App Engine, javax.naming.Context is a restricted class.
//In that case, NoClassDefFoundError is thrown. stageName needs to be configured
//below by context parameter.
}
}
}
}
if (beanManager != null)
{
externalContext.getApplicationMap().put(CDI_BEAN_MANAGER_INSTANCE,
beanManager);
}
} | [
"protected",
"void",
"initCDIIntegration",
"(",
"ServletContext",
"servletContext",
",",
"ExternalContext",
"externalContext",
")",
"{",
"// Lookup bean manager and put it into an application scope attribute to ",
"// access it later. Remember the trick here is do not call any CDI api ",
"// directly, so if no CDI api is on the classpath no exception will be thrown.",
"// Try with servlet context",
"Object",
"beanManager",
"=",
"servletContext",
".",
"getAttribute",
"(",
"CDI_SERVLET_CONTEXT_BEAN_MANAGER_ATTRIBUTE",
")",
";",
"if",
"(",
"beanManager",
"==",
"null",
")",
"{",
"// Use reflection to avoid restricted API in GAE",
"Class",
"icclazz",
"=",
"null",
";",
"Method",
"lookupMethod",
"=",
"null",
";",
"try",
"{",
"icclazz",
"=",
"ClassUtils",
".",
"simpleClassForName",
"(",
"\"javax.naming.InitialContext\"",
")",
";",
"if",
"(",
"icclazz",
"!=",
"null",
")",
"{",
"lookupMethod",
"=",
"icclazz",
".",
"getMethod",
"(",
"\"doLookup\"",
",",
"String",
".",
"class",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"//",
"}",
"if",
"(",
"lookupMethod",
"!=",
"null",
")",
"{",
"// Try with JNDI",
"try",
"{",
"// in an application server",
"//beanManager = InitialContext.doLookup(\"java:comp/BeanManager\");",
"beanManager",
"=",
"lookupMethod",
".",
"invoke",
"(",
"icclazz",
",",
"\"java:comp/BeanManager\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// silently ignore",
"}",
"catch",
"(",
"NoClassDefFoundError",
"e",
")",
"{",
"//On Google App Engine, javax.naming.Context is a restricted class.",
"//In that case, NoClassDefFoundError is thrown. stageName needs to be configured",
"//below by context parameter.",
"}",
"if",
"(",
"beanManager",
"==",
"null",
")",
"{",
"try",
"{",
"// in a servlet container",
"//beanManager = InitialContext.doLookup(\"java:comp/env/BeanManager\");",
"beanManager",
"=",
"lookupMethod",
".",
"invoke",
"(",
"icclazz",
",",
"\"java:comp/env/BeanManager\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// silently ignore",
"}",
"catch",
"(",
"NoClassDefFoundError",
"e",
")",
"{",
"//On Google App Engine, javax.naming.Context is a restricted class.",
"//In that case, NoClassDefFoundError is thrown. stageName needs to be configured",
"//below by context parameter.",
"}",
"}",
"}",
"}",
"if",
"(",
"beanManager",
"!=",
"null",
")",
"{",
"externalContext",
".",
"getApplicationMap",
"(",
")",
".",
"put",
"(",
"CDI_BEAN_MANAGER_INSTANCE",
",",
"beanManager",
")",
";",
"}",
"}"
] | The intention of this method is provide a point where CDI integration is done.
Faces Flow and javax.faces.view.ViewScope requires CDI in order to work, so
this method should set a BeanManager instance on application map under
the key "oam.cdi.BEAN_MANAGER_INSTANCE". The default implementation look on
ServletContext first and then use JNDI.
@param servletContext
@param externalContext | [
"The",
"intention",
"of",
"this",
"method",
"is",
"provide",
"a",
"point",
"where",
"CDI",
"integration",
"is",
"done",
".",
"Faces",
"Flow",
"and",
"javax",
".",
"faces",
".",
"view",
".",
"ViewScope",
"requires",
"CDI",
"in",
"order",
"to",
"work",
"so",
"this",
"method",
"should",
"set",
"a",
"BeanManager",
"instance",
"on",
"application",
"map",
"under",
"the",
"key",
"oam",
".",
"cdi",
".",
"BEAN_MANAGER_INSTANCE",
".",
"The",
"default",
"implementation",
"look",
"on",
"ServletContext",
"first",
"and",
"then",
"use",
"JNDI",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/webapp/AbstractFacesInitializer.java#L579-L652 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ThreadGroupTracker.java | ThreadGroupTracker.getThreadGroup | ThreadGroup getThreadGroup(String identifier, String threadFactoryName, ThreadGroup parentGroup) {
ConcurrentHashMap<String, ThreadGroup> threadFactoryToThreadGroup = metadataIdentifierToThreadGroups.get(identifier);
if (threadFactoryToThreadGroup == null)
if (metadataIdentifierService.isMetaDataAvailable(identifier)) {
threadFactoryToThreadGroup = new ConcurrentHashMap<String, ThreadGroup>();
ConcurrentHashMap<String, ThreadGroup> added = metadataIdentifierToThreadGroups.putIfAbsent(identifier, threadFactoryToThreadGroup);
if (added != null)
threadFactoryToThreadGroup = added;
} else
throw new IllegalStateException(identifier.toString());
ThreadGroup group = threadFactoryToThreadGroup.get(threadFactoryName);
if (group == null)
group = AccessController.doPrivileged(new CreateThreadGroupIfAbsentAction(parentGroup, threadFactoryName, identifier, threadFactoryToThreadGroup),
serverAccessControlContext);
return group;
} | java | ThreadGroup getThreadGroup(String identifier, String threadFactoryName, ThreadGroup parentGroup) {
ConcurrentHashMap<String, ThreadGroup> threadFactoryToThreadGroup = metadataIdentifierToThreadGroups.get(identifier);
if (threadFactoryToThreadGroup == null)
if (metadataIdentifierService.isMetaDataAvailable(identifier)) {
threadFactoryToThreadGroup = new ConcurrentHashMap<String, ThreadGroup>();
ConcurrentHashMap<String, ThreadGroup> added = metadataIdentifierToThreadGroups.putIfAbsent(identifier, threadFactoryToThreadGroup);
if (added != null)
threadFactoryToThreadGroup = added;
} else
throw new IllegalStateException(identifier.toString());
ThreadGroup group = threadFactoryToThreadGroup.get(threadFactoryName);
if (group == null)
group = AccessController.doPrivileged(new CreateThreadGroupIfAbsentAction(parentGroup, threadFactoryName, identifier, threadFactoryToThreadGroup),
serverAccessControlContext);
return group;
} | [
"ThreadGroup",
"getThreadGroup",
"(",
"String",
"identifier",
",",
"String",
"threadFactoryName",
",",
"ThreadGroup",
"parentGroup",
")",
"{",
"ConcurrentHashMap",
"<",
"String",
",",
"ThreadGroup",
">",
"threadFactoryToThreadGroup",
"=",
"metadataIdentifierToThreadGroups",
".",
"get",
"(",
"identifier",
")",
";",
"if",
"(",
"threadFactoryToThreadGroup",
"==",
"null",
")",
"if",
"(",
"metadataIdentifierService",
".",
"isMetaDataAvailable",
"(",
"identifier",
")",
")",
"{",
"threadFactoryToThreadGroup",
"=",
"new",
"ConcurrentHashMap",
"<",
"String",
",",
"ThreadGroup",
">",
"(",
")",
";",
"ConcurrentHashMap",
"<",
"String",
",",
"ThreadGroup",
">",
"added",
"=",
"metadataIdentifierToThreadGroups",
".",
"putIfAbsent",
"(",
"identifier",
",",
"threadFactoryToThreadGroup",
")",
";",
"if",
"(",
"added",
"!=",
"null",
")",
"threadFactoryToThreadGroup",
"=",
"added",
";",
"}",
"else",
"throw",
"new",
"IllegalStateException",
"(",
"identifier",
".",
"toString",
"(",
")",
")",
";",
"ThreadGroup",
"group",
"=",
"threadFactoryToThreadGroup",
".",
"get",
"(",
"threadFactoryName",
")",
";",
"if",
"(",
"group",
"==",
"null",
")",
"group",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"CreateThreadGroupIfAbsentAction",
"(",
"parentGroup",
",",
"threadFactoryName",
",",
"identifier",
",",
"threadFactoryToThreadGroup",
")",
",",
"serverAccessControlContext",
")",
";",
"return",
"group",
";",
"}"
] | Returns the thread group to use for the specified application component.
@param jeeName name of the application component
@param threadFactoryName unique identifier for the thread factory
@param parentGroup parent thread group
@return child thread group for the application component. Null if the application component isn't active.
@throws IllegalStateException if the application component is not available. | [
"Returns",
"the",
"thread",
"group",
"to",
"use",
"for",
"the",
"specified",
"application",
"component",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ThreadGroupTracker.java#L107-L123 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ThreadGroupTracker.java | ThreadGroupTracker.threadFactoryDestroyed | void threadFactoryDestroyed(String threadFactoryName, ThreadGroup parentGroup) {
Collection<ThreadGroup> groupsToDestroy = new LinkedList<ThreadGroup>();
for (ConcurrentHashMap<String, ThreadGroup> threadFactoryToThreadGroup : metadataIdentifierToThreadGroups.values()) {
ThreadGroup group = threadFactoryToThreadGroup.remove(threadFactoryName);
if (group != null)
groupsToDestroy.add(group);
}
groupsToDestroy.add(parentGroup);
AccessController.doPrivileged(new InterruptAndDestroyThreadGroups(groupsToDestroy, deferrableScheduledExecutor), serverAccessControlContext);
} | java | void threadFactoryDestroyed(String threadFactoryName, ThreadGroup parentGroup) {
Collection<ThreadGroup> groupsToDestroy = new LinkedList<ThreadGroup>();
for (ConcurrentHashMap<String, ThreadGroup> threadFactoryToThreadGroup : metadataIdentifierToThreadGroups.values()) {
ThreadGroup group = threadFactoryToThreadGroup.remove(threadFactoryName);
if (group != null)
groupsToDestroy.add(group);
}
groupsToDestroy.add(parentGroup);
AccessController.doPrivileged(new InterruptAndDestroyThreadGroups(groupsToDestroy, deferrableScheduledExecutor), serverAccessControlContext);
} | [
"void",
"threadFactoryDestroyed",
"(",
"String",
"threadFactoryName",
",",
"ThreadGroup",
"parentGroup",
")",
"{",
"Collection",
"<",
"ThreadGroup",
">",
"groupsToDestroy",
"=",
"new",
"LinkedList",
"<",
"ThreadGroup",
">",
"(",
")",
";",
"for",
"(",
"ConcurrentHashMap",
"<",
"String",
",",
"ThreadGroup",
">",
"threadFactoryToThreadGroup",
":",
"metadataIdentifierToThreadGroups",
".",
"values",
"(",
")",
")",
"{",
"ThreadGroup",
"group",
"=",
"threadFactoryToThreadGroup",
".",
"remove",
"(",
"threadFactoryName",
")",
";",
"if",
"(",
"group",
"!=",
"null",
")",
"groupsToDestroy",
".",
"add",
"(",
"group",
")",
";",
"}",
"groupsToDestroy",
".",
"add",
"(",
"parentGroup",
")",
";",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"InterruptAndDestroyThreadGroups",
"(",
"groupsToDestroy",
",",
"deferrableScheduledExecutor",
")",
",",
"serverAccessControlContext",
")",
";",
"}"
] | Invoke this method when destroying a ManagedThreadFactory in order to interrupt all managed threads
that it created.
@param threadFactoryName unique identifier for the managed thread factory. | [
"Invoke",
"this",
"method",
"when",
"destroying",
"a",
"ManagedThreadFactory",
"in",
"order",
"to",
"interrupt",
"all",
"managed",
"threads",
"that",
"it",
"created",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ThreadGroupTracker.java#L149-L158 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LinkHandler.java | LinkHandler.createRealizationAndState | protected void createRealizationAndState(
MessageProcessor messageProcessor,
TransactionCommon transaction)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"createRealizationAndState",
new Object[] {
messageProcessor,
transaction });
/*
* Create associated state handler of appropriate type
*/
_ptoPRealization = new LinkState(this,
messageProcessor,
getLocalisationManager());
_protoRealization = _ptoPRealization;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createRealizationAndState");
} | java | protected void createRealizationAndState(
MessageProcessor messageProcessor,
TransactionCommon transaction)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"createRealizationAndState",
new Object[] {
messageProcessor,
transaction });
/*
* Create associated state handler of appropriate type
*/
_ptoPRealization = new LinkState(this,
messageProcessor,
getLocalisationManager());
_protoRealization = _ptoPRealization;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createRealizationAndState");
} | [
"protected",
"void",
"createRealizationAndState",
"(",
"MessageProcessor",
"messageProcessor",
",",
"TransactionCommon",
"transaction",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createRealizationAndState\"",
",",
"new",
"Object",
"[",
"]",
"{",
"messageProcessor",
",",
"transaction",
"}",
")",
";",
"/*\n * Create associated state handler of appropriate type\n */",
"_ptoPRealization",
"=",
"new",
"LinkState",
"(",
"this",
",",
"messageProcessor",
",",
"getLocalisationManager",
"(",
")",
")",
";",
"_protoRealization",
"=",
"_ptoPRealization",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createRealizationAndState\"",
")",
";",
"}"
] | Cold start version of State Handler creation.
@param messageProcessor
@throws SIResourceException | [
"Cold",
"start",
"version",
"of",
"State",
"Handler",
"creation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LinkHandler.java#L168-L192 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LinkHandler.java | LinkHandler.reconstitute | protected void reconstitute(
MessageProcessor processor,
HashMap durableSubscriptionsTable,
int startMode) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reconstitute", new Object[] { processor,
durableSubscriptionsTable, new Integer(startMode) });
getLocalisationManager().setMessageProcessor(processor);
super.reconstitute(processor, durableSubscriptionsTable, startMode);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute");
} | java | protected void reconstitute(
MessageProcessor processor,
HashMap durableSubscriptionsTable,
int startMode) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reconstitute", new Object[] { processor,
durableSubscriptionsTable, new Integer(startMode) });
getLocalisationManager().setMessageProcessor(processor);
super.reconstitute(processor, durableSubscriptionsTable, startMode);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute");
} | [
"protected",
"void",
"reconstitute",
"(",
"MessageProcessor",
"processor",
",",
"HashMap",
"durableSubscriptionsTable",
",",
"int",
"startMode",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"reconstitute\"",
",",
"new",
"Object",
"[",
"]",
"{",
"processor",
",",
"durableSubscriptionsTable",
",",
"new",
"Integer",
"(",
"startMode",
")",
"}",
")",
";",
"getLocalisationManager",
"(",
")",
".",
"setMessageProcessor",
"(",
"processor",
")",
";",
"super",
".",
"reconstitute",
"(",
"processor",
",",
"durableSubscriptionsTable",
",",
"startMode",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"reconstitute\"",
")",
";",
"}"
] | Overide the reconstitute method so we can set the
message processor instance as this will have been done by the
cursor.next method. | [
"Overide",
"the",
"reconstitute",
"method",
"so",
"we",
"can",
"set",
"the",
"message",
"processor",
"instance",
"as",
"this",
"will",
"have",
"been",
"done",
"by",
"the",
"cursor",
".",
"next",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LinkHandler.java#L901-L916 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/renderkit/html/HtmlRenderKitImpl.java | HtmlRenderKitImpl._put | synchronized private void _put(String componentFamily, String rendererType, Renderer renderer)
{
Map <String,Renderer> familyRendererMap = _renderers.get(componentFamily);
if (familyRendererMap == null)
{
familyRendererMap = new ConcurrentHashMap<String, Renderer>(8, 0.75f, 1);
_renderers.put(componentFamily, familyRendererMap);
}
else
{
if (familyRendererMap.get(rendererType) != null)
{
// this is not necessarily an error, but users do need to be
// very careful about jar processing order when overriding
// some component's renderer with an alternate renderer.
log.fine("Overwriting renderer with family = " + componentFamily +
" rendererType = " + rendererType +
" renderer class = " + renderer.getClass().getName());
}
}
familyRendererMap.put(rendererType, renderer);
} | java | synchronized private void _put(String componentFamily, String rendererType, Renderer renderer)
{
Map <String,Renderer> familyRendererMap = _renderers.get(componentFamily);
if (familyRendererMap == null)
{
familyRendererMap = new ConcurrentHashMap<String, Renderer>(8, 0.75f, 1);
_renderers.put(componentFamily, familyRendererMap);
}
else
{
if (familyRendererMap.get(rendererType) != null)
{
// this is not necessarily an error, but users do need to be
// very careful about jar processing order when overriding
// some component's renderer with an alternate renderer.
log.fine("Overwriting renderer with family = " + componentFamily +
" rendererType = " + rendererType +
" renderer class = " + renderer.getClass().getName());
}
}
familyRendererMap.put(rendererType, renderer);
} | [
"synchronized",
"private",
"void",
"_put",
"(",
"String",
"componentFamily",
",",
"String",
"rendererType",
",",
"Renderer",
"renderer",
")",
"{",
"Map",
"<",
"String",
",",
"Renderer",
">",
"familyRendererMap",
"=",
"_renderers",
".",
"get",
"(",
"componentFamily",
")",
";",
"if",
"(",
"familyRendererMap",
"==",
"null",
")",
"{",
"familyRendererMap",
"=",
"new",
"ConcurrentHashMap",
"<",
"String",
",",
"Renderer",
">",
"(",
"8",
",",
"0.75f",
",",
"1",
")",
";",
"_renderers",
".",
"put",
"(",
"componentFamily",
",",
"familyRendererMap",
")",
";",
"}",
"else",
"{",
"if",
"(",
"familyRendererMap",
".",
"get",
"(",
"rendererType",
")",
"!=",
"null",
")",
"{",
"// this is not necessarily an error, but users do need to be",
"// very careful about jar processing order when overriding",
"// some component's renderer with an alternate renderer.",
"log",
".",
"fine",
"(",
"\"Overwriting renderer with family = \"",
"+",
"componentFamily",
"+",
"\" rendererType = \"",
"+",
"rendererType",
"+",
"\" renderer class = \"",
"+",
"renderer",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"familyRendererMap",
".",
"put",
"(",
"rendererType",
",",
"renderer",
")",
";",
"}"
] | Put the renderer on the double map
@param componentFamily
@param rendererType
@param renderer | [
"Put",
"the",
"renderer",
"on",
"the",
"double",
"map"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/renderkit/html/HtmlRenderKitImpl.java#L202-L223 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/NonSyncHashtable.java | NonSyncHashtable.get | public Object get(Object key) {
NonSyncHashtableEntry tab[] = table;
int hash = key.hashCode();
int index = (hash & 0x7FFFFFFF) % tab.length;
for (NonSyncHashtableEntry e = tab[index]; e != null; e = e.next) {
if ((e.hash == hash) && e.key.equals(key)) {
return e.value;
}
}
return null;
} | java | public Object get(Object key) {
NonSyncHashtableEntry tab[] = table;
int hash = key.hashCode();
int index = (hash & 0x7FFFFFFF) % tab.length;
for (NonSyncHashtableEntry e = tab[index]; e != null; e = e.next) {
if ((e.hash == hash) && e.key.equals(key)) {
return e.value;
}
}
return null;
} | [
"public",
"Object",
"get",
"(",
"Object",
"key",
")",
"{",
"NonSyncHashtableEntry",
"tab",
"[",
"]",
"=",
"table",
";",
"int",
"hash",
"=",
"key",
".",
"hashCode",
"(",
")",
";",
"int",
"index",
"=",
"(",
"hash",
"&",
"0x7FFFFFFF",
")",
"%",
"tab",
".",
"length",
";",
"for",
"(",
"NonSyncHashtableEntry",
"e",
"=",
"tab",
"[",
"index",
"]",
";",
"e",
"!=",
"null",
";",
"e",
"=",
"e",
".",
"next",
")",
"{",
"if",
"(",
"(",
"e",
".",
"hash",
"==",
"hash",
")",
"&&",
"e",
".",
"key",
".",
"equals",
"(",
"key",
")",
")",
"{",
"return",
"e",
".",
"value",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Returns the value to which the specified key is mapped in this hashtable.
@param key a key in the hashtable.
@return The value to which the key is mapped in this hashtable;
<code>null</code> if the key is not mapped to any value in
this hashtable. | [
"Returns",
"the",
"value",
"to",
"which",
"the",
"specified",
"key",
"is",
"mapped",
"in",
"this",
"hashtable",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/NonSyncHashtable.java#L156-L166 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/el/ELText.java | ELText.write | public void write(Writer out, ELContext ctx) throws ELException, IOException
{
out.write(this.literal);
} | java | public void write(Writer out, ELContext ctx) throws ELException, IOException
{
out.write(this.literal);
} | [
"public",
"void",
"write",
"(",
"Writer",
"out",
",",
"ELContext",
"ctx",
")",
"throws",
"ELException",
",",
"IOException",
"{",
"out",
".",
"write",
"(",
"this",
".",
"literal",
")",
";",
"}"
] | Allow this instance to write to the passed Writer, given the ELContext state
@param out
Writer to write to
@param ctx
current ELContext state
@throws ELException
@throws IOException | [
"Allow",
"this",
"instance",
"to",
"write",
"to",
"the",
"passed",
"Writer",
"given",
"the",
"ELContext",
"state"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/el/ELText.java#L409-L412 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CacheingSearchResults.java | CacheingSearchResults.provideCacheable | public Object provideCacheable(Object key)
{
if (tc.isDebugEnabled())
tc.debug(this,cclass, "provideCacheable", key);
return null;
} | java | public Object provideCacheable(Object key)
{
if (tc.isDebugEnabled())
tc.debug(this,cclass, "provideCacheable", key);
return null;
} | [
"public",
"Object",
"provideCacheable",
"(",
"Object",
"key",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"tc",
".",
"debug",
"(",
"this",
",",
"cclass",
",",
"\"provideCacheable\"",
",",
"key",
")",
";",
"return",
"null",
";",
"}"
] | Cache methods do nothing for this type | [
"Cache",
"methods",
"do",
"nothing",
"for",
"this",
"type"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CacheingSearchResults.java#L67-L72 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CacheingSearchResults.java | CacheingSearchResults.setMatcher | void setMatcher(ContentMatcher m)
{
if (tc.isEntryEnabled())
tc.entry(
this,cclass,
"setMatcher",
"matcher: " + m + ", hasContent: " + new Boolean(hasContent));
wildMatchers.add(m);
this.hasContent |= m.hasTests();
if (tc.isEntryEnabled())
tc.exit(this,cclass, "setMatcher");
} | java | void setMatcher(ContentMatcher m)
{
if (tc.isEntryEnabled())
tc.entry(
this,cclass,
"setMatcher",
"matcher: " + m + ", hasContent: " + new Boolean(hasContent));
wildMatchers.add(m);
this.hasContent |= m.hasTests();
if (tc.isEntryEnabled())
tc.exit(this,cclass, "setMatcher");
} | [
"void",
"setMatcher",
"(",
"ContentMatcher",
"m",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"setMatcher\"",
",",
"\"matcher: \"",
"+",
"m",
"+",
"\", hasContent: \"",
"+",
"new",
"Boolean",
"(",
"hasContent",
")",
")",
";",
"wildMatchers",
".",
"add",
"(",
"m",
")",
";",
"this",
".",
"hasContent",
"|=",
"m",
".",
"hasTests",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"setMatcher\"",
")",
";",
"}"
] | Caches a matcher | [
"Caches",
"a",
"matcher"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CacheingSearchResults.java#L82-L96 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CacheingSearchResults.java | CacheingSearchResults.getMatchers | ContentMatcher[] getMatchers()
{
if (tc.isEntryEnabled())
tc.entry(this,cclass, "getMatchers");
// ans removed as it is never used !
// Matcher[] ans = new Matcher[wildMatchers.size()];
if (tc.isEntryEnabled())
tc.exit(this,cclass, "getMatchers");
return (ContentMatcher[]) wildMatchers.toArray(new ContentMatcher[0]);
} | java | ContentMatcher[] getMatchers()
{
if (tc.isEntryEnabled())
tc.entry(this,cclass, "getMatchers");
// ans removed as it is never used !
// Matcher[] ans = new Matcher[wildMatchers.size()];
if (tc.isEntryEnabled())
tc.exit(this,cclass, "getMatchers");
return (ContentMatcher[]) wildMatchers.toArray(new ContentMatcher[0]);
} | [
"ContentMatcher",
"[",
"]",
"getMatchers",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"getMatchers\"",
")",
";",
"// ans removed as it is never used !",
"// Matcher[] ans = new Matcher[wildMatchers.size()];",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"getMatchers\"",
")",
";",
"return",
"(",
"ContentMatcher",
"[",
"]",
")",
"wildMatchers",
".",
"toArray",
"(",
"new",
"ContentMatcher",
"[",
"0",
"]",
")",
";",
"}"
] | Returns the Matcher cache as an array | [
"Returns",
"the",
"Matcher",
"cache",
"as",
"an",
"array"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CacheingSearchResults.java#L107-L119 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/DummyFileObjectStore.java | DummyFileObjectStore.get | public ManagedObject get(Token token)
throws ObjectManagerException
{
final String methodName = "get";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) {
trace.entry(this,
cclass,
methodName,
token);
trace.exit(this,
cclass,
methodName);
} // if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()).
throw new InMemoryObjectNotAvailableException(this,
token);
} | java | public ManagedObject get(Token token)
throws ObjectManagerException
{
final String methodName = "get";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) {
trace.entry(this,
cclass,
methodName,
token);
trace.exit(this,
cclass,
methodName);
} // if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()).
throw new InMemoryObjectNotAvailableException(this,
token);
} | [
"public",
"ManagedObject",
"get",
"(",
"Token",
"token",
")",
"throws",
"ObjectManagerException",
"{",
"final",
"String",
"methodName",
"=",
"\"get\"",
";",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"trace",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"methodName",
",",
"token",
")",
";",
"trace",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"methodName",
")",
";",
"}",
"// if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()).",
"throw",
"new",
"InMemoryObjectNotAvailableException",
"(",
"this",
",",
"token",
")",
";",
"}"
] | Always throws InMemoryObjectNotAvailableException.
@throws InMemoryObjectNotAvailableException because all ManagedObjects are unavailable.
@see com.ibm.ws.objectManager.ObjectStore#get(com.ibm.ws.objectManager.Token) | [
"Always",
"throws",
"InMemoryObjectNotAvailableException",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/DummyFileObjectStore.java#L93-L108 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/logging/LogUtils.java | LogUtils.convertNCSAFormat | public static AccessLog.Format convertNCSAFormat(String name) {
if (null == name) {
return AccessLog.Format.COMMON;
}
AccessLog.Format format = AccessLog.Format.COMMON;
String test = name.trim().toLowerCase();
if ("combined".equals(test)) {
format = AccessLog.Format.COMBINED;
}
return format;
} | java | public static AccessLog.Format convertNCSAFormat(String name) {
if (null == name) {
return AccessLog.Format.COMMON;
}
AccessLog.Format format = AccessLog.Format.COMMON;
String test = name.trim().toLowerCase();
if ("combined".equals(test)) {
format = AccessLog.Format.COMBINED;
}
return format;
} | [
"public",
"static",
"AccessLog",
".",
"Format",
"convertNCSAFormat",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"null",
"==",
"name",
")",
"{",
"return",
"AccessLog",
".",
"Format",
".",
"COMMON",
";",
"}",
"AccessLog",
".",
"Format",
"format",
"=",
"AccessLog",
".",
"Format",
".",
"COMMON",
";",
"String",
"test",
"=",
"name",
".",
"trim",
"(",
")",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"\"combined\"",
".",
"equals",
"(",
"test",
")",
")",
"{",
"format",
"=",
"AccessLog",
".",
"Format",
".",
"COMBINED",
";",
"}",
"return",
"format",
";",
"}"
] | Convert the input string into the appropriate Format setting.
@param name
@return AccessLog.Format | [
"Convert",
"the",
"input",
"string",
"into",
"the",
"appropriate",
"Format",
"setting",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/logging/LogUtils.java#L33-L43 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/logging/LogUtils.java | LogUtils.convertDebugLevel | public static DebugLog.Level convertDebugLevel(String name) {
if (null == name) {
return DebugLog.Level.NONE;
}
// WAS panels have expanded names for some of these so we're doing
// a series of checks instead of the enum.valueOf() option
// default to the WARNING level
DebugLog.Level level = DebugLog.Level.WARN;
String test = name.trim().toLowerCase();
if ("none".equals(test)) {
level = DebugLog.Level.NONE;
} else if ("error".equals(test)) {
level = DebugLog.Level.ERROR;
} else if ("debug".equals(test)) {
level = DebugLog.Level.DEBUG;
} else if ("crit".equals(test) || "critical".equals(test)) {
level = DebugLog.Level.CRIT;
} else if ("info".equals(test) || "information".equals(test)) {
level = DebugLog.Level.INFO;
}
return level;
} | java | public static DebugLog.Level convertDebugLevel(String name) {
if (null == name) {
return DebugLog.Level.NONE;
}
// WAS panels have expanded names for some of these so we're doing
// a series of checks instead of the enum.valueOf() option
// default to the WARNING level
DebugLog.Level level = DebugLog.Level.WARN;
String test = name.trim().toLowerCase();
if ("none".equals(test)) {
level = DebugLog.Level.NONE;
} else if ("error".equals(test)) {
level = DebugLog.Level.ERROR;
} else if ("debug".equals(test)) {
level = DebugLog.Level.DEBUG;
} else if ("crit".equals(test) || "critical".equals(test)) {
level = DebugLog.Level.CRIT;
} else if ("info".equals(test) || "information".equals(test)) {
level = DebugLog.Level.INFO;
}
return level;
} | [
"public",
"static",
"DebugLog",
".",
"Level",
"convertDebugLevel",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"null",
"==",
"name",
")",
"{",
"return",
"DebugLog",
".",
"Level",
".",
"NONE",
";",
"}",
"// WAS panels have expanded names for some of these so we're doing",
"// a series of checks instead of the enum.valueOf() option",
"// default to the WARNING level",
"DebugLog",
".",
"Level",
"level",
"=",
"DebugLog",
".",
"Level",
".",
"WARN",
";",
"String",
"test",
"=",
"name",
".",
"trim",
"(",
")",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"\"none\"",
".",
"equals",
"(",
"test",
")",
")",
"{",
"level",
"=",
"DebugLog",
".",
"Level",
".",
"NONE",
";",
"}",
"else",
"if",
"(",
"\"error\"",
".",
"equals",
"(",
"test",
")",
")",
"{",
"level",
"=",
"DebugLog",
".",
"Level",
".",
"ERROR",
";",
"}",
"else",
"if",
"(",
"\"debug\"",
".",
"equals",
"(",
"test",
")",
")",
"{",
"level",
"=",
"DebugLog",
".",
"Level",
".",
"DEBUG",
";",
"}",
"else",
"if",
"(",
"\"crit\"",
".",
"equals",
"(",
"test",
")",
"||",
"\"critical\"",
".",
"equals",
"(",
"test",
")",
")",
"{",
"level",
"=",
"DebugLog",
".",
"Level",
".",
"CRIT",
";",
"}",
"else",
"if",
"(",
"\"info\"",
".",
"equals",
"(",
"test",
")",
"||",
"\"information\"",
".",
"equals",
"(",
"test",
")",
")",
"{",
"level",
"=",
"DebugLog",
".",
"Level",
".",
"INFO",
";",
"}",
"return",
"level",
";",
"}"
] | Convert the input string into the appropriate debug log level setting.
@param name
@return DebugLog.Level | [
"Convert",
"the",
"input",
"string",
"into",
"the",
"appropriate",
"debug",
"log",
"level",
"setting",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/logging/LogUtils.java#L51-L73 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JaxbUnmarshaller.java | JaxbUnmarshaller.findRootCause | private static Throwable findRootCause(Throwable t) {
Throwable root = t;
Throwable cause = root.getCause();
while (cause != null) {
root = cause;
cause = root.getCause();
}
return root;
} | java | private static Throwable findRootCause(Throwable t) {
Throwable root = t;
Throwable cause = root.getCause();
while (cause != null) {
root = cause;
cause = root.getCause();
}
return root;
} | [
"private",
"static",
"Throwable",
"findRootCause",
"(",
"Throwable",
"t",
")",
"{",
"Throwable",
"root",
"=",
"t",
";",
"Throwable",
"cause",
"=",
"root",
".",
"getCause",
"(",
")",
";",
"while",
"(",
"cause",
"!=",
"null",
")",
"{",
"root",
"=",
"cause",
";",
"cause",
"=",
"root",
".",
"getCause",
"(",
")",
";",
"}",
"return",
"root",
";",
"}"
] | Find root cause of a specified Throwable object.
@param t is the Throwable object.
@return the root cause object. | [
"Find",
"root",
"cause",
"of",
"a",
"specified",
"Throwable",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JaxbUnmarshaller.java#L188-L196 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.setCheckConfig | public void setCheckConfig(boolean checkConfig) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setCheckConfig: " + checkConfig);
ivCheckConfig = checkConfig;
} | java | public void setCheckConfig(boolean checkConfig) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setCheckConfig: " + checkConfig);
ivCheckConfig = checkConfig;
} | [
"public",
"void",
"setCheckConfig",
"(",
"boolean",
"checkConfig",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setCheckConfig: \"",
"+",
"checkConfig",
")",
";",
"ivCheckConfig",
"=",
"checkConfig",
";",
"}"
] | F743-33178 | [
"F743",
"-",
"33178"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L367-L371 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.addSingleton | public void addSingleton(BeanMetaData bmd, boolean startup, Set<String> dependsOnLinks) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "addSingleton: " + bmd.j2eeName + " (startup=" + startup + ", dependsOn=" + (dependsOnLinks != null) + ")");
if (startup) {
if (ivStartupSingletonList == null) {
ivStartupSingletonList = new ArrayList<J2EEName>();
}
ivStartupSingletonList.add(bmd.j2eeName);
}
if (dependsOnLinks != null) {
if (ivSingletonDependencies == null) {
ivSingletonDependencies = new LinkedHashMap<BeanMetaData, Set<String>>();
}
ivSingletonDependencies.put(bmd, dependsOnLinks);
}
} | java | public void addSingleton(BeanMetaData bmd, boolean startup, Set<String> dependsOnLinks) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "addSingleton: " + bmd.j2eeName + " (startup=" + startup + ", dependsOn=" + (dependsOnLinks != null) + ")");
if (startup) {
if (ivStartupSingletonList == null) {
ivStartupSingletonList = new ArrayList<J2EEName>();
}
ivStartupSingletonList.add(bmd.j2eeName);
}
if (dependsOnLinks != null) {
if (ivSingletonDependencies == null) {
ivSingletonDependencies = new LinkedHashMap<BeanMetaData, Set<String>>();
}
ivSingletonDependencies.put(bmd, dependsOnLinks);
}
} | [
"public",
"void",
"addSingleton",
"(",
"BeanMetaData",
"bmd",
",",
"boolean",
"startup",
",",
"Set",
"<",
"String",
">",
"dependsOnLinks",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"addSingleton: \"",
"+",
"bmd",
".",
"j2eeName",
"+",
"\" (startup=\"",
"+",
"startup",
"+",
"\", dependsOn=\"",
"+",
"(",
"dependsOnLinks",
"!=",
"null",
")",
"+",
"\")\"",
")",
";",
"if",
"(",
"startup",
")",
"{",
"if",
"(",
"ivStartupSingletonList",
"==",
"null",
")",
"{",
"ivStartupSingletonList",
"=",
"new",
"ArrayList",
"<",
"J2EEName",
">",
"(",
")",
";",
"}",
"ivStartupSingletonList",
".",
"add",
"(",
"bmd",
".",
"j2eeName",
")",
";",
"}",
"if",
"(",
"dependsOnLinks",
"!=",
"null",
")",
"{",
"if",
"(",
"ivSingletonDependencies",
"==",
"null",
")",
"{",
"ivSingletonDependencies",
"=",
"new",
"LinkedHashMap",
"<",
"BeanMetaData",
",",
"Set",
"<",
"String",
">",
">",
"(",
")",
";",
"}",
"ivSingletonDependencies",
".",
"put",
"(",
"bmd",
",",
"dependsOnLinks",
")",
";",
"}",
"}"
] | Adds a singleton bean belonging to this application.
@param bmd
the bean metadata
@param startup
true if this is a startup singleton bean
@param dependsOnLinks
list of dependency EJB links | [
"Adds",
"a",
"singleton",
"bean",
"belonging",
"to",
"this",
"application",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L408-L425 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.checkIfCreateNonPersistentTimerAllowed | public synchronized void checkIfCreateNonPersistentTimerAllowed(EJBModuleMetaDataImpl mmd) {
if (ivStopping) {
throw new EJBStoppedException(ivName);
}
if (mmd != null && mmd.ivStopping) {
throw new EJBStoppedException(mmd.getJ2EEName().toString());
}
} | java | public synchronized void checkIfCreateNonPersistentTimerAllowed(EJBModuleMetaDataImpl mmd) {
if (ivStopping) {
throw new EJBStoppedException(ivName);
}
if (mmd != null && mmd.ivStopping) {
throw new EJBStoppedException(mmd.getJ2EEName().toString());
}
} | [
"public",
"synchronized",
"void",
"checkIfCreateNonPersistentTimerAllowed",
"(",
"EJBModuleMetaDataImpl",
"mmd",
")",
"{",
"if",
"(",
"ivStopping",
")",
"{",
"throw",
"new",
"EJBStoppedException",
"(",
"ivName",
")",
";",
"}",
"if",
"(",
"mmd",
"!=",
"null",
"&&",
"mmd",
".",
"ivStopping",
")",
"{",
"throw",
"new",
"EJBStoppedException",
"(",
"mmd",
".",
"getJ2EEName",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] | Prevent non-persistent timers from being created after the application or module has
begun stopping.
@throws EJBStoppedException
if the application or module is stopping | [
"Prevent",
"non",
"-",
"persistent",
"timers",
"from",
"being",
"created",
"after",
"the",
"application",
"or",
"module",
"has",
"begun",
"stopping",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L570-L578 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.finishStarting | private void finishStarting() throws RuntimeWarning {
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "finishStarting: " + ivName);
// NOTE - Any state that is cleared here should also be cleared in
// stoppingModule.
if (ivModules != null) { // F743-26072
notifyApplicationEventListeners(ivModules, true);
}
// Signal that the application is "fully started".
unblockThreadsWaitingForStart(); // F743-15941
synchronized (this) {
// F743-506 - Now that the application is fully started, start the
// queued non-persistent timers.
if (ivQueuedNonPersistentTimers != null) {
startQueuedNonPersistentTimerAlarms();
ivQueuedNonPersistentTimers = null;
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "finishStarting");
} | java | private void finishStarting() throws RuntimeWarning {
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "finishStarting: " + ivName);
// NOTE - Any state that is cleared here should also be cleared in
// stoppingModule.
if (ivModules != null) { // F743-26072
notifyApplicationEventListeners(ivModules, true);
}
// Signal that the application is "fully started".
unblockThreadsWaitingForStart(); // F743-15941
synchronized (this) {
// F743-506 - Now that the application is fully started, start the
// queued non-persistent timers.
if (ivQueuedNonPersistentTimers != null) {
startQueuedNonPersistentTimerAlarms();
ivQueuedNonPersistentTimers = null;
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "finishStarting");
} | [
"private",
"void",
"finishStarting",
"(",
")",
"throws",
"RuntimeWarning",
"{",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"finishStarting: \"",
"+",
"ivName",
")",
";",
"// NOTE - Any state that is cleared here should also be cleared in",
"// stoppingModule.",
"if",
"(",
"ivModules",
"!=",
"null",
")",
"{",
"// F743-26072",
"notifyApplicationEventListeners",
"(",
"ivModules",
",",
"true",
")",
";",
"}",
"// Signal that the application is \"fully started\".",
"unblockThreadsWaitingForStart",
"(",
")",
";",
"// F743-15941",
"synchronized",
"(",
"this",
")",
"{",
"// F743-506 - Now that the application is fully started, start the",
"// queued non-persistent timers.",
"if",
"(",
"ivQueuedNonPersistentTimers",
"!=",
"null",
")",
"{",
"startQueuedNonPersistentTimerAlarms",
"(",
")",
";",
"ivQueuedNonPersistentTimers",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"finishStarting\"",
")",
";",
"}"
] | Notification that the application is about to finish starting. Performs processing of
singletons after all modules have been started but before the application has
finished starting. Module references are resolved, and startup singletons are
started.
@throws RuntimeWarning
if a dependency reference cannot be resolved or a startup singleton fails
to initialize | [
"Notification",
"that",
"the",
"application",
"is",
"about",
"to",
"finish",
"starting",
".",
"Performs",
"processing",
"of",
"singletons",
"after",
"all",
"modules",
"have",
"been",
"started",
"but",
"before",
"the",
"application",
"has",
"finished",
"starting",
".",
"Module",
"references",
"are",
"resolved",
"and",
"startup",
"singletons",
"are",
"started",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L621-L647 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.resolveEJBLink | private HomeRecord resolveEJBLink(J2EEName source, String link) throws RuntimeWarning {
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "resolveEJBLink: " + link);
String module = source.getModule();
String component = source.getComponent();
HomeRecord result;
// F7434950.CodRev - Use resolveEJBLink
try {
result = EJSContainer.homeOfHomes.resolveEJBLink(source.getApplication(), module, link);
} catch (EJBNotFoundException ex) {
Tr.error(tc, "SINGLETON_DEPENDS_ON_NONEXISTENT_BEAN_CNTR0198E", new Object[] { component, module, link });
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolveEJBLink");
throw new RuntimeWarning("CNTR0198E: The " + component + " singleton session bean in the " + module + " module depends on "
+ link + ", which does not exist.", ex);
} catch (AmbiguousEJBReferenceException ex) {
Tr.error(tc, "SINGLETON_DEPENDS_ON_AMBIGUOUS_NAME_CNTR0199E", new Object[] { component, module, link });
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolveEJBLink");
throw new RuntimeWarning("CNTR0199E: The " + component + " singleton session bean in the " + module + " module depends on "
+ link + ", which does not uniquely specify an enterprise bean.", ex);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolveEJBLink: " + result);
return result;
} | java | private HomeRecord resolveEJBLink(J2EEName source, String link) throws RuntimeWarning {
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "resolveEJBLink: " + link);
String module = source.getModule();
String component = source.getComponent();
HomeRecord result;
// F7434950.CodRev - Use resolveEJBLink
try {
result = EJSContainer.homeOfHomes.resolveEJBLink(source.getApplication(), module, link);
} catch (EJBNotFoundException ex) {
Tr.error(tc, "SINGLETON_DEPENDS_ON_NONEXISTENT_BEAN_CNTR0198E", new Object[] { component, module, link });
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolveEJBLink");
throw new RuntimeWarning("CNTR0198E: The " + component + " singleton session bean in the " + module + " module depends on "
+ link + ", which does not exist.", ex);
} catch (AmbiguousEJBReferenceException ex) {
Tr.error(tc, "SINGLETON_DEPENDS_ON_AMBIGUOUS_NAME_CNTR0199E", new Object[] { component, module, link });
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolveEJBLink");
throw new RuntimeWarning("CNTR0199E: The " + component + " singleton session bean in the " + module + " module depends on "
+ link + ", which does not uniquely specify an enterprise bean.", ex);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolveEJBLink: " + result);
return result;
} | [
"private",
"HomeRecord",
"resolveEJBLink",
"(",
"J2EEName",
"source",
",",
"String",
"link",
")",
"throws",
"RuntimeWarning",
"{",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"resolveEJBLink: \"",
"+",
"link",
")",
";",
"String",
"module",
"=",
"source",
".",
"getModule",
"(",
")",
";",
"String",
"component",
"=",
"source",
".",
"getComponent",
"(",
")",
";",
"HomeRecord",
"result",
";",
"// F7434950.CodRev - Use resolveEJBLink",
"try",
"{",
"result",
"=",
"EJSContainer",
".",
"homeOfHomes",
".",
"resolveEJBLink",
"(",
"source",
".",
"getApplication",
"(",
")",
",",
"module",
",",
"link",
")",
";",
"}",
"catch",
"(",
"EJBNotFoundException",
"ex",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"SINGLETON_DEPENDS_ON_NONEXISTENT_BEAN_CNTR0198E\"",
",",
"new",
"Object",
"[",
"]",
"{",
"component",
",",
"module",
",",
"link",
"}",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"resolveEJBLink\"",
")",
";",
"throw",
"new",
"RuntimeWarning",
"(",
"\"CNTR0198E: The \"",
"+",
"component",
"+",
"\" singleton session bean in the \"",
"+",
"module",
"+",
"\" module depends on \"",
"+",
"link",
"+",
"\", which does not exist.\"",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"AmbiguousEJBReferenceException",
"ex",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"SINGLETON_DEPENDS_ON_AMBIGUOUS_NAME_CNTR0199E\"",
",",
"new",
"Object",
"[",
"]",
"{",
"component",
",",
"module",
",",
"link",
"}",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"resolveEJBLink\"",
")",
";",
"throw",
"new",
"RuntimeWarning",
"(",
"\"CNTR0199E: The \"",
"+",
"component",
"+",
"\" singleton session bean in the \"",
"+",
"module",
"+",
"\" module depends on \"",
"+",
"link",
"+",
"\", which does not uniquely specify an enterprise bean.\"",
",",
"ex",
")",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"resolveEJBLink: \"",
"+",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Resolves a dependency reference link to another EJB.
@param source
the dependent bean
@param link
the dependency bean using EJB link syntax
@return the resulting home record
@throws RuntimeWarning
if the link cannot be resolved | [
"Resolves",
"a",
"dependency",
"reference",
"link",
"to",
"another",
"EJB",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L732-L763 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.resolveDependencies | private void resolveDependencies() throws RuntimeWarning {
// d684950
if (EJSPlatformHelper.isZOSCRA()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "resolveDependencies: skipped in adjunct process");
return;
}
// F743-20281 - If an exception happened during early dependency
// resolution, then fail the application.
if (ivSingletonDependencyResolutionException != null) {
throw ivSingletonDependencyResolutionException;
}
// Beans currently on a dependency list. If A->B->C->A, then used={A}
// then used={A,B} then used={A,B,C} then C->A is an error because A
// is already in the set.
Set<BeanMetaData> used = new HashSet<BeanMetaData>();
// F7434950.CodRev - Create a copy of the key list since
// resolveBeanDependencies will modify ivSingletonDependencies.
for (BeanMetaData bmd : new ArrayList<BeanMetaData>(ivSingletonDependencies.keySet())) {
used.add(bmd);
resolveBeanDependencies(bmd, used);
used.remove(bmd);
}
} | java | private void resolveDependencies() throws RuntimeWarning {
// d684950
if (EJSPlatformHelper.isZOSCRA()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "resolveDependencies: skipped in adjunct process");
return;
}
// F743-20281 - If an exception happened during early dependency
// resolution, then fail the application.
if (ivSingletonDependencyResolutionException != null) {
throw ivSingletonDependencyResolutionException;
}
// Beans currently on a dependency list. If A->B->C->A, then used={A}
// then used={A,B} then used={A,B,C} then C->A is an error because A
// is already in the set.
Set<BeanMetaData> used = new HashSet<BeanMetaData>();
// F7434950.CodRev - Create a copy of the key list since
// resolveBeanDependencies will modify ivSingletonDependencies.
for (BeanMetaData bmd : new ArrayList<BeanMetaData>(ivSingletonDependencies.keySet())) {
used.add(bmd);
resolveBeanDependencies(bmd, used);
used.remove(bmd);
}
} | [
"private",
"void",
"resolveDependencies",
"(",
")",
"throws",
"RuntimeWarning",
"{",
"// d684950",
"if",
"(",
"EJSPlatformHelper",
".",
"isZOSCRA",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"resolveDependencies: skipped in adjunct process\"",
")",
";",
"return",
";",
"}",
"// F743-20281 - If an exception happened during early dependency",
"// resolution, then fail the application.",
"if",
"(",
"ivSingletonDependencyResolutionException",
"!=",
"null",
")",
"{",
"throw",
"ivSingletonDependencyResolutionException",
";",
"}",
"// Beans currently on a dependency list. If A->B->C->A, then used={A}",
"// then used={A,B} then used={A,B,C} then C->A is an error because A",
"// is already in the set.",
"Set",
"<",
"BeanMetaData",
">",
"used",
"=",
"new",
"HashSet",
"<",
"BeanMetaData",
">",
"(",
")",
";",
"// F7434950.CodRev - Create a copy of the key list since",
"// resolveBeanDependencies will modify ivSingletonDependencies.",
"for",
"(",
"BeanMetaData",
"bmd",
":",
"new",
"ArrayList",
"<",
"BeanMetaData",
">",
"(",
"ivSingletonDependencies",
".",
"keySet",
"(",
")",
")",
")",
"{",
"used",
".",
"add",
"(",
"bmd",
")",
";",
"resolveBeanDependencies",
"(",
"bmd",
",",
"used",
")",
";",
"used",
".",
"remove",
"(",
"bmd",
")",
";",
"}",
"}"
] | Resolves and verifies the singleton dependency links.
@throws RuntimeWarning
if verification fails | [
"Resolves",
"and",
"verifies",
"the",
"singleton",
"dependency",
"links",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L771-L797 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.resolveBeanDependencies | private void resolveBeanDependencies(BeanMetaData bmd, Set<BeanMetaData> used) throws RuntimeWarning {
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "resolveBeanDependencies: " + bmd.j2eeName);
// F7434950.CodRev - If another bean depended on this bean, then
// this bean's dependencies have already been resolved and verified.
// F743-20281 - Alternatively, this bean's dependencies might have been
// resolved early, in which case we don't need to resolve them again.
if (bmd.ivDependsOn != null) {
return;
}
bmd.ivDependsOn = new ArrayList<J2EEName>();
Set<String> dependsOnLinks = ivSingletonDependencies.remove(bmd);
if (dependsOnLinks == null) {
return;
}
for (String dependencyLink : dependsOnLinks) {
HomeRecord hr = resolveEJBLink(bmd.j2eeName, dependencyLink);
BeanMetaData dependency = hr.getBeanMetaData();
J2EEName dependencyName = dependency.j2eeName;
if (!dependency.isSingletonSessionBean()) {
Tr.error(
tc,
"SINGLETON_DEPENDS_ON_NON_SINGLETON_BEAN_CNTR0200E",
new Object[] { bmd.j2eeName.getComponent(), bmd.j2eeName.getModule(), dependencyName.getComponent(),
dependencyName.getModule() });
throw new RuntimeWarning("CNTR0200E: The " + bmd.j2eeName.getComponent() + " singleton session bean in the "
+ bmd.j2eeName.getModule() + " module depends on the " + dependencyName.getComponent() + " enterprise bean in the "
+ dependencyName.getModule() + ", but the target is not a singleton session bean.");
}
if (!used.add(dependency)) {
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "circular dependency from " + dependencyName);
Tr.error(tc, "SINGLETON_DEPENDS_ON_SELF_CNTR0201E",
new Object[] { dependencyName.getComponent(), dependencyName.getModule() });
throw new RuntimeWarning("CNTR0201E: The " + dependencyName.getComponent() + " singleton session bean in the "
+ dependencyName.getModule() + " module directly or indirectly depends on itself.");
}
bmd.ivDependsOn.add(dependencyName); // d588220
resolveBeanDependencies(dependency, used);
used.remove(dependency);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolveBeanDependencies: " + bmd.j2eeName);
} | java | private void resolveBeanDependencies(BeanMetaData bmd, Set<BeanMetaData> used) throws RuntimeWarning {
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "resolveBeanDependencies: " + bmd.j2eeName);
// F7434950.CodRev - If another bean depended on this bean, then
// this bean's dependencies have already been resolved and verified.
// F743-20281 - Alternatively, this bean's dependencies might have been
// resolved early, in which case we don't need to resolve them again.
if (bmd.ivDependsOn != null) {
return;
}
bmd.ivDependsOn = new ArrayList<J2EEName>();
Set<String> dependsOnLinks = ivSingletonDependencies.remove(bmd);
if (dependsOnLinks == null) {
return;
}
for (String dependencyLink : dependsOnLinks) {
HomeRecord hr = resolveEJBLink(bmd.j2eeName, dependencyLink);
BeanMetaData dependency = hr.getBeanMetaData();
J2EEName dependencyName = dependency.j2eeName;
if (!dependency.isSingletonSessionBean()) {
Tr.error(
tc,
"SINGLETON_DEPENDS_ON_NON_SINGLETON_BEAN_CNTR0200E",
new Object[] { bmd.j2eeName.getComponent(), bmd.j2eeName.getModule(), dependencyName.getComponent(),
dependencyName.getModule() });
throw new RuntimeWarning("CNTR0200E: The " + bmd.j2eeName.getComponent() + " singleton session bean in the "
+ bmd.j2eeName.getModule() + " module depends on the " + dependencyName.getComponent() + " enterprise bean in the "
+ dependencyName.getModule() + ", but the target is not a singleton session bean.");
}
if (!used.add(dependency)) {
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "circular dependency from " + dependencyName);
Tr.error(tc, "SINGLETON_DEPENDS_ON_SELF_CNTR0201E",
new Object[] { dependencyName.getComponent(), dependencyName.getModule() });
throw new RuntimeWarning("CNTR0201E: The " + dependencyName.getComponent() + " singleton session bean in the "
+ dependencyName.getModule() + " module directly or indirectly depends on itself.");
}
bmd.ivDependsOn.add(dependencyName); // d588220
resolveBeanDependencies(dependency, used);
used.remove(dependency);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolveBeanDependencies: " + bmd.j2eeName);
} | [
"private",
"void",
"resolveBeanDependencies",
"(",
"BeanMetaData",
"bmd",
",",
"Set",
"<",
"BeanMetaData",
">",
"used",
")",
"throws",
"RuntimeWarning",
"{",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"resolveBeanDependencies: \"",
"+",
"bmd",
".",
"j2eeName",
")",
";",
"// F7434950.CodRev - If another bean depended on this bean, then",
"// this bean's dependencies have already been resolved and verified.",
"// F743-20281 - Alternatively, this bean's dependencies might have been",
"// resolved early, in which case we don't need to resolve them again.",
"if",
"(",
"bmd",
".",
"ivDependsOn",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"bmd",
".",
"ivDependsOn",
"=",
"new",
"ArrayList",
"<",
"J2EEName",
">",
"(",
")",
";",
"Set",
"<",
"String",
">",
"dependsOnLinks",
"=",
"ivSingletonDependencies",
".",
"remove",
"(",
"bmd",
")",
";",
"if",
"(",
"dependsOnLinks",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"String",
"dependencyLink",
":",
"dependsOnLinks",
")",
"{",
"HomeRecord",
"hr",
"=",
"resolveEJBLink",
"(",
"bmd",
".",
"j2eeName",
",",
"dependencyLink",
")",
";",
"BeanMetaData",
"dependency",
"=",
"hr",
".",
"getBeanMetaData",
"(",
")",
";",
"J2EEName",
"dependencyName",
"=",
"dependency",
".",
"j2eeName",
";",
"if",
"(",
"!",
"dependency",
".",
"isSingletonSessionBean",
"(",
")",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"SINGLETON_DEPENDS_ON_NON_SINGLETON_BEAN_CNTR0200E\"",
",",
"new",
"Object",
"[",
"]",
"{",
"bmd",
".",
"j2eeName",
".",
"getComponent",
"(",
")",
",",
"bmd",
".",
"j2eeName",
".",
"getModule",
"(",
")",
",",
"dependencyName",
".",
"getComponent",
"(",
")",
",",
"dependencyName",
".",
"getModule",
"(",
")",
"}",
")",
";",
"throw",
"new",
"RuntimeWarning",
"(",
"\"CNTR0200E: The \"",
"+",
"bmd",
".",
"j2eeName",
".",
"getComponent",
"(",
")",
"+",
"\" singleton session bean in the \"",
"+",
"bmd",
".",
"j2eeName",
".",
"getModule",
"(",
")",
"+",
"\" module depends on the \"",
"+",
"dependencyName",
".",
"getComponent",
"(",
")",
"+",
"\" enterprise bean in the \"",
"+",
"dependencyName",
".",
"getModule",
"(",
")",
"+",
"\", but the target is not a singleton session bean.\"",
")",
";",
"}",
"if",
"(",
"!",
"used",
".",
"add",
"(",
"dependency",
")",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"circular dependency from \"",
"+",
"dependencyName",
")",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"SINGLETON_DEPENDS_ON_SELF_CNTR0201E\"",
",",
"new",
"Object",
"[",
"]",
"{",
"dependencyName",
".",
"getComponent",
"(",
")",
",",
"dependencyName",
".",
"getModule",
"(",
")",
"}",
")",
";",
"throw",
"new",
"RuntimeWarning",
"(",
"\"CNTR0201E: The \"",
"+",
"dependencyName",
".",
"getComponent",
"(",
")",
"+",
"\" singleton session bean in the \"",
"+",
"dependencyName",
".",
"getModule",
"(",
")",
"+",
"\" module directly or indirectly depends on itself.\"",
")",
";",
"}",
"bmd",
".",
"ivDependsOn",
".",
"add",
"(",
"dependencyName",
")",
";",
"// d588220",
"resolveBeanDependencies",
"(",
"dependency",
",",
"used",
")",
";",
"used",
".",
"remove",
"(",
"dependency",
")",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"resolveBeanDependencies: \"",
"+",
"bmd",
".",
"j2eeName",
")",
";",
"}"
] | Verifies that the specified bean only depends on other singletons and that it does
not depend on itself. This method calls itself recursively to process all
dependencies.
@param bmd
the bean to check
@param used
the set of dependent beans that are already being processed
@param checked
the set of beans that have already been processed
@throws RuntimeWarning
if verification fails | [
"Verifies",
"that",
"the",
"specified",
"bean",
"only",
"depends",
"on",
"other",
"singletons",
"and",
"that",
"it",
"does",
"not",
"depend",
"on",
"itself",
".",
"This",
"method",
"calls",
"itself",
"recursively",
"to",
"process",
"all",
"dependencies",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L813-L866 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.createStartupBeans | private void createStartupBeans() throws RuntimeWarning {
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
// d684950
if (EJSPlatformHelper.isZOSCRA()) {
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "createStartupBeans: skipped in adjunct process");
return;
}
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "createStartupBeans");
for (int i = 0, size = ivStartupSingletonList.size(); i < size; i++) {
J2EEName startupName = ivStartupSingletonList.get(i);
try { // F743-1753CodRev
EJSHome home = (EJSHome) EJSContainer.homeOfHomes.getHome(startupName);
if (home == null) {
// The home won't exist if singleton beans aren't enabled
// in the runtime.
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "Ignoring Singleton Startup bean: " + startupName);
} else {
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "Creating instance for Singleton Startup bean: " + startupName.toString());
home.createSingletonBeanO();
}
} catch (Throwable t) {
// A failure has occurred processing the Startup Singletons.
// Post an FFDC, log the failure, and throw a RuntimWarning to
// cause this application start to abort.
FFDCFilter.processException(t, CLASS_NAME + ".createStartupBeans", "6921", this);
Tr.error(tc, "STARTUP_SINGLETON_SESSION_BEAN_INITIALIZATION_FAILED_CNTR0190E", new Object[] { startupName.getComponent(),
startupName.getModule(), t });
throw new RuntimeWarning("CNTR0201E: The " + startupName.getComponent() + " startup singleton session bean in the "
+ startupName.getModule() + " module failed initialization.", t);
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "createStartupBeans");
} | java | private void createStartupBeans() throws RuntimeWarning {
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
// d684950
if (EJSPlatformHelper.isZOSCRA()) {
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "createStartupBeans: skipped in adjunct process");
return;
}
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "createStartupBeans");
for (int i = 0, size = ivStartupSingletonList.size(); i < size; i++) {
J2EEName startupName = ivStartupSingletonList.get(i);
try { // F743-1753CodRev
EJSHome home = (EJSHome) EJSContainer.homeOfHomes.getHome(startupName);
if (home == null) {
// The home won't exist if singleton beans aren't enabled
// in the runtime.
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "Ignoring Singleton Startup bean: " + startupName);
} else {
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "Creating instance for Singleton Startup bean: " + startupName.toString());
home.createSingletonBeanO();
}
} catch (Throwable t) {
// A failure has occurred processing the Startup Singletons.
// Post an FFDC, log the failure, and throw a RuntimWarning to
// cause this application start to abort.
FFDCFilter.processException(t, CLASS_NAME + ".createStartupBeans", "6921", this);
Tr.error(tc, "STARTUP_SINGLETON_SESSION_BEAN_INITIALIZATION_FAILED_CNTR0190E", new Object[] { startupName.getComponent(),
startupName.getModule(), t });
throw new RuntimeWarning("CNTR0201E: The " + startupName.getComponent() + " startup singleton session bean in the "
+ startupName.getModule() + " module failed initialization.", t);
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "createStartupBeans");
} | [
"private",
"void",
"createStartupBeans",
"(",
")",
"throws",
"RuntimeWarning",
"{",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"// d684950",
"if",
"(",
"EJSPlatformHelper",
".",
"isZOSCRA",
"(",
")",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"createStartupBeans: skipped in adjunct process\"",
")",
";",
"return",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"createStartupBeans\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"size",
"=",
"ivStartupSingletonList",
".",
"size",
"(",
")",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"J2EEName",
"startupName",
"=",
"ivStartupSingletonList",
".",
"get",
"(",
"i",
")",
";",
"try",
"{",
"// F743-1753CodRev",
"EJSHome",
"home",
"=",
"(",
"EJSHome",
")",
"EJSContainer",
".",
"homeOfHomes",
".",
"getHome",
"(",
"startupName",
")",
";",
"if",
"(",
"home",
"==",
"null",
")",
"{",
"// The home won't exist if singleton beans aren't enabled",
"// in the runtime.",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Ignoring Singleton Startup bean: \"",
"+",
"startupName",
")",
";",
"}",
"else",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Creating instance for Singleton Startup bean: \"",
"+",
"startupName",
".",
"toString",
"(",
")",
")",
";",
"home",
".",
"createSingletonBeanO",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"// A failure has occurred processing the Startup Singletons.",
"// Post an FFDC, log the failure, and throw a RuntimWarning to",
"// cause this application start to abort.",
"FFDCFilter",
".",
"processException",
"(",
"t",
",",
"CLASS_NAME",
"+",
"\".createStartupBeans\"",
",",
"\"6921\"",
",",
"this",
")",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"STARTUP_SINGLETON_SESSION_BEAN_INITIALIZATION_FAILED_CNTR0190E\"",
",",
"new",
"Object",
"[",
"]",
"{",
"startupName",
".",
"getComponent",
"(",
")",
",",
"startupName",
".",
"getModule",
"(",
")",
",",
"t",
"}",
")",
";",
"throw",
"new",
"RuntimeWarning",
"(",
"\"CNTR0201E: The \"",
"+",
"startupName",
".",
"getComponent",
"(",
")",
"+",
"\" startup singleton session bean in the \"",
"+",
"startupName",
".",
"getModule",
"(",
")",
"+",
"\" module failed initialization.\"",
",",
"t",
")",
";",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"createStartupBeans\"",
")",
";",
"}"
] | Creates all startup singleton beans.
@throws RuntimeWarning
if a bean fails to initialize | [
"Creates",
"all",
"startup",
"singleton",
"beans",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L930-L975 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.notifyApplicationEventListeners | private void notifyApplicationEventListeners(Collection<EJBModuleMetaDataImpl> modules, boolean started) throws RuntimeWarning { // F743-26072
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "notifyApplicationEventListeners: started=" + started);
RuntimeWarning warning = null;
for (EJBModuleMetaDataImpl mmd : modules) {
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "notifying listeners in module: " + mmd.ivJ2EEName);
List<EJBApplicationEventListener> listeners = mmd.ivApplicationEventListeners;
if (listeners != null) {
for (EJBApplicationEventListener listener : listeners) {
try {
if (started) {
listener.applicationStarted(ivName);
} else {
listener.applicationStopping(ivName);
}
} catch (Throwable t) {
FFDCFilter.processException(t, CLASS_NAME + ".notifyApplicationEventListeners", "781", this);
if (isTraceOn && tc.isEventEnabled())
Tr.event(tc, listener + " threw unexpected throwable: " + t, t);
// Save the first exception to be rethrown.
if (warning == null) {
warning = new RuntimeWarning(t);
}
}
}
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "notifyApplicationEventListeners: exception=" + warning);
if (warning != null) {
throw warning;
}
} | java | private void notifyApplicationEventListeners(Collection<EJBModuleMetaDataImpl> modules, boolean started) throws RuntimeWarning { // F743-26072
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "notifyApplicationEventListeners: started=" + started);
RuntimeWarning warning = null;
for (EJBModuleMetaDataImpl mmd : modules) {
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "notifying listeners in module: " + mmd.ivJ2EEName);
List<EJBApplicationEventListener> listeners = mmd.ivApplicationEventListeners;
if (listeners != null) {
for (EJBApplicationEventListener listener : listeners) {
try {
if (started) {
listener.applicationStarted(ivName);
} else {
listener.applicationStopping(ivName);
}
} catch (Throwable t) {
FFDCFilter.processException(t, CLASS_NAME + ".notifyApplicationEventListeners", "781", this);
if (isTraceOn && tc.isEventEnabled())
Tr.event(tc, listener + " threw unexpected throwable: " + t, t);
// Save the first exception to be rethrown.
if (warning == null) {
warning = new RuntimeWarning(t);
}
}
}
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "notifyApplicationEventListeners: exception=" + warning);
if (warning != null) {
throw warning;
}
} | [
"private",
"void",
"notifyApplicationEventListeners",
"(",
"Collection",
"<",
"EJBModuleMetaDataImpl",
">",
"modules",
",",
"boolean",
"started",
")",
"throws",
"RuntimeWarning",
"{",
"// F743-26072",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"notifyApplicationEventListeners: started=\"",
"+",
"started",
")",
";",
"RuntimeWarning",
"warning",
"=",
"null",
";",
"for",
"(",
"EJBModuleMetaDataImpl",
"mmd",
":",
"modules",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"notifying listeners in module: \"",
"+",
"mmd",
".",
"ivJ2EEName",
")",
";",
"List",
"<",
"EJBApplicationEventListener",
">",
"listeners",
"=",
"mmd",
".",
"ivApplicationEventListeners",
";",
"if",
"(",
"listeners",
"!=",
"null",
")",
"{",
"for",
"(",
"EJBApplicationEventListener",
"listener",
":",
"listeners",
")",
"{",
"try",
"{",
"if",
"(",
"started",
")",
"{",
"listener",
".",
"applicationStarted",
"(",
"ivName",
")",
";",
"}",
"else",
"{",
"listener",
".",
"applicationStopping",
"(",
"ivName",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"t",
",",
"CLASS_NAME",
"+",
"\".notifyApplicationEventListeners\"",
",",
"\"781\"",
",",
"this",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"listener",
"+",
"\" threw unexpected throwable: \"",
"+",
"t",
",",
"t",
")",
";",
"// Save the first exception to be rethrown.",
"if",
"(",
"warning",
"==",
"null",
")",
"{",
"warning",
"=",
"new",
"RuntimeWarning",
"(",
"t",
")",
";",
"}",
"}",
"}",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"notifyApplicationEventListeners: exception=\"",
"+",
"warning",
")",
";",
"if",
"(",
"warning",
"!=",
"null",
")",
"{",
"throw",
"warning",
";",
"}",
"}"
] | Notifies all application event listeners in the specified modules.
@param modules
the list of modules to notify
@param started
<tt>true</tt> if the application is started, or <tt>false</tt> if the
application is stopping
@throws RuntimeWarning
if any listener throws an exception | [
"Notifies",
"all",
"application",
"event",
"listeners",
"in",
"the",
"specified",
"modules",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L988-L1028 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.addSingletonInitialization | public synchronized void addSingletonInitialization(EJSHome home) {
if (ivStopping) {
throw new EJBStoppedException(home.getJ2EEName().toString());
}
if (ivSingletonInitializations == null) {
ivSingletonInitializations = new LinkedHashSet<EJSHome>();
}
ivSingletonInitializations.add(home);
} | java | public synchronized void addSingletonInitialization(EJSHome home) {
if (ivStopping) {
throw new EJBStoppedException(home.getJ2EEName().toString());
}
if (ivSingletonInitializations == null) {
ivSingletonInitializations = new LinkedHashSet<EJSHome>();
}
ivSingletonInitializations.add(home);
} | [
"public",
"synchronized",
"void",
"addSingletonInitialization",
"(",
"EJSHome",
"home",
")",
"{",
"if",
"(",
"ivStopping",
")",
"{",
"throw",
"new",
"EJBStoppedException",
"(",
"home",
".",
"getJ2EEName",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"ivSingletonInitializations",
"==",
"null",
")",
"{",
"ivSingletonInitializations",
"=",
"new",
"LinkedHashSet",
"<",
"EJSHome",
">",
"(",
")",
";",
"}",
"ivSingletonInitializations",
".",
"add",
"(",
"home",
")",
";",
"}"
] | Record the initialization attempt of a singleton. This method must not be called for
a bean before it is called for each of that bean's dependencies. This method may be
called multiple times for the same bean, but only the first call will have an effect.
@param home
the bean's home
@throws EJBStoppedException
if the application is stopping | [
"Record",
"the",
"initialization",
"attempt",
"of",
"a",
"singleton",
".",
"This",
"method",
"must",
"not",
"be",
"called",
"for",
"a",
"bean",
"before",
"it",
"is",
"called",
"for",
"each",
"of",
"that",
"bean",
"s",
"dependencies",
".",
"This",
"method",
"may",
"be",
"called",
"multiple",
"times",
"for",
"the",
"same",
"bean",
"but",
"only",
"the",
"first",
"call",
"will",
"have",
"an",
"effect",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L1066-L1075 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.queueOrStartNonPersistentTimerAlarm | public synchronized boolean queueOrStartNonPersistentTimerAlarm(TimerNpImpl timer, EJBModuleMetaDataImpl module) {
if (ivStopping) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "not starting timer alarm after application stop: " + timer);
return false;
} else {
if (isStarted()) {
timer.schedule();
} else if (ivModuleBeingAddedLate != null && ivModuleBeingAddedLate != module) // d607800.CodRv
{
timer.schedule();
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "queueing timer alarm until full application start: " + timer);
if (ivQueuedNonPersistentTimers == null) {
ivQueuedNonPersistentTimers = new ArrayList<TimerNpImpl>();
}
ivQueuedNonPersistentTimers.add(timer);
}
}
return true;
} | java | public synchronized boolean queueOrStartNonPersistentTimerAlarm(TimerNpImpl timer, EJBModuleMetaDataImpl module) {
if (ivStopping) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "not starting timer alarm after application stop: " + timer);
return false;
} else {
if (isStarted()) {
timer.schedule();
} else if (ivModuleBeingAddedLate != null && ivModuleBeingAddedLate != module) // d607800.CodRv
{
timer.schedule();
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "queueing timer alarm until full application start: " + timer);
if (ivQueuedNonPersistentTimers == null) {
ivQueuedNonPersistentTimers = new ArrayList<TimerNpImpl>();
}
ivQueuedNonPersistentTimers.add(timer);
}
}
return true;
} | [
"public",
"synchronized",
"boolean",
"queueOrStartNonPersistentTimerAlarm",
"(",
"TimerNpImpl",
"timer",
",",
"EJBModuleMetaDataImpl",
"module",
")",
"{",
"if",
"(",
"ivStopping",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"not starting timer alarm after application stop: \"",
"+",
"timer",
")",
";",
"return",
"false",
";",
"}",
"else",
"{",
"if",
"(",
"isStarted",
"(",
")",
")",
"{",
"timer",
".",
"schedule",
"(",
")",
";",
"}",
"else",
"if",
"(",
"ivModuleBeingAddedLate",
"!=",
"null",
"&&",
"ivModuleBeingAddedLate",
"!=",
"module",
")",
"// d607800.CodRv",
"{",
"timer",
".",
"schedule",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"queueing timer alarm until full application start: \"",
"+",
"timer",
")",
";",
"if",
"(",
"ivQueuedNonPersistentTimers",
"==",
"null",
")",
"{",
"ivQueuedNonPersistentTimers",
"=",
"new",
"ArrayList",
"<",
"TimerNpImpl",
">",
"(",
")",
";",
"}",
"ivQueuedNonPersistentTimers",
".",
"add",
"(",
"timer",
")",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Queues or starts a non-persistent timer alarm, returning an indication of whether or
not the operation was successful.
If the application has not yet started, then the timer is queued and its alarm will
be started after the application is fully started.
If the application has previously been started, but now we are late-adding a new
module, the timer we are trying to start is from that new module, then the timer is
queued and its alarm will be started after the module is fully started.
If everything in the application is already running, then the timer alarm is started
immediately.
If we are in the late-add flow, and the timer is not from the module we are in the
process of adding (ie, the module the timer is from has already been started), then
the timer alarm is started immediately.
Otherwise, the request is ignored because the application is stopping or stopped, and
all non-persistent timers for the application have already been removed. False is
returned.
@return true if the timer was successfully queued or started; otherwise false. | [
"Queues",
"or",
"starts",
"a",
"non",
"-",
"persistent",
"timer",
"alarm",
"returning",
"an",
"indication",
"of",
"whether",
"or",
"not",
"the",
"operation",
"was",
"successful",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L1101-L1123 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.beginStopping | private void beginStopping(boolean application, J2EEName j2eeName, Collection<EJBModuleMetaDataImpl> modules) { // F743-26072
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "beginStopping: application=" + application + ", " + j2eeName);
synchronized (this) {
if (application) { // F743-26072
ivStopping = true;
}
// F743-15941 - If the application or fine-grained module start
// failed, then we never transitioned to "fully started". Unblock
// any threads that are waiting in checkIfEJBWorkAllowed.
//
// This call is within the synchronized block only to reduce
// monitor acquisition/release.
unblockThreadsWaitingForStart();
}
if (j2eeName != null) {
// d589357 - Cancel non-persistent timers. We do not allow new
// non-persistent timers to be created after the application or
// module has begun stopping (e.g., during PreDestroy), so we also
// remove all existing timers before calling PreDestroy.
ivContainer.getEJBRuntime().removeTimers(j2eeName); // F743-26072
}
if (ivSingletonInitializations != null) {
List<EJSHome> reverse = new ArrayList<EJSHome>(ivSingletonInitializations);
for (int i = reverse.size(); --i >= 0;) {
EJSHome home = reverse.get(i);
J2EEName homeJ2EEName = home.getJ2EEName();
if (application || (j2eeName.getModule().equals(homeJ2EEName.getModule()))) {
home.destroy();
ivSingletonInitializations.remove(home);
}
}
}
try {
notifyApplicationEventListeners(modules, false); // F743-26072
} catch (RuntimeWarning rw) {
FFDCFilter.processException(rw, CLASS_NAME + ".stopping", "977", this);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "beginStopping");
} | java | private void beginStopping(boolean application, J2EEName j2eeName, Collection<EJBModuleMetaDataImpl> modules) { // F743-26072
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "beginStopping: application=" + application + ", " + j2eeName);
synchronized (this) {
if (application) { // F743-26072
ivStopping = true;
}
// F743-15941 - If the application or fine-grained module start
// failed, then we never transitioned to "fully started". Unblock
// any threads that are waiting in checkIfEJBWorkAllowed.
//
// This call is within the synchronized block only to reduce
// monitor acquisition/release.
unblockThreadsWaitingForStart();
}
if (j2eeName != null) {
// d589357 - Cancel non-persistent timers. We do not allow new
// non-persistent timers to be created after the application or
// module has begun stopping (e.g., during PreDestroy), so we also
// remove all existing timers before calling PreDestroy.
ivContainer.getEJBRuntime().removeTimers(j2eeName); // F743-26072
}
if (ivSingletonInitializations != null) {
List<EJSHome> reverse = new ArrayList<EJSHome>(ivSingletonInitializations);
for (int i = reverse.size(); --i >= 0;) {
EJSHome home = reverse.get(i);
J2EEName homeJ2EEName = home.getJ2EEName();
if (application || (j2eeName.getModule().equals(homeJ2EEName.getModule()))) {
home.destroy();
ivSingletonInitializations.remove(home);
}
}
}
try {
notifyApplicationEventListeners(modules, false); // F743-26072
} catch (RuntimeWarning rw) {
FFDCFilter.processException(rw, CLASS_NAME + ".stopping", "977", this);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "beginStopping");
} | [
"private",
"void",
"beginStopping",
"(",
"boolean",
"application",
",",
"J2EEName",
"j2eeName",
",",
"Collection",
"<",
"EJBModuleMetaDataImpl",
">",
"modules",
")",
"{",
"// F743-26072",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"beginStopping: application=\"",
"+",
"application",
"+",
"\", \"",
"+",
"j2eeName",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"application",
")",
"{",
"// F743-26072",
"ivStopping",
"=",
"true",
";",
"}",
"// F743-15941 - If the application or fine-grained module start",
"// failed, then we never transitioned to \"fully started\". Unblock",
"// any threads that are waiting in checkIfEJBWorkAllowed.",
"//",
"// This call is within the synchronized block only to reduce",
"// monitor acquisition/release.",
"unblockThreadsWaitingForStart",
"(",
")",
";",
"}",
"if",
"(",
"j2eeName",
"!=",
"null",
")",
"{",
"// d589357 - Cancel non-persistent timers. We do not allow new",
"// non-persistent timers to be created after the application or",
"// module has begun stopping (e.g., during PreDestroy), so we also",
"// remove all existing timers before calling PreDestroy.",
"ivContainer",
".",
"getEJBRuntime",
"(",
")",
".",
"removeTimers",
"(",
"j2eeName",
")",
";",
"// F743-26072",
"}",
"if",
"(",
"ivSingletonInitializations",
"!=",
"null",
")",
"{",
"List",
"<",
"EJSHome",
">",
"reverse",
"=",
"new",
"ArrayList",
"<",
"EJSHome",
">",
"(",
"ivSingletonInitializations",
")",
";",
"for",
"(",
"int",
"i",
"=",
"reverse",
".",
"size",
"(",
")",
";",
"--",
"i",
">=",
"0",
";",
")",
"{",
"EJSHome",
"home",
"=",
"reverse",
".",
"get",
"(",
"i",
")",
";",
"J2EEName",
"homeJ2EEName",
"=",
"home",
".",
"getJ2EEName",
"(",
")",
";",
"if",
"(",
"application",
"||",
"(",
"j2eeName",
".",
"getModule",
"(",
")",
".",
"equals",
"(",
"homeJ2EEName",
".",
"getModule",
"(",
")",
")",
")",
")",
"{",
"home",
".",
"destroy",
"(",
")",
";",
"ivSingletonInitializations",
".",
"remove",
"(",
"home",
")",
";",
"}",
"}",
"}",
"try",
"{",
"notifyApplicationEventListeners",
"(",
"modules",
",",
"false",
")",
";",
"// F743-26072",
"}",
"catch",
"(",
"RuntimeWarning",
"rw",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"rw",
",",
"CLASS_NAME",
"+",
"\".stopping\"",
",",
"\"977\"",
",",
"this",
")",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"beginStopping\"",
")",
";",
"}"
] | Notification that the application or a module within the application will begin
stopping stopping. This method should never throw an exception.
@param application
<tt>true</tt> if the application is stopping
@param j2eeName
the J2EEName of the application or module, or <tt>null</tt> if application
is true and J2EEName is unavailable
@param modules
the list of modules being stopped | [
"Notification",
"that",
"the",
"application",
"or",
"a",
"module",
"within",
"the",
"application",
"will",
"begin",
"stopping",
"stopping",
".",
"This",
"method",
"should",
"never",
"throw",
"an",
"exception",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L1137-L1185 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.stoppingModule | public void stoppingModule(EJBModuleMetaDataImpl mmd) { // F743-26072
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "stoppingModule: " + mmd.getJ2EEName());
// If the application is stopping (rather than a single module), then
// we don't need to do anything special.
if (!ivStopping) {
mmd.ivStopping = true;
ivModules.remove(mmd);
try {
beginStopping(false, mmd.getJ2EEName(), Collections.singletonList(mmd));
} finally {
// If fine-grained module start failed, be sure to clear
// internal state.
ivSingletonDependencies = null;
ivStartupSingletonList = null;
ivQueuedNonPersistentTimers = null;
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "stoppingModule");
} | java | public void stoppingModule(EJBModuleMetaDataImpl mmd) { // F743-26072
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "stoppingModule: " + mmd.getJ2EEName());
// If the application is stopping (rather than a single module), then
// we don't need to do anything special.
if (!ivStopping) {
mmd.ivStopping = true;
ivModules.remove(mmd);
try {
beginStopping(false, mmd.getJ2EEName(), Collections.singletonList(mmd));
} finally {
// If fine-grained module start failed, be sure to clear
// internal state.
ivSingletonDependencies = null;
ivStartupSingletonList = null;
ivQueuedNonPersistentTimers = null;
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "stoppingModule");
} | [
"public",
"void",
"stoppingModule",
"(",
"EJBModuleMetaDataImpl",
"mmd",
")",
"{",
"// F743-26072",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"stoppingModule: \"",
"+",
"mmd",
".",
"getJ2EEName",
"(",
")",
")",
";",
"// If the application is stopping (rather than a single module), then",
"// we don't need to do anything special.",
"if",
"(",
"!",
"ivStopping",
")",
"{",
"mmd",
".",
"ivStopping",
"=",
"true",
";",
"ivModules",
".",
"remove",
"(",
"mmd",
")",
";",
"try",
"{",
"beginStopping",
"(",
"false",
",",
"mmd",
".",
"getJ2EEName",
"(",
")",
",",
"Collections",
".",
"singletonList",
"(",
"mmd",
")",
")",
";",
"}",
"finally",
"{",
"// If fine-grained module start failed, be sure to clear",
"// internal state.",
"ivSingletonDependencies",
"=",
"null",
";",
"ivStartupSingletonList",
"=",
"null",
";",
"ivQueuedNonPersistentTimers",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"stoppingModule\"",
")",
";",
"}"
] | Notification that a module within this application will begin stopping. This method
should never throw an exception.
@param mmd
the module | [
"Notification",
"that",
"a",
"module",
"within",
"this",
"application",
"will",
"begin",
"stopping",
".",
"This",
"method",
"should",
"never",
"throw",
"an",
"exception",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L1194-L1218 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.stopping | public void stopping() {
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "stopping");
J2EEName j2eeName = ivApplicationMetaData == null ? null : ivApplicationMetaData.getJ2EEName();
beginStopping(true, j2eeName, ivModules); // F743-26072
} | java | public void stopping() {
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "stopping");
J2EEName j2eeName = ivApplicationMetaData == null ? null : ivApplicationMetaData.getJ2EEName();
beginStopping(true, j2eeName, ivModules); // F743-26072
} | [
"public",
"void",
"stopping",
"(",
")",
"{",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"stopping\"",
")",
";",
"J2EEName",
"j2eeName",
"=",
"ivApplicationMetaData",
"==",
"null",
"?",
"null",
":",
"ivApplicationMetaData",
".",
"getJ2EEName",
"(",
")",
";",
"beginStopping",
"(",
"true",
",",
"j2eeName",
",",
"ivModules",
")",
";",
"// F743-26072",
"}"
] | Notification that the application will begin stopping. | [
"Notification",
"that",
"the",
"application",
"will",
"begin",
"stopping",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L1223-L1230 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.validateVersionedModuleBaseName | void validateVersionedModuleBaseName(String appBaseName, String modBaseName) {
for (EJBModuleMetaDataImpl ejbMMD : ivModules) {
String versionedAppBaseName = ejbMMD.ivVersionedAppBaseName;
if (versionedAppBaseName != null && !versionedAppBaseName.equals(appBaseName)) {
throw new IllegalArgumentException("appBaseName (" + appBaseName + ") does not equal previously set value : "
+ versionedAppBaseName);
}
if (modBaseName.equals(ejbMMD.ivVersionedModuleBaseName)) {
throw new IllegalArgumentException("duplicate baseName : " + modBaseName);
}
}
} | java | void validateVersionedModuleBaseName(String appBaseName, String modBaseName) {
for (EJBModuleMetaDataImpl ejbMMD : ivModules) {
String versionedAppBaseName = ejbMMD.ivVersionedAppBaseName;
if (versionedAppBaseName != null && !versionedAppBaseName.equals(appBaseName)) {
throw new IllegalArgumentException("appBaseName (" + appBaseName + ") does not equal previously set value : "
+ versionedAppBaseName);
}
if (modBaseName.equals(ejbMMD.ivVersionedModuleBaseName)) {
throw new IllegalArgumentException("duplicate baseName : " + modBaseName);
}
}
} | [
"void",
"validateVersionedModuleBaseName",
"(",
"String",
"appBaseName",
",",
"String",
"modBaseName",
")",
"{",
"for",
"(",
"EJBModuleMetaDataImpl",
"ejbMMD",
":",
"ivModules",
")",
"{",
"String",
"versionedAppBaseName",
"=",
"ejbMMD",
".",
"ivVersionedAppBaseName",
";",
"if",
"(",
"versionedAppBaseName",
"!=",
"null",
"&&",
"!",
"versionedAppBaseName",
".",
"equals",
"(",
"appBaseName",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"appBaseName (\"",
"+",
"appBaseName",
"+",
"\") does not equal previously set value : \"",
"+",
"versionedAppBaseName",
")",
";",
"}",
"if",
"(",
"modBaseName",
".",
"equals",
"(",
"ejbMMD",
".",
"ivVersionedModuleBaseName",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"duplicate baseName : \"",
"+",
"modBaseName",
")",
";",
"}",
"}",
"}"
] | F54184.1 F54184.2 | [
"F54184",
".",
"1",
"F54184",
".",
"2"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L1266-L1278 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaBrowserSession.java | SibRaBrowserSession.next | public SIBusMessage next() throws SISessionDroppedException, SIConnectionDroppedException, SISessionUnavailableException, SIConnectionUnavailableException, SIConnectionLostException, SINotAuthorizedException, SIResourceException, SIErrorException {
checkValid();
return _delegate.next();
} | java | public SIBusMessage next() throws SISessionDroppedException, SIConnectionDroppedException, SISessionUnavailableException, SIConnectionUnavailableException, SIConnectionLostException, SINotAuthorizedException, SIResourceException, SIErrorException {
checkValid();
return _delegate.next();
} | [
"public",
"SIBusMessage",
"next",
"(",
")",
"throws",
"SISessionDroppedException",
",",
"SIConnectionDroppedException",
",",
"SISessionUnavailableException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionLostException",
",",
"SINotAuthorizedException",
",",
"SIResourceException",
",",
"SIErrorException",
"{",
"checkValid",
"(",
")",
";",
"return",
"_delegate",
".",
"next",
"(",
")",
";",
"}"
] | Browses the next message. Checks that the session is valid and then
delegates.
@throws SIConnectionUnavailableException
if the session is not valid
@throws SIErrorException
if the delegation fails
@throws SIResourceException
if the delegation fails
@throws SINotAuthorizedException
if the delegation fails
@throws SIConnectionLostException
if the delegation fails
@throws SISessionUnavailableException
if the delegation fails
@throws SIConnectionDroppedException
if the delegation fails
@throws SISessionDroppedException
if the delegation fails | [
"Browses",
"the",
"next",
"message",
".",
"Checks",
"that",
"the",
"session",
"is",
"valid",
"and",
"then",
"delegates",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaBrowserSession.java#L95-L101 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaBrowserSession.java | SibRaBrowserSession.reset | public void reset() throws SISessionDroppedException, SIConnectionDroppedException, SISessionUnavailableException, SIConnectionUnavailableException, SIConnectionLostException, SIResourceException, SIErrorException {
checkValid();
_delegate.reset();
} | java | public void reset() throws SISessionDroppedException, SIConnectionDroppedException, SISessionUnavailableException, SIConnectionUnavailableException, SIConnectionLostException, SIResourceException, SIErrorException {
checkValid();
_delegate.reset();
} | [
"public",
"void",
"reset",
"(",
")",
"throws",
"SISessionDroppedException",
",",
"SIConnectionDroppedException",
",",
"SISessionUnavailableException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionLostException",
",",
"SIResourceException",
",",
"SIErrorException",
"{",
"checkValid",
"(",
")",
";",
"_delegate",
".",
"reset",
"(",
")",
";",
"}"
] | Resets the browse cursor. Checks that the session is valid and then
delegates.
@throws SIConnectionUnavailableException
if the session is not valid
@throws SIErrorException
if the delegation fails
@throws SIResourceException
if the delegation fails
@throws SIConnectionLostException
if the delegation fails
@throws SISessionUnavailableException
if the delegation fails
@throws SIConnectionDroppedException
if the delegation fails
@throws SISessionDroppedException
if the delegation fails | [
"Resets",
"the",
"browse",
"cursor",
".",
"Checks",
"that",
"the",
"session",
"is",
"valid",
"and",
"then",
"delegates",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaBrowserSession.java#L122-L128 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.remote.portable.core/src/com/ibm/ws/ejb/portable/EJBMetaDataImpl.java | EJBMetaDataImpl.writeObject | private void writeObject(ObjectOutputStream out) throws IOException
{
try
{
out.defaultWriteObject();
// p113380 - start of change
// write out the header information
out.write(EYECATCHER);
out.writeShort(PLATFORM);
out.writeShort(VERSION_ID);
// p113380 - end of change
// write out the common data
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject: ivSession = " + ivSession);
}
out.writeBoolean(ivSession);
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject: ivStatelessSession = " + ivStatelessSession);
}
out.writeBoolean(ivStatelessSession);
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject: ivBeanClass is " + ivBeanClassName);//184994
}
out.writeUTF(ivBeanClassName);//184994
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject: ivHomeClass is " + ivHomeClass.getName());
}
out.writeUTF(ivHomeClass.getName());
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject: ivRemoteClass is " + ivRemoteClass.getName());
}
out.writeUTF(ivRemoteClass.getName());
if (ivSession == false)
{
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject: ivPKClass is " + ivPKClass.getName());
}
out.writeUTF(ivPKClass.getName());
}
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject: writing HomeHandle");
}
out.writeObject(ivHomeHandle);
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject normal exit");
}
} catch (IOException e)
{
// FFDCFilter.processException(e, CLASS_NAME + ".writeObject", "439", this);
if (DEBUG_ON)
{
System.out.println("***ERROR**** EJBMetaDataImpl.readObject caught unexpected exception");
e.printStackTrace();
}
throw e;
}
} | java | private void writeObject(ObjectOutputStream out) throws IOException
{
try
{
out.defaultWriteObject();
// p113380 - start of change
// write out the header information
out.write(EYECATCHER);
out.writeShort(PLATFORM);
out.writeShort(VERSION_ID);
// p113380 - end of change
// write out the common data
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject: ivSession = " + ivSession);
}
out.writeBoolean(ivSession);
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject: ivStatelessSession = " + ivStatelessSession);
}
out.writeBoolean(ivStatelessSession);
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject: ivBeanClass is " + ivBeanClassName);//184994
}
out.writeUTF(ivBeanClassName);//184994
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject: ivHomeClass is " + ivHomeClass.getName());
}
out.writeUTF(ivHomeClass.getName());
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject: ivRemoteClass is " + ivRemoteClass.getName());
}
out.writeUTF(ivRemoteClass.getName());
if (ivSession == false)
{
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject: ivPKClass is " + ivPKClass.getName());
}
out.writeUTF(ivPKClass.getName());
}
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject: writing HomeHandle");
}
out.writeObject(ivHomeHandle);
if (DEBUG_ON)
{
System.out.println("EJBMetaDataImpl.writeObject normal exit");
}
} catch (IOException e)
{
// FFDCFilter.processException(e, CLASS_NAME + ".writeObject", "439", this);
if (DEBUG_ON)
{
System.out.println("***ERROR**** EJBMetaDataImpl.readObject caught unexpected exception");
e.printStackTrace();
}
throw e;
}
} | [
"private",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"try",
"{",
"out",
".",
"defaultWriteObject",
"(",
")",
";",
"// p113380 - start of change",
"// write out the header information",
"out",
".",
"write",
"(",
"EYECATCHER",
")",
";",
"out",
".",
"writeShort",
"(",
"PLATFORM",
")",
";",
"out",
".",
"writeShort",
"(",
"VERSION_ID",
")",
";",
"// p113380 - end of change",
"// write out the common data",
"if",
"(",
"DEBUG_ON",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"EJBMetaDataImpl.writeObject: ivSession = \"",
"+",
"ivSession",
")",
";",
"}",
"out",
".",
"writeBoolean",
"(",
"ivSession",
")",
";",
"if",
"(",
"DEBUG_ON",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"EJBMetaDataImpl.writeObject: ivStatelessSession = \"",
"+",
"ivStatelessSession",
")",
";",
"}",
"out",
".",
"writeBoolean",
"(",
"ivStatelessSession",
")",
";",
"if",
"(",
"DEBUG_ON",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"EJBMetaDataImpl.writeObject: ivBeanClass is \"",
"+",
"ivBeanClassName",
")",
";",
"//184994",
"}",
"out",
".",
"writeUTF",
"(",
"ivBeanClassName",
")",
";",
"//184994",
"if",
"(",
"DEBUG_ON",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"EJBMetaDataImpl.writeObject: ivHomeClass is \"",
"+",
"ivHomeClass",
".",
"getName",
"(",
")",
")",
";",
"}",
"out",
".",
"writeUTF",
"(",
"ivHomeClass",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"DEBUG_ON",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"EJBMetaDataImpl.writeObject: ivRemoteClass is \"",
"+",
"ivRemoteClass",
".",
"getName",
"(",
")",
")",
";",
"}",
"out",
".",
"writeUTF",
"(",
"ivRemoteClass",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"ivSession",
"==",
"false",
")",
"{",
"if",
"(",
"DEBUG_ON",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"EJBMetaDataImpl.writeObject: ivPKClass is \"",
"+",
"ivPKClass",
".",
"getName",
"(",
")",
")",
";",
"}",
"out",
".",
"writeUTF",
"(",
"ivPKClass",
".",
"getName",
"(",
")",
")",
";",
"}",
"if",
"(",
"DEBUG_ON",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"EJBMetaDataImpl.writeObject: writing HomeHandle\"",
")",
";",
"}",
"out",
".",
"writeObject",
"(",
"ivHomeHandle",
")",
";",
"if",
"(",
"DEBUG_ON",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"EJBMetaDataImpl.writeObject normal exit\"",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// FFDCFilter.processException(e, CLASS_NAME + \".writeObject\", \"439\", this);",
"if",
"(",
"DEBUG_ON",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"***ERROR**** EJBMetaDataImpl.readObject caught unexpected exception\"",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"throw",
"e",
";",
"}",
"}"
] | We will implement writeObject in order to controll
the marshalling for this object.
Note, this is overriding the default implementation of
the Serializable interface.
@see java.io.Serializable | [
"We",
"will",
"implement",
"writeObject",
"in",
"order",
"to",
"controll",
"the",
"marshalling",
"for",
"this",
"object",
".",
"Note",
"this",
"is",
"overriding",
"the",
"default",
"implementation",
"of",
"the",
"Serializable",
"interface",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.remote.portable.core/src/com/ibm/ws/ejb/portable/EJBMetaDataImpl.java#L381-L454 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/JFapChannelConstants.java | JFapChannelConstants.segmentToLayout | public static TransmissionLayout segmentToLayout(int segment)
{
TransmissionLayout layout = XMIT_LAYOUT_UNKNOWN;
switch (segment)
{
case 0x00:
layout = XMIT_LAYOUT_UNKNOWN;
break;
case JFapChannelConstants.SEGMENT_HEARTBEAT:
case JFapChannelConstants.SEGMENT_HEARTBEAT_RESPONSE:
case JFapChannelConstants.SEGMENT_PHYSICAL_CLOSE:
layout = XMIT_PRIMARY_ONLY;
break;
case JFapChannelConstants.SEGMENT_SEGMENTED_FLOW_START:
layout = XMIT_SEGMENT_START;
break;
case JFapChannelConstants.SEGMENT_SEGMENTED_FLOW_MIDDLE:
layout = XMIT_SEGMENT_MIDDLE;
break;
case JFapChannelConstants.SEGMENT_SEGMENTED_FLOW_END:
layout = XMIT_SEGMENT_END;
break;
default:
// Assume a conversation layout by default.
layout = XMIT_CONVERSATION;
break;
}
return layout;
} | java | public static TransmissionLayout segmentToLayout(int segment)
{
TransmissionLayout layout = XMIT_LAYOUT_UNKNOWN;
switch (segment)
{
case 0x00:
layout = XMIT_LAYOUT_UNKNOWN;
break;
case JFapChannelConstants.SEGMENT_HEARTBEAT:
case JFapChannelConstants.SEGMENT_HEARTBEAT_RESPONSE:
case JFapChannelConstants.SEGMENT_PHYSICAL_CLOSE:
layout = XMIT_PRIMARY_ONLY;
break;
case JFapChannelConstants.SEGMENT_SEGMENTED_FLOW_START:
layout = XMIT_SEGMENT_START;
break;
case JFapChannelConstants.SEGMENT_SEGMENTED_FLOW_MIDDLE:
layout = XMIT_SEGMENT_MIDDLE;
break;
case JFapChannelConstants.SEGMENT_SEGMENTED_FLOW_END:
layout = XMIT_SEGMENT_END;
break;
default:
// Assume a conversation layout by default.
layout = XMIT_CONVERSATION;
break;
}
return layout;
} | [
"public",
"static",
"TransmissionLayout",
"segmentToLayout",
"(",
"int",
"segment",
")",
"{",
"TransmissionLayout",
"layout",
"=",
"XMIT_LAYOUT_UNKNOWN",
";",
"switch",
"(",
"segment",
")",
"{",
"case",
"0x00",
":",
"layout",
"=",
"XMIT_LAYOUT_UNKNOWN",
";",
"break",
";",
"case",
"JFapChannelConstants",
".",
"SEGMENT_HEARTBEAT",
":",
"case",
"JFapChannelConstants",
".",
"SEGMENT_HEARTBEAT_RESPONSE",
":",
"case",
"JFapChannelConstants",
".",
"SEGMENT_PHYSICAL_CLOSE",
":",
"layout",
"=",
"XMIT_PRIMARY_ONLY",
";",
"break",
";",
"case",
"JFapChannelConstants",
".",
"SEGMENT_SEGMENTED_FLOW_START",
":",
"layout",
"=",
"XMIT_SEGMENT_START",
";",
"break",
";",
"case",
"JFapChannelConstants",
".",
"SEGMENT_SEGMENTED_FLOW_MIDDLE",
":",
"layout",
"=",
"XMIT_SEGMENT_MIDDLE",
";",
"break",
";",
"case",
"JFapChannelConstants",
".",
"SEGMENT_SEGMENTED_FLOW_END",
":",
"layout",
"=",
"XMIT_SEGMENT_END",
";",
"break",
";",
"default",
":",
"// Assume a conversation layout by default.",
"layout",
"=",
"XMIT_CONVERSATION",
";",
"break",
";",
"}",
"return",
"layout",
";",
"}"
] | Converts from a segment ID to a layout for the transmission.
@param segment
@return Returns the layout for the segment. | [
"Converts",
"from",
"a",
"segment",
"ID",
"to",
"a",
"layout",
"for",
"the",
"transmission",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/JFapChannelConstants.java#L353-L381 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/JFapChannelConstants.java | JFapChannelConstants.getSegmentName | public static String getSegmentName(int segmentType)
{
String segmentName = "(Unknown segment type)";
segmentName = segValues.get(segmentType);
if (segmentName == null)
segmentName = "(Unknown segment type)";
return segmentName;
} | java | public static String getSegmentName(int segmentType)
{
String segmentName = "(Unknown segment type)";
segmentName = segValues.get(segmentType);
if (segmentName == null)
segmentName = "(Unknown segment type)";
return segmentName;
} | [
"public",
"static",
"String",
"getSegmentName",
"(",
"int",
"segmentType",
")",
"{",
"String",
"segmentName",
"=",
"\"(Unknown segment type)\"",
";",
"segmentName",
"=",
"segValues",
".",
"get",
"(",
"segmentType",
")",
";",
"if",
"(",
"segmentName",
"==",
"null",
")",
"segmentName",
"=",
"\"(Unknown segment type)\"",
";",
"return",
"segmentName",
";",
"}"
] | This method can be used to return the actual segment
name for a given segment type.
@param segmentType The segment number.
@return Returns the String name of this segment. | [
"This",
"method",
"can",
"be",
"used",
"to",
"return",
"the",
"actual",
"segment",
"name",
"for",
"a",
"given",
"segment",
"type",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/JFapChannelConstants.java#L749-L759 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigUpdater.java | ConfigUpdater.updateConfiguration | private boolean updateConfiguration(EvaluationResult result, ConfigurationInfo info, Collection<ConfigurationInfo> infos,
boolean encourageUpdates) throws ConfigUpdateException {
//encourageUpdates is overruled by metatype declining nested notifications.
encourageUpdates &= !!!(result.getRegistryEntry() != null && result.getRegistryEntry().supportsHiddenExtensions());
// nestedUpdates is true if there are any updates to child elements that are not hidden
boolean nestedUpdates = false;
// propertiesUpdated is true if the properties of this configuration are updated
boolean propertiesUpdated = false;
// process nested configuration first
Map<ConfigID, EvaluationResult> nested = result.getNested();
for (Map.Entry<ConfigID, EvaluationResult> entry : nested.entrySet()) {
EvaluationResult nestedResult = entry.getValue();
ExtendedConfiguration nestedConfig = caSupport.findConfiguration(nestedResult.getPid());
if (nestedConfig == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Configuration not found: " + nestedResult.getPid());
}
} else {
ConfigurationInfo nestedInfo = new ConfigurationInfo(nestedResult.getConfigElement(), nestedConfig, nestedResult.getRegistryEntry(), false);
// updated will be true if there was a nested properties update
boolean updated = updateConfiguration(nestedResult, nestedInfo, infos, encourageUpdates);
// If the nested update should be hidden, set updated to false so that it won't appear as a child properties update
if (updated && (result.getRegistryEntry() != null && result.getRegistryEntry().supportsHiddenExtensions())) {
updated = false;
}
// If updated is true, set nestedUpdates to true to signify that there are unhidden nested updates
nestedUpdates |= updated;
}
}
ExtendedConfiguration config = info.config;
// update configuration on disk
config.setInOverridesFile(true);
Set<ConfigID> oldReferences = config.getReferences();
Set<ConfigID> newReferences = result.getReferences();
Dictionary<String, Object> oldProperties = config.getReadOnlyProperties();
Dictionary<String, Object> newProperties = result.getProperties();
// Update the cache if either the properties have changed or if there was a nested, non-hidden update.
// We force the update when there are nested updates because DS will not process an event unless the
// change count is updated. This keeps DS behavior in sync with MS/MSF behavior with nested updates.
if (encourageUpdates || nestedUpdates || !equalConfigProperties(oldProperties, newProperties, encourageUpdates) ||
!equalConfigReferences(oldReferences, newReferences)) {
propertiesUpdated = true;
crossReference(oldProperties, newProperties);
variableRegistry.updateVariableCache(result.getVariables());
Dictionary<String, Object> newProp = massageNewConfig(oldProperties, newProperties);
Set<String> newUniques = updateUniqueVariables(info, oldProperties, newProp);
try {
config.updateCache(newProp, newReferences, newUniques);
} catch (IOException ex) {
throw new ConfigUpdateException(ex);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Updated configuration: " + toTraceString(config, result.getConfigElement()));
}
// (1) If there are unhidden nested updates of any kind, add the config info
// (2) If this element has its properties updated, add the config info
//
if (infos != null) {
infos.add(info);
}
}
// Create supertype config if necessary
extendedMetatypeManager.createSuperTypes(info);
// Return a boolean to indicate whether we updated anything here
return (propertiesUpdated || nestedUpdates);
} | java | private boolean updateConfiguration(EvaluationResult result, ConfigurationInfo info, Collection<ConfigurationInfo> infos,
boolean encourageUpdates) throws ConfigUpdateException {
//encourageUpdates is overruled by metatype declining nested notifications.
encourageUpdates &= !!!(result.getRegistryEntry() != null && result.getRegistryEntry().supportsHiddenExtensions());
// nestedUpdates is true if there are any updates to child elements that are not hidden
boolean nestedUpdates = false;
// propertiesUpdated is true if the properties of this configuration are updated
boolean propertiesUpdated = false;
// process nested configuration first
Map<ConfigID, EvaluationResult> nested = result.getNested();
for (Map.Entry<ConfigID, EvaluationResult> entry : nested.entrySet()) {
EvaluationResult nestedResult = entry.getValue();
ExtendedConfiguration nestedConfig = caSupport.findConfiguration(nestedResult.getPid());
if (nestedConfig == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Configuration not found: " + nestedResult.getPid());
}
} else {
ConfigurationInfo nestedInfo = new ConfigurationInfo(nestedResult.getConfigElement(), nestedConfig, nestedResult.getRegistryEntry(), false);
// updated will be true if there was a nested properties update
boolean updated = updateConfiguration(nestedResult, nestedInfo, infos, encourageUpdates);
// If the nested update should be hidden, set updated to false so that it won't appear as a child properties update
if (updated && (result.getRegistryEntry() != null && result.getRegistryEntry().supportsHiddenExtensions())) {
updated = false;
}
// If updated is true, set nestedUpdates to true to signify that there are unhidden nested updates
nestedUpdates |= updated;
}
}
ExtendedConfiguration config = info.config;
// update configuration on disk
config.setInOverridesFile(true);
Set<ConfigID> oldReferences = config.getReferences();
Set<ConfigID> newReferences = result.getReferences();
Dictionary<String, Object> oldProperties = config.getReadOnlyProperties();
Dictionary<String, Object> newProperties = result.getProperties();
// Update the cache if either the properties have changed or if there was a nested, non-hidden update.
// We force the update when there are nested updates because DS will not process an event unless the
// change count is updated. This keeps DS behavior in sync with MS/MSF behavior with nested updates.
if (encourageUpdates || nestedUpdates || !equalConfigProperties(oldProperties, newProperties, encourageUpdates) ||
!equalConfigReferences(oldReferences, newReferences)) {
propertiesUpdated = true;
crossReference(oldProperties, newProperties);
variableRegistry.updateVariableCache(result.getVariables());
Dictionary<String, Object> newProp = massageNewConfig(oldProperties, newProperties);
Set<String> newUniques = updateUniqueVariables(info, oldProperties, newProp);
try {
config.updateCache(newProp, newReferences, newUniques);
} catch (IOException ex) {
throw new ConfigUpdateException(ex);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Updated configuration: " + toTraceString(config, result.getConfigElement()));
}
// (1) If there are unhidden nested updates of any kind, add the config info
// (2) If this element has its properties updated, add the config info
//
if (infos != null) {
infos.add(info);
}
}
// Create supertype config if necessary
extendedMetatypeManager.createSuperTypes(info);
// Return a boolean to indicate whether we updated anything here
return (propertiesUpdated || nestedUpdates);
} | [
"private",
"boolean",
"updateConfiguration",
"(",
"EvaluationResult",
"result",
",",
"ConfigurationInfo",
"info",
",",
"Collection",
"<",
"ConfigurationInfo",
">",
"infos",
",",
"boolean",
"encourageUpdates",
")",
"throws",
"ConfigUpdateException",
"{",
"//encourageUpdates is overruled by metatype declining nested notifications.",
"encourageUpdates",
"&=",
"!",
"!",
"!",
"(",
"result",
".",
"getRegistryEntry",
"(",
")",
"!=",
"null",
"&&",
"result",
".",
"getRegistryEntry",
"(",
")",
".",
"supportsHiddenExtensions",
"(",
")",
")",
";",
"// nestedUpdates is true if there are any updates to child elements that are not hidden",
"boolean",
"nestedUpdates",
"=",
"false",
";",
"// propertiesUpdated is true if the properties of this configuration are updated",
"boolean",
"propertiesUpdated",
"=",
"false",
";",
"// process nested configuration first",
"Map",
"<",
"ConfigID",
",",
"EvaluationResult",
">",
"nested",
"=",
"result",
".",
"getNested",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"ConfigID",
",",
"EvaluationResult",
">",
"entry",
":",
"nested",
".",
"entrySet",
"(",
")",
")",
"{",
"EvaluationResult",
"nestedResult",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"ExtendedConfiguration",
"nestedConfig",
"=",
"caSupport",
".",
"findConfiguration",
"(",
"nestedResult",
".",
"getPid",
"(",
")",
")",
";",
"if",
"(",
"nestedConfig",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Configuration not found: \"",
"+",
"nestedResult",
".",
"getPid",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"ConfigurationInfo",
"nestedInfo",
"=",
"new",
"ConfigurationInfo",
"(",
"nestedResult",
".",
"getConfigElement",
"(",
")",
",",
"nestedConfig",
",",
"nestedResult",
".",
"getRegistryEntry",
"(",
")",
",",
"false",
")",
";",
"// updated will be true if there was a nested properties update",
"boolean",
"updated",
"=",
"updateConfiguration",
"(",
"nestedResult",
",",
"nestedInfo",
",",
"infos",
",",
"encourageUpdates",
")",
";",
"// If the nested update should be hidden, set updated to false so that it won't appear as a child properties update",
"if",
"(",
"updated",
"&&",
"(",
"result",
".",
"getRegistryEntry",
"(",
")",
"!=",
"null",
"&&",
"result",
".",
"getRegistryEntry",
"(",
")",
".",
"supportsHiddenExtensions",
"(",
")",
")",
")",
"{",
"updated",
"=",
"false",
";",
"}",
"// If updated is true, set nestedUpdates to true to signify that there are unhidden nested updates",
"nestedUpdates",
"|=",
"updated",
";",
"}",
"}",
"ExtendedConfiguration",
"config",
"=",
"info",
".",
"config",
";",
"// update configuration on disk",
"config",
".",
"setInOverridesFile",
"(",
"true",
")",
";",
"Set",
"<",
"ConfigID",
">",
"oldReferences",
"=",
"config",
".",
"getReferences",
"(",
")",
";",
"Set",
"<",
"ConfigID",
">",
"newReferences",
"=",
"result",
".",
"getReferences",
"(",
")",
";",
"Dictionary",
"<",
"String",
",",
"Object",
">",
"oldProperties",
"=",
"config",
".",
"getReadOnlyProperties",
"(",
")",
";",
"Dictionary",
"<",
"String",
",",
"Object",
">",
"newProperties",
"=",
"result",
".",
"getProperties",
"(",
")",
";",
"// Update the cache if either the properties have changed or if there was a nested, non-hidden update.",
"// We force the update when there are nested updates because DS will not process an event unless the",
"// change count is updated. This keeps DS behavior in sync with MS/MSF behavior with nested updates.",
"if",
"(",
"encourageUpdates",
"||",
"nestedUpdates",
"||",
"!",
"equalConfigProperties",
"(",
"oldProperties",
",",
"newProperties",
",",
"encourageUpdates",
")",
"||",
"!",
"equalConfigReferences",
"(",
"oldReferences",
",",
"newReferences",
")",
")",
"{",
"propertiesUpdated",
"=",
"true",
";",
"crossReference",
"(",
"oldProperties",
",",
"newProperties",
")",
";",
"variableRegistry",
".",
"updateVariableCache",
"(",
"result",
".",
"getVariables",
"(",
")",
")",
";",
"Dictionary",
"<",
"String",
",",
"Object",
">",
"newProp",
"=",
"massageNewConfig",
"(",
"oldProperties",
",",
"newProperties",
")",
";",
"Set",
"<",
"String",
">",
"newUniques",
"=",
"updateUniqueVariables",
"(",
"info",
",",
"oldProperties",
",",
"newProp",
")",
";",
"try",
"{",
"config",
".",
"updateCache",
"(",
"newProp",
",",
"newReferences",
",",
"newUniques",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"ConfigUpdateException",
"(",
"ex",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Updated configuration: \"",
"+",
"toTraceString",
"(",
"config",
",",
"result",
".",
"getConfigElement",
"(",
")",
")",
")",
";",
"}",
"// (1) If there are unhidden nested updates of any kind, add the config info",
"// (2) If this element has its properties updated, add the config info",
"//",
"if",
"(",
"infos",
"!=",
"null",
")",
"{",
"infos",
".",
"add",
"(",
"info",
")",
";",
"}",
"}",
"// Create supertype config if necessary",
"extendedMetatypeManager",
".",
"createSuperTypes",
"(",
"info",
")",
";",
"// Return a boolean to indicate whether we updated anything here",
"return",
"(",
"propertiesUpdated",
"||",
"nestedUpdates",
")",
";",
"}"
] | Recursively updates the configuration in config admin
@param encourageUpdates whether to update the configuration if not discouraged in metatype even with no nested or property updates.
@return true if there were any updates to this element or any nested, unhidden elements or updates encouraged and not hidden. | [
"Recursively",
"updates",
"the",
"configuration",
"in",
"config",
"admin"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigUpdater.java#L206-L287 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigUpdater.java | ConfigUpdater.massageNewConfig | private static Dictionary<String, Object> massageNewConfig(Dictionary<String, Object> oldProps, Dictionary<String, Object> newProps) {
ConfigurationDictionary ret = new ConfigurationDictionary();
if (oldProps != null) {
for (Enumeration<String> keyItr = oldProps.keys(); keyItr.hasMoreElements();) {
String key = keyItr.nextElement();
if (((key.startsWith(XMLConfigConstants.CFG_CONFIG_PREFIX) && !(key.equals(XMLConfigConstants.CFG_PARENT_PID)))
|| key.startsWith(XMLConfigConstants.CFG_SERVICE_PREFIX))) {
ret.put(key, oldProps.get(key));
}
}
}
if (newProps != null) {
for (Enumeration<String> keyItr = newProps.keys(); keyItr.hasMoreElements();) {
String key = keyItr.nextElement();
ret.put(key, newProps.get(key));
}
}
if (ret.isEmpty()) {
ret = null;
} else {
// must add config.source, else things may not process properly
ret.put(XMLConfigConstants.CFG_CONFIG_SOURCE, XMLConfigConstants.CFG_CONFIG_SOURCE_FILE);
}
return ret;
} | java | private static Dictionary<String, Object> massageNewConfig(Dictionary<String, Object> oldProps, Dictionary<String, Object> newProps) {
ConfigurationDictionary ret = new ConfigurationDictionary();
if (oldProps != null) {
for (Enumeration<String> keyItr = oldProps.keys(); keyItr.hasMoreElements();) {
String key = keyItr.nextElement();
if (((key.startsWith(XMLConfigConstants.CFG_CONFIG_PREFIX) && !(key.equals(XMLConfigConstants.CFG_PARENT_PID)))
|| key.startsWith(XMLConfigConstants.CFG_SERVICE_PREFIX))) {
ret.put(key, oldProps.get(key));
}
}
}
if (newProps != null) {
for (Enumeration<String> keyItr = newProps.keys(); keyItr.hasMoreElements();) {
String key = keyItr.nextElement();
ret.put(key, newProps.get(key));
}
}
if (ret.isEmpty()) {
ret = null;
} else {
// must add config.source, else things may not process properly
ret.put(XMLConfigConstants.CFG_CONFIG_SOURCE, XMLConfigConstants.CFG_CONFIG_SOURCE_FILE);
}
return ret;
} | [
"private",
"static",
"Dictionary",
"<",
"String",
",",
"Object",
">",
"massageNewConfig",
"(",
"Dictionary",
"<",
"String",
",",
"Object",
">",
"oldProps",
",",
"Dictionary",
"<",
"String",
",",
"Object",
">",
"newProps",
")",
"{",
"ConfigurationDictionary",
"ret",
"=",
"new",
"ConfigurationDictionary",
"(",
")",
";",
"if",
"(",
"oldProps",
"!=",
"null",
")",
"{",
"for",
"(",
"Enumeration",
"<",
"String",
">",
"keyItr",
"=",
"oldProps",
".",
"keys",
"(",
")",
";",
"keyItr",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"String",
"key",
"=",
"keyItr",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"(",
"(",
"key",
".",
"startsWith",
"(",
"XMLConfigConstants",
".",
"CFG_CONFIG_PREFIX",
")",
"&&",
"!",
"(",
"key",
".",
"equals",
"(",
"XMLConfigConstants",
".",
"CFG_PARENT_PID",
")",
")",
")",
"||",
"key",
".",
"startsWith",
"(",
"XMLConfigConstants",
".",
"CFG_SERVICE_PREFIX",
")",
")",
")",
"{",
"ret",
".",
"put",
"(",
"key",
",",
"oldProps",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"}",
"}",
"if",
"(",
"newProps",
"!=",
"null",
")",
"{",
"for",
"(",
"Enumeration",
"<",
"String",
">",
"keyItr",
"=",
"newProps",
".",
"keys",
"(",
")",
";",
"keyItr",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"String",
"key",
"=",
"keyItr",
".",
"nextElement",
"(",
")",
";",
"ret",
".",
"put",
"(",
"key",
",",
"newProps",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"}",
"if",
"(",
"ret",
".",
"isEmpty",
"(",
")",
")",
"{",
"ret",
"=",
"null",
";",
"}",
"else",
"{",
"// must add config.source, else things may not process properly",
"ret",
".",
"put",
"(",
"XMLConfigConstants",
".",
"CFG_CONFIG_SOURCE",
",",
"XMLConfigConstants",
".",
"CFG_CONFIG_SOURCE_FILE",
")",
";",
"}",
"return",
"ret",
";",
"}"
] | Return a new config dictionary with initial "hidden" keys and values from
o,
then add all keys and values from n to the new config dictionary and
return.
If returning dictionary is empty, return null instead.
@param o
@param n
@return Dictionary | [
"Return",
"a",
"new",
"config",
"dictionary",
"with",
"initial",
"hidden",
"keys",
"and",
"values",
"from",
"o",
"then",
"add",
"all",
"keys",
"and",
"values",
"from",
"n",
"to",
"the",
"new",
"config",
"dictionary",
"and",
"return",
".",
"If",
"returning",
"dictionary",
"is",
"empty",
"return",
"null",
"instead",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigUpdater.java#L300-L328 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/buffer/impl/RichByteBufferImpl.java | RichByteBufferImpl.reset | void reset(com.ibm.wsspi.bytebuffer.WsByteBuffer buff, RichByteBufferPool p)
{
this.buffer = buff;
this.pool = p;
} | java | void reset(com.ibm.wsspi.bytebuffer.WsByteBuffer buff, RichByteBufferPool p)
{
this.buffer = buff;
this.pool = p;
} | [
"void",
"reset",
"(",
"com",
".",
"ibm",
".",
"wsspi",
".",
"bytebuffer",
".",
"WsByteBuffer",
"buff",
",",
"RichByteBufferPool",
"p",
")",
"{",
"this",
".",
"buffer",
"=",
"buff",
";",
"this",
".",
"pool",
"=",
"p",
";",
"}"
] | Resets the buffer with a new underlying buffer.
@param buff
@param p | [
"Resets",
"the",
"buffer",
"with",
"a",
"new",
"underlying",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/buffer/impl/RichByteBufferImpl.java#L42-L46 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/impl/FutureShell.java | FutureShell.setDelegate | public synchronized void setDelegate(Future<V> delegate) {
if (delegateHolder.isCancelled()) {
delegate.cancel(mayInterruptWhenCancellingDelegate);
} else {
this.delegate = delegate;
delegateHolder.complete(delegate);
}
} | java | public synchronized void setDelegate(Future<V> delegate) {
if (delegateHolder.isCancelled()) {
delegate.cancel(mayInterruptWhenCancellingDelegate);
} else {
this.delegate = delegate;
delegateHolder.complete(delegate);
}
} | [
"public",
"synchronized",
"void",
"setDelegate",
"(",
"Future",
"<",
"V",
">",
"delegate",
")",
"{",
"if",
"(",
"delegateHolder",
".",
"isCancelled",
"(",
")",
")",
"{",
"delegate",
".",
"cancel",
"(",
"mayInterruptWhenCancellingDelegate",
")",
";",
"}",
"else",
"{",
"this",
".",
"delegate",
"=",
"delegate",
";",
"delegateHolder",
".",
"complete",
"(",
"delegate",
")",
";",
"}",
"}"
] | Set the Future to delegate calls to
@param delegate the delegate future | [
"Set",
"the",
"Future",
"to",
"delegate",
"calls",
"to"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/impl/FutureShell.java#L57-L64 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security/src/com/ibm/ws/security/authentication/utility/SubjectHelper.java | SubjectHelper.isUnauthenticated | public boolean isUnauthenticated(Subject subject) {
if (subject == null) {
return true;
}
WSCredential wsCred = getWSCredential(subject);
if (wsCred == null) {
return true;
} else {
return wsCred.isUnauthenticated();
}
} | java | public boolean isUnauthenticated(Subject subject) {
if (subject == null) {
return true;
}
WSCredential wsCred = getWSCredential(subject);
if (wsCred == null) {
return true;
} else {
return wsCred.isUnauthenticated();
}
} | [
"public",
"boolean",
"isUnauthenticated",
"(",
"Subject",
"subject",
")",
"{",
"if",
"(",
"subject",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"WSCredential",
"wsCred",
"=",
"getWSCredential",
"(",
"subject",
")",
";",
"if",
"(",
"wsCred",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"wsCred",
".",
"isUnauthenticated",
"(",
")",
";",
"}",
"}"
] | Check whether the subject is un-authenticated or not.
@param subject {@code null} is supported.
@return Returns {@code true} if the Subject is either null
or the UNAUTHENTICATED Subject. {@code false} otherwise. | [
"Check",
"whether",
"the",
"subject",
"is",
"un",
"-",
"authenticated",
"or",
"not",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/ws/security/authentication/utility/SubjectHelper.java#L47-L58 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security/src/com/ibm/ws/security/authentication/utility/SubjectHelper.java | SubjectHelper.getRealm | public String getRealm(Subject subject) throws Exception {
String realm = null;
WSCredential credential = getWSCredential(subject);
if (credential != null) {
realm = credential.getRealmName();
}
return realm;
} | java | public String getRealm(Subject subject) throws Exception {
String realm = null;
WSCredential credential = getWSCredential(subject);
if (credential != null) {
realm = credential.getRealmName();
}
return realm;
} | [
"public",
"String",
"getRealm",
"(",
"Subject",
"subject",
")",
"throws",
"Exception",
"{",
"String",
"realm",
"=",
"null",
";",
"WSCredential",
"credential",
"=",
"getWSCredential",
"(",
"subject",
")",
";",
"if",
"(",
"credential",
"!=",
"null",
")",
"{",
"realm",
"=",
"credential",
".",
"getRealmName",
"(",
")",
";",
"}",
"return",
"realm",
";",
"}"
] | Gets the realm from the subjects' WSCredential.
@param subject {@code null} is not supported.
@return | [
"Gets",
"the",
"realm",
"from",
"the",
"subjects",
"WSCredential",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/ws/security/authentication/utility/SubjectHelper.java#L66-L73 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security/src/com/ibm/ws/security/authentication/utility/SubjectHelper.java | SubjectHelper.getGSSCredentialFromSubject | public static GSSCredential getGSSCredentialFromSubject(final Subject subject) {
if (subject == null) {
return null;
}
GSSCredential gssCredential = AccessController.doPrivileged(new PrivilegedAction<GSSCredential>() {
@Override
public GSSCredential run() {
GSSCredential gssCredInSubject = null;
Set<GSSCredential> privCredentials = subject.getPrivateCredentials(GSSCredential.class);
if (privCredentials != null) {
Iterator<GSSCredential> privCredItr = privCredentials.iterator();
if (privCredItr.hasNext()) {
gssCredInSubject = privCredItr.next();
}
}
return gssCredInSubject;
}
});
if (gssCredential == null) {
KerberosTicket tgt = getKerberosTicketFromSubject(subject, null);
if (tgt != null) {
gssCredential = createGSSCredential(subject, tgt);
}
}
return gssCredential;
} | java | public static GSSCredential getGSSCredentialFromSubject(final Subject subject) {
if (subject == null) {
return null;
}
GSSCredential gssCredential = AccessController.doPrivileged(new PrivilegedAction<GSSCredential>() {
@Override
public GSSCredential run() {
GSSCredential gssCredInSubject = null;
Set<GSSCredential> privCredentials = subject.getPrivateCredentials(GSSCredential.class);
if (privCredentials != null) {
Iterator<GSSCredential> privCredItr = privCredentials.iterator();
if (privCredItr.hasNext()) {
gssCredInSubject = privCredItr.next();
}
}
return gssCredInSubject;
}
});
if (gssCredential == null) {
KerberosTicket tgt = getKerberosTicketFromSubject(subject, null);
if (tgt != null) {
gssCredential = createGSSCredential(subject, tgt);
}
}
return gssCredential;
} | [
"public",
"static",
"GSSCredential",
"getGSSCredentialFromSubject",
"(",
"final",
"Subject",
"subject",
")",
"{",
"if",
"(",
"subject",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"GSSCredential",
"gssCredential",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"GSSCredential",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"GSSCredential",
"run",
"(",
")",
"{",
"GSSCredential",
"gssCredInSubject",
"=",
"null",
";",
"Set",
"<",
"GSSCredential",
">",
"privCredentials",
"=",
"subject",
".",
"getPrivateCredentials",
"(",
"GSSCredential",
".",
"class",
")",
";",
"if",
"(",
"privCredentials",
"!=",
"null",
")",
"{",
"Iterator",
"<",
"GSSCredential",
">",
"privCredItr",
"=",
"privCredentials",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"privCredItr",
".",
"hasNext",
"(",
")",
")",
"{",
"gssCredInSubject",
"=",
"privCredItr",
".",
"next",
"(",
")",
";",
"}",
"}",
"return",
"gssCredInSubject",
";",
"}",
"}",
")",
";",
"if",
"(",
"gssCredential",
"==",
"null",
")",
"{",
"KerberosTicket",
"tgt",
"=",
"getKerberosTicketFromSubject",
"(",
"subject",
",",
"null",
")",
";",
"if",
"(",
"tgt",
"!=",
"null",
")",
"{",
"gssCredential",
"=",
"createGSSCredential",
"(",
"subject",
",",
"tgt",
")",
";",
"}",
"}",
"return",
"gssCredential",
";",
"}"
] | Gets a GSSCredential from a Subject | [
"Gets",
"a",
"GSSCredential",
"from",
"a",
"Subject"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/ws/security/authentication/utility/SubjectHelper.java#L154-L181 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security/src/com/ibm/ws/security/authentication/utility/SubjectHelper.java | SubjectHelper.createNewHashtableInSubject | @Sensitive
public Hashtable<String, Object> createNewHashtableInSubject(@Sensitive final Subject subject) {
return AccessController.doPrivileged(new NewHashtablePrivilegedAction(subject));
} | java | @Sensitive
public Hashtable<String, Object> createNewHashtableInSubject(@Sensitive final Subject subject) {
return AccessController.doPrivileged(new NewHashtablePrivilegedAction(subject));
} | [
"@",
"Sensitive",
"public",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"createNewHashtableInSubject",
"(",
"@",
"Sensitive",
"final",
"Subject",
"subject",
")",
"{",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"NewHashtablePrivilegedAction",
"(",
"subject",
")",
")",
";",
"}"
] | Creates a Hashtable of values in the Subject without tracing the Subject.
@param subject {@code null} is not supported.
@return the hashtable containing the properties. | [
"Creates",
"a",
"Hashtable",
"of",
"values",
"in",
"the",
"Subject",
"without",
"tracing",
"the",
"Subject",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/ws/security/authentication/utility/SubjectHelper.java#L264-L267 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security/src/com/ibm/ws/security/authentication/utility/SubjectHelper.java | SubjectHelper.getSensitiveHashtableFromSubject | @Sensitive
public Hashtable<String, ?> getSensitiveHashtableFromSubject(@Sensitive final Subject subject) {
if (System.getSecurityManager() == null) {
return getHashtableFromSubject(subject);
} else {
return AccessController.doPrivileged(new GetHashtablePrivilegedAction(subject));
}
} | java | @Sensitive
public Hashtable<String, ?> getSensitiveHashtableFromSubject(@Sensitive final Subject subject) {
if (System.getSecurityManager() == null) {
return getHashtableFromSubject(subject);
} else {
return AccessController.doPrivileged(new GetHashtablePrivilegedAction(subject));
}
} | [
"@",
"Sensitive",
"public",
"Hashtable",
"<",
"String",
",",
"?",
">",
"getSensitiveHashtableFromSubject",
"(",
"@",
"Sensitive",
"final",
"Subject",
"subject",
")",
"{",
"if",
"(",
"System",
".",
"getSecurityManager",
"(",
")",
"==",
"null",
")",
"{",
"return",
"getHashtableFromSubject",
"(",
"subject",
")",
";",
"}",
"else",
"{",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"GetHashtablePrivilegedAction",
"(",
"subject",
")",
")",
";",
"}",
"}"
] | Gets a Hashtable of values from the Subject without tracing the Subject or hashtable.
@param subject {@code null} is not supported.
@return the hashtable containing the properties. | [
"Gets",
"a",
"Hashtable",
"of",
"values",
"from",
"the",
"Subject",
"without",
"tracing",
"the",
"Subject",
"or",
"hashtable",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/ws/security/authentication/utility/SubjectHelper.java#L298-L305 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security/src/com/ibm/ws/security/authentication/utility/SubjectHelper.java | SubjectHelper.getSensitiveHashtableFromSubject | @Sensitive
public Hashtable<String, ?> getSensitiveHashtableFromSubject(@Sensitive final Subject subject, @Sensitive final String[] properties) {
return AccessController.doPrivileged(new PrivilegedAction<Hashtable<String, ?>>() {
@Override
public Hashtable<String, ?> run() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Looking for custom properties in public cred list.");
}
Set<Object> list_public = subject.getPublicCredentials();
Hashtable<String, ?> hashtableFromPublic = getSensitiveHashtable(list_public, properties);
if (hashtableFromPublic != null) {
return hashtableFromPublic;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Looking for custom properties in private cred list.");
}
Set<Object> list_private = subject.getPrivateCredentials();
Hashtable<String, ?> hashtableFromPrivate = getSensitiveHashtable(list_private, properties);
if (hashtableFromPrivate != null) {
return hashtableFromPrivate;
}
return null;
}
});
} | java | @Sensitive
public Hashtable<String, ?> getSensitiveHashtableFromSubject(@Sensitive final Subject subject, @Sensitive final String[] properties) {
return AccessController.doPrivileged(new PrivilegedAction<Hashtable<String, ?>>() {
@Override
public Hashtable<String, ?> run() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Looking for custom properties in public cred list.");
}
Set<Object> list_public = subject.getPublicCredentials();
Hashtable<String, ?> hashtableFromPublic = getSensitiveHashtable(list_public, properties);
if (hashtableFromPublic != null) {
return hashtableFromPublic;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Looking for custom properties in private cred list.");
}
Set<Object> list_private = subject.getPrivateCredentials();
Hashtable<String, ?> hashtableFromPrivate = getSensitiveHashtable(list_private, properties);
if (hashtableFromPrivate != null) {
return hashtableFromPrivate;
}
return null;
}
});
} | [
"@",
"Sensitive",
"public",
"Hashtable",
"<",
"String",
",",
"?",
">",
"getSensitiveHashtableFromSubject",
"(",
"@",
"Sensitive",
"final",
"Subject",
"subject",
",",
"@",
"Sensitive",
"final",
"String",
"[",
"]",
"properties",
")",
"{",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Hashtable",
"<",
"String",
",",
"?",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Hashtable",
"<",
"String",
",",
"?",
">",
"run",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Looking for custom properties in public cred list.\"",
")",
";",
"}",
"Set",
"<",
"Object",
">",
"list_public",
"=",
"subject",
".",
"getPublicCredentials",
"(",
")",
";",
"Hashtable",
"<",
"String",
",",
"?",
">",
"hashtableFromPublic",
"=",
"getSensitiveHashtable",
"(",
"list_public",
",",
"properties",
")",
";",
"if",
"(",
"hashtableFromPublic",
"!=",
"null",
")",
"{",
"return",
"hashtableFromPublic",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Looking for custom properties in private cred list.\"",
")",
";",
"}",
"Set",
"<",
"Object",
">",
"list_private",
"=",
"subject",
".",
"getPrivateCredentials",
"(",
")",
";",
"Hashtable",
"<",
"String",
",",
"?",
">",
"hashtableFromPrivate",
"=",
"getSensitiveHashtable",
"(",
"list_private",
",",
"properties",
")",
";",
"if",
"(",
"hashtableFromPrivate",
"!=",
"null",
")",
"{",
"return",
"hashtableFromPrivate",
";",
"}",
"return",
"null",
";",
"}",
"}",
")",
";",
"}"
] | Gets a Hashtable of values from the Subject, but do not trace the hashtable
@param subject {@code null} is not supported.
@param properties The properties to get.
@return the hashtable containing the properties. | [
"Gets",
"a",
"Hashtable",
"of",
"values",
"from",
"the",
"Subject",
"but",
"do",
"not",
"trace",
"the",
"hashtable"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/ws/security/authentication/utility/SubjectHelper.java#L350-L376 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java | CommsLightTrace.traceMessageIds | public static void traceMessageIds(TraceComponent callersTrace, String action, SIMessageHandle[] messageHandles)
{
if ((light_tc.isDebugEnabled() || callersTrace.isDebugEnabled())
&& messageHandles != null) {
// Build our trace string
StringBuffer trcBuffer = new StringBuffer();
trcBuffer.append(action + ": [");
for (int i = 0; i < messageHandles.length; i++) {
if (i != 0) trcBuffer.append(",");
if (messageHandles[i] != null) {
trcBuffer.append(messageHandles[i].getSystemMessageId());
}
}
trcBuffer.append("]");
// Trace using the correct trace group
if (light_tc.isDebugEnabled()) {
SibTr.debug(light_tc, trcBuffer.toString());
}
else {
SibTr.debug(callersTrace, trcBuffer.toString());
}
}
} | java | public static void traceMessageIds(TraceComponent callersTrace, String action, SIMessageHandle[] messageHandles)
{
if ((light_tc.isDebugEnabled() || callersTrace.isDebugEnabled())
&& messageHandles != null) {
// Build our trace string
StringBuffer trcBuffer = new StringBuffer();
trcBuffer.append(action + ": [");
for (int i = 0; i < messageHandles.length; i++) {
if (i != 0) trcBuffer.append(",");
if (messageHandles[i] != null) {
trcBuffer.append(messageHandles[i].getSystemMessageId());
}
}
trcBuffer.append("]");
// Trace using the correct trace group
if (light_tc.isDebugEnabled()) {
SibTr.debug(light_tc, trcBuffer.toString());
}
else {
SibTr.debug(callersTrace, trcBuffer.toString());
}
}
} | [
"public",
"static",
"void",
"traceMessageIds",
"(",
"TraceComponent",
"callersTrace",
",",
"String",
"action",
",",
"SIMessageHandle",
"[",
"]",
"messageHandles",
")",
"{",
"if",
"(",
"(",
"light_tc",
".",
"isDebugEnabled",
"(",
")",
"||",
"callersTrace",
".",
"isDebugEnabled",
"(",
")",
")",
"&&",
"messageHandles",
"!=",
"null",
")",
"{",
"// Build our trace string",
"StringBuffer",
"trcBuffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"trcBuffer",
".",
"append",
"(",
"action",
"+",
"\": [\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"messageHandles",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"!=",
"0",
")",
"trcBuffer",
".",
"append",
"(",
"\",\"",
")",
";",
"if",
"(",
"messageHandles",
"[",
"i",
"]",
"!=",
"null",
")",
"{",
"trcBuffer",
".",
"append",
"(",
"messageHandles",
"[",
"i",
"]",
".",
"getSystemMessageId",
"(",
")",
")",
";",
"}",
"}",
"trcBuffer",
".",
"append",
"(",
"\"]\"",
")",
";",
"// Trace using the correct trace group",
"if",
"(",
"light_tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"light_tc",
",",
"trcBuffer",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"SibTr",
".",
"debug",
"(",
"callersTrace",
",",
"trcBuffer",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Allow tracing of messages and transaction when deleting
@param callersTrace The trace component of the caller
@param action A string (no spaces) provided by the caller to prefix the keyword included in the trace line
@param messageHandles The messages handles to trace | [
"Allow",
"tracing",
"of",
"messages",
"and",
"transaction",
"when",
"deleting"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java#L100-L124 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java | CommsLightTrace.traceTransaction | public static void traceTransaction(TraceComponent callersTrace, String action, Object transaction, int commsId, int commsFlags)
{
if (light_tc.isDebugEnabled() || callersTrace.isDebugEnabled()) {
// Build the trace string
String traceText = action + ": " + transaction +
" CommsId:" + commsId + " CommsFlags:" + commsFlags;
// Trace using the correct trace group
if (light_tc.isDebugEnabled()) {
SibTr.debug(light_tc, traceText);
}
else {
SibTr.debug(callersTrace, traceText);
}
}
} | java | public static void traceTransaction(TraceComponent callersTrace, String action, Object transaction, int commsId, int commsFlags)
{
if (light_tc.isDebugEnabled() || callersTrace.isDebugEnabled()) {
// Build the trace string
String traceText = action + ": " + transaction +
" CommsId:" + commsId + " CommsFlags:" + commsFlags;
// Trace using the correct trace group
if (light_tc.isDebugEnabled()) {
SibTr.debug(light_tc, traceText);
}
else {
SibTr.debug(callersTrace, traceText);
}
}
} | [
"public",
"static",
"void",
"traceTransaction",
"(",
"TraceComponent",
"callersTrace",
",",
"String",
"action",
",",
"Object",
"transaction",
",",
"int",
"commsId",
",",
"int",
"commsFlags",
")",
"{",
"if",
"(",
"light_tc",
".",
"isDebugEnabled",
"(",
")",
"||",
"callersTrace",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"// Build the trace string",
"String",
"traceText",
"=",
"action",
"+",
"\": \"",
"+",
"transaction",
"+",
"\" CommsId:\"",
"+",
"commsId",
"+",
"\" CommsFlags:\"",
"+",
"commsFlags",
";",
"// Trace using the correct trace group",
"if",
"(",
"light_tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"light_tc",
",",
"traceText",
")",
";",
"}",
"else",
"{",
"SibTr",
".",
"debug",
"(",
"callersTrace",
",",
"traceText",
")",
";",
"}",
"}",
"}"
] | Trace a transaction associated with an action.
@param callersTrace The trace component of the caller
@param action A string (no spaces) provided by the caller to prefix the keyword included in the trace line
@param transaction An optional transaction associated with the action being performed on the message
@param commsId The comms id integer associated (on both sides) with the transaction
@param commsFlags In many cases flags are flown over with the transaction, this field can be used for these flags | [
"Trace",
"a",
"transaction",
"associated",
"with",
"an",
"action",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java#L135-L150 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java | CommsLightTrace.traceException | public static void traceException(TraceComponent callersTrace, Throwable ex)
{
if (light_tc.isDebugEnabled() || callersTrace.isDebugEnabled()) {
// Find XA completion code if one exists, as this isn't in a normal dump
String xaErrStr = null;
if (ex instanceof XAException) {
XAException xaex = (XAException)ex;
xaErrStr = "XAExceptionErrorCode: " + xaex.errorCode;
}
// Trace using the correct trace group
if (light_tc.isDebugEnabled()) {
if (xaErrStr != null) SibTr.debug(light_tc, xaErrStr);
SibTr.exception(light_tc, ex);
}
else {
if (xaErrStr != null) SibTr.debug(callersTrace, xaErrStr);
SibTr.exception(callersTrace, ex);
}
}
} | java | public static void traceException(TraceComponent callersTrace, Throwable ex)
{
if (light_tc.isDebugEnabled() || callersTrace.isDebugEnabled()) {
// Find XA completion code if one exists, as this isn't in a normal dump
String xaErrStr = null;
if (ex instanceof XAException) {
XAException xaex = (XAException)ex;
xaErrStr = "XAExceptionErrorCode: " + xaex.errorCode;
}
// Trace using the correct trace group
if (light_tc.isDebugEnabled()) {
if (xaErrStr != null) SibTr.debug(light_tc, xaErrStr);
SibTr.exception(light_tc, ex);
}
else {
if (xaErrStr != null) SibTr.debug(callersTrace, xaErrStr);
SibTr.exception(callersTrace, ex);
}
}
} | [
"public",
"static",
"void",
"traceException",
"(",
"TraceComponent",
"callersTrace",
",",
"Throwable",
"ex",
")",
"{",
"if",
"(",
"light_tc",
".",
"isDebugEnabled",
"(",
")",
"||",
"callersTrace",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"// Find XA completion code if one exists, as this isn't in a normal dump",
"String",
"xaErrStr",
"=",
"null",
";",
"if",
"(",
"ex",
"instanceof",
"XAException",
")",
"{",
"XAException",
"xaex",
"=",
"(",
"XAException",
")",
"ex",
";",
"xaErrStr",
"=",
"\"XAExceptionErrorCode: \"",
"+",
"xaex",
".",
"errorCode",
";",
"}",
"// Trace using the correct trace group",
"if",
"(",
"light_tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"if",
"(",
"xaErrStr",
"!=",
"null",
")",
"SibTr",
".",
"debug",
"(",
"light_tc",
",",
"xaErrStr",
")",
";",
"SibTr",
".",
"exception",
"(",
"light_tc",
",",
"ex",
")",
";",
"}",
"else",
"{",
"if",
"(",
"xaErrStr",
"!=",
"null",
")",
"SibTr",
".",
"debug",
"(",
"callersTrace",
",",
"xaErrStr",
")",
";",
"SibTr",
".",
"exception",
"(",
"callersTrace",
",",
"ex",
")",
";",
"}",
"}",
"}"
] | Trace an exception.
@param callersTrace The trace component of the caller
@param ex The exception | [
"Trace",
"an",
"exception",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java#L157-L178 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java | CommsLightTrace.minimalToString | public static String minimalToString(Object object)
{
return object.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(object));
} | java | public static String minimalToString(Object object)
{
return object.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(object));
} | [
"public",
"static",
"String",
"minimalToString",
"(",
"Object",
"object",
")",
"{",
"return",
"object",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"@\"",
"+",
"Integer",
".",
"toHexString",
"(",
"System",
".",
"identityHashCode",
"(",
"object",
")",
")",
";",
"}"
] | Util to prevent full dump of the conversation in this class, as that
will print too much data if trace of this class is turned on to
get transaction and msgid information | [
"Util",
"to",
"prevent",
"full",
"dump",
"of",
"the",
"conversation",
"in",
"this",
"class",
"as",
"that",
"will",
"print",
"too",
"much",
"data",
"if",
"trace",
"of",
"this",
"class",
"is",
"turned",
"on",
"to",
"get",
"transaction",
"and",
"msgid",
"information"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java#L185-L188 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java | CommsLightTrace.msgToString | public static String msgToString(SIBusMessage message)
{
if (message == null) return STRING_NULL;
return message + "[" + message.getSystemMessageId() + "]";
} | java | public static String msgToString(SIBusMessage message)
{
if (message == null) return STRING_NULL;
return message + "[" + message.getSystemMessageId() + "]";
} | [
"public",
"static",
"String",
"msgToString",
"(",
"SIBusMessage",
"message",
")",
"{",
"if",
"(",
"message",
"==",
"null",
")",
"return",
"STRING_NULL",
";",
"return",
"message",
"+",
"\"[\"",
"+",
"message",
".",
"getSystemMessageId",
"(",
")",
"+",
"\"]\"",
";",
"}"
] | Util to trace the System Message ID of a message along with the default toString | [
"Util",
"to",
"trace",
"the",
"System",
"Message",
"ID",
"of",
"a",
"message",
"along",
"with",
"the",
"default",
"toString"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java#L193-L197 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/main/LibertyRuntimeTransformer.java | LibertyRuntimeTransformer.retransformClass | private final static void retransformClass(Class<?> clazz) {
if (detailedTransformTrace && tc.isEntryEnabled())
Tr.entry(tc, "retransformClass", clazz);
try {
instrumentation.retransformClasses(clazz);
} catch (Throwable t) {
Tr.error(tc, "INSTRUMENTATION_TRANSFORM_FAILED_FOR_CLASS_2", clazz.getName(), t);
}
if (detailedTransformTrace && tc.isEntryEnabled())
Tr.exit(tc, "retransformClass");
} | java | private final static void retransformClass(Class<?> clazz) {
if (detailedTransformTrace && tc.isEntryEnabled())
Tr.entry(tc, "retransformClass", clazz);
try {
instrumentation.retransformClasses(clazz);
} catch (Throwable t) {
Tr.error(tc, "INSTRUMENTATION_TRANSFORM_FAILED_FOR_CLASS_2", clazz.getName(), t);
}
if (detailedTransformTrace && tc.isEntryEnabled())
Tr.exit(tc, "retransformClass");
} | [
"private",
"final",
"static",
"void",
"retransformClass",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"if",
"(",
"detailedTransformTrace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"retransformClass\"",
",",
"clazz",
")",
";",
"try",
"{",
"instrumentation",
".",
"retransformClasses",
"(",
"clazz",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"INSTRUMENTATION_TRANSFORM_FAILED_FOR_CLASS_2\"",
",",
"clazz",
".",
"getName",
"(",
")",
",",
"t",
")",
";",
"}",
"if",
"(",
"detailedTransformTrace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"retransformClass\"",
")",
";",
"}"
] | Ask the JVM to retransform the class that has recently been enabled for
trace. This class will explicitly call the class loader to load and
initialize the class to work around an IBM JDK issue with hot code replace
during class initialization.
@param clazz the class that needs to be instrumented with entry/exit trace | [
"Ask",
"the",
"JVM",
"to",
"retransform",
"the",
"class",
"that",
"has",
"recently",
"been",
"enabled",
"for",
"trace",
".",
"This",
"class",
"will",
"explicitly",
"call",
"the",
"class",
"loader",
"to",
"load",
"and",
"initialize",
"the",
"class",
"to",
"work",
"around",
"an",
"IBM",
"JDK",
"issue",
"with",
"hot",
"code",
"replace",
"during",
"class",
"initialization",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/main/LibertyRuntimeTransformer.java#L245-L257 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaProducerSession.java | SibRaProducerSession.send | public void send(final SIBusMessage msg, final SITransaction tran)
throws SISessionDroppedException, SIConnectionDroppedException,
SISessionUnavailableException, SIConnectionUnavailableException,
SIConnectionLostException, SILimitExceededException,
SINotAuthorizedException, SIResourceException, SIErrorException,
SIIncorrectCallException,
SINotPossibleInCurrentConfigurationException {
checkValid();
_delegate.send(msg, _parentConnection.mapTransaction(tran));
} | java | public void send(final SIBusMessage msg, final SITransaction tran)
throws SISessionDroppedException, SIConnectionDroppedException,
SISessionUnavailableException, SIConnectionUnavailableException,
SIConnectionLostException, SILimitExceededException,
SINotAuthorizedException, SIResourceException, SIErrorException,
SIIncorrectCallException,
SINotPossibleInCurrentConfigurationException {
checkValid();
_delegate.send(msg, _parentConnection.mapTransaction(tran));
} | [
"public",
"void",
"send",
"(",
"final",
"SIBusMessage",
"msg",
",",
"final",
"SITransaction",
"tran",
")",
"throws",
"SISessionDroppedException",
",",
"SIConnectionDroppedException",
",",
"SISessionUnavailableException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionLostException",
",",
"SILimitExceededException",
",",
"SINotAuthorizedException",
",",
"SIResourceException",
",",
"SIErrorException",
",",
"SIIncorrectCallException",
",",
"SINotPossibleInCurrentConfigurationException",
"{",
"checkValid",
"(",
")",
";",
"_delegate",
".",
"send",
"(",
"msg",
",",
"_parentConnection",
".",
"mapTransaction",
"(",
"tran",
")",
")",
";",
"}"
] | Sends a message. Checks that the session is valid. Maps the transaction
parameter before delegating.
@param msg
the message to send
@param tran
the transaction to send the message under
@throws SIConnectionUnavailableException
if the connection is not valid
@throws SINotPossibleInCurrentConfigurationException
if the delegation fails
@throws SIIncorrectCallException
if the transaction parameter is not valid given the current
application and container transactions
@throws SIErrorException
if the delegation fails
@throws SIResourceException
if the current container transaction cannot be determined
@throws SINotAuthorizedException
if the delegation fails
@throws SILimitExceededException
if the delegation fails
@throws SIConnectionLostException
if the delegation fails
@throws SISessionUnavailableException
if the delegation fails
@throws SIConnectionDroppedException
if the delegation fails
@throws SISessionDroppedException
if the delegation fails | [
"Sends",
"a",
"message",
".",
"Checks",
"that",
"the",
"session",
"is",
"valid",
".",
"Maps",
"the",
"transaction",
"parameter",
"before",
"delegating",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaProducerSession.java#L109-L121 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/SocketIOChannel.java | SocketIOChannel.attemptReadFromSocket | protected IOResult attemptReadFromSocket(TCPBaseRequestContext readReq, boolean fromSelector) throws IOException {
IOResult rc = IOResult.NOT_COMPLETE;
TCPReadRequestContextImpl req = (TCPReadRequestContextImpl) readReq;
TCPConnLink conn = req.getTCPConnLink();
long dataRead = 0;
if (req.getJITAllocateSize() > 0 && req.getBuffers() == null) {
// User wants us to allocate the buffer
if (conn.getConfig().getAllocateBuffersDirect()) {
req.setBuffer(ChannelFrameworkFactory.getBufferManager().allocateDirect(req.getJITAllocateSize()));
} else {
req.setBuffer(ChannelFrameworkFactory.getBufferManager().allocate(req.getJITAllocateSize()));
}
req.setJITAllocateAction(true);
}
WsByteBuffer wsBuffArray[] = req.getBuffers();
dataRead = attemptReadFromSocketUsingNIO(req, wsBuffArray);
req.setLastIOAmt(dataRead);
req.setIODoneAmount(req.getIODoneAmount() + dataRead);
if (req.getIODoneAmount() >= req.getIOAmount()) {
rc = IOResult.COMPLETE;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Read " + dataRead + "(" + +req.getIODoneAmount() + ")" + " bytes, " + req.getIOAmount() + " requested on local: "
+ getSocket().getLocalSocketAddress()
+ " remote: " + getSocket().getRemoteSocketAddress());
}
// when request came from selector, it should always read at least 1 byte
// if it does read 0 (saw this 1 time), just let it retry
if (req.getLastIOAmt() < 0) {
// read did not find any data, though the read key was selected
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled() && !conn.getConfig().isInbound()) {
Tr.event(this, tc, "Empty read on outbound.");
}
if (req.getJITAllocateAction()) {
req.getBuffer().release();
req.setBuffer(null);
req.setJITAllocateAction(false);
}
return IOResult.FAILED;
}
if (rc == IOResult.COMPLETE) {
req.setIOCompleteAmount(req.getIODoneAmount());
req.setIODoneAmount(0);
} else if (rc == IOResult.NOT_COMPLETE && !fromSelector && req.getJITAllocateAction() && req.getLastIOAmt() == 0) {
// Did not read any data on immediate read, so release
// the buffers used for the jitallocation so that
// we will re-allocate them again later.
req.getBuffer().release();
req.setBuffers(null);
req.setJITAllocateAction(true);
}
return rc;
} | java | protected IOResult attemptReadFromSocket(TCPBaseRequestContext readReq, boolean fromSelector) throws IOException {
IOResult rc = IOResult.NOT_COMPLETE;
TCPReadRequestContextImpl req = (TCPReadRequestContextImpl) readReq;
TCPConnLink conn = req.getTCPConnLink();
long dataRead = 0;
if (req.getJITAllocateSize() > 0 && req.getBuffers() == null) {
// User wants us to allocate the buffer
if (conn.getConfig().getAllocateBuffersDirect()) {
req.setBuffer(ChannelFrameworkFactory.getBufferManager().allocateDirect(req.getJITAllocateSize()));
} else {
req.setBuffer(ChannelFrameworkFactory.getBufferManager().allocate(req.getJITAllocateSize()));
}
req.setJITAllocateAction(true);
}
WsByteBuffer wsBuffArray[] = req.getBuffers();
dataRead = attemptReadFromSocketUsingNIO(req, wsBuffArray);
req.setLastIOAmt(dataRead);
req.setIODoneAmount(req.getIODoneAmount() + dataRead);
if (req.getIODoneAmount() >= req.getIOAmount()) {
rc = IOResult.COMPLETE;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Read " + dataRead + "(" + +req.getIODoneAmount() + ")" + " bytes, " + req.getIOAmount() + " requested on local: "
+ getSocket().getLocalSocketAddress()
+ " remote: " + getSocket().getRemoteSocketAddress());
}
// when request came from selector, it should always read at least 1 byte
// if it does read 0 (saw this 1 time), just let it retry
if (req.getLastIOAmt() < 0) {
// read did not find any data, though the read key was selected
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled() && !conn.getConfig().isInbound()) {
Tr.event(this, tc, "Empty read on outbound.");
}
if (req.getJITAllocateAction()) {
req.getBuffer().release();
req.setBuffer(null);
req.setJITAllocateAction(false);
}
return IOResult.FAILED;
}
if (rc == IOResult.COMPLETE) {
req.setIOCompleteAmount(req.getIODoneAmount());
req.setIODoneAmount(0);
} else if (rc == IOResult.NOT_COMPLETE && !fromSelector && req.getJITAllocateAction() && req.getLastIOAmt() == 0) {
// Did not read any data on immediate read, so release
// the buffers used for the jitallocation so that
// we will re-allocate them again later.
req.getBuffer().release();
req.setBuffers(null);
req.setJITAllocateAction(true);
}
return rc;
} | [
"protected",
"IOResult",
"attemptReadFromSocket",
"(",
"TCPBaseRequestContext",
"readReq",
",",
"boolean",
"fromSelector",
")",
"throws",
"IOException",
"{",
"IOResult",
"rc",
"=",
"IOResult",
".",
"NOT_COMPLETE",
";",
"TCPReadRequestContextImpl",
"req",
"=",
"(",
"TCPReadRequestContextImpl",
")",
"readReq",
";",
"TCPConnLink",
"conn",
"=",
"req",
".",
"getTCPConnLink",
"(",
")",
";",
"long",
"dataRead",
"=",
"0",
";",
"if",
"(",
"req",
".",
"getJITAllocateSize",
"(",
")",
">",
"0",
"&&",
"req",
".",
"getBuffers",
"(",
")",
"==",
"null",
")",
"{",
"// User wants us to allocate the buffer",
"if",
"(",
"conn",
".",
"getConfig",
"(",
")",
".",
"getAllocateBuffersDirect",
"(",
")",
")",
"{",
"req",
".",
"setBuffer",
"(",
"ChannelFrameworkFactory",
".",
"getBufferManager",
"(",
")",
".",
"allocateDirect",
"(",
"req",
".",
"getJITAllocateSize",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"req",
".",
"setBuffer",
"(",
"ChannelFrameworkFactory",
".",
"getBufferManager",
"(",
")",
".",
"allocate",
"(",
"req",
".",
"getJITAllocateSize",
"(",
")",
")",
")",
";",
"}",
"req",
".",
"setJITAllocateAction",
"(",
"true",
")",
";",
"}",
"WsByteBuffer",
"wsBuffArray",
"[",
"]",
"=",
"req",
".",
"getBuffers",
"(",
")",
";",
"dataRead",
"=",
"attemptReadFromSocketUsingNIO",
"(",
"req",
",",
"wsBuffArray",
")",
";",
"req",
".",
"setLastIOAmt",
"(",
"dataRead",
")",
";",
"req",
".",
"setIODoneAmount",
"(",
"req",
".",
"getIODoneAmount",
"(",
")",
"+",
"dataRead",
")",
";",
"if",
"(",
"req",
".",
"getIODoneAmount",
"(",
")",
">=",
"req",
".",
"getIOAmount",
"(",
")",
")",
"{",
"rc",
"=",
"IOResult",
".",
"COMPLETE",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Read \"",
"+",
"dataRead",
"+",
"\"(\"",
"+",
"+",
"req",
".",
"getIODoneAmount",
"(",
")",
"+",
"\")\"",
"+",
"\" bytes, \"",
"+",
"req",
".",
"getIOAmount",
"(",
")",
"+",
"\" requested on local: \"",
"+",
"getSocket",
"(",
")",
".",
"getLocalSocketAddress",
"(",
")",
"+",
"\" remote: \"",
"+",
"getSocket",
"(",
")",
".",
"getRemoteSocketAddress",
"(",
")",
")",
";",
"}",
"// when request came from selector, it should always read at least 1 byte",
"// if it does read 0 (saw this 1 time), just let it retry",
"if",
"(",
"req",
".",
"getLastIOAmt",
"(",
")",
"<",
"0",
")",
"{",
"// read did not find any data, though the read key was selected",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
"&&",
"!",
"conn",
".",
"getConfig",
"(",
")",
".",
"isInbound",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Empty read on outbound.\"",
")",
";",
"}",
"if",
"(",
"req",
".",
"getJITAllocateAction",
"(",
")",
")",
"{",
"req",
".",
"getBuffer",
"(",
")",
".",
"release",
"(",
")",
";",
"req",
".",
"setBuffer",
"(",
"null",
")",
";",
"req",
".",
"setJITAllocateAction",
"(",
"false",
")",
";",
"}",
"return",
"IOResult",
".",
"FAILED",
";",
"}",
"if",
"(",
"rc",
"==",
"IOResult",
".",
"COMPLETE",
")",
"{",
"req",
".",
"setIOCompleteAmount",
"(",
"req",
".",
"getIODoneAmount",
"(",
")",
")",
";",
"req",
".",
"setIODoneAmount",
"(",
"0",
")",
";",
"}",
"else",
"if",
"(",
"rc",
"==",
"IOResult",
".",
"NOT_COMPLETE",
"&&",
"!",
"fromSelector",
"&&",
"req",
".",
"getJITAllocateAction",
"(",
")",
"&&",
"req",
".",
"getLastIOAmt",
"(",
")",
"==",
"0",
")",
"{",
"// Did not read any data on immediate read, so release",
"// the buffers used for the jitallocation so that",
"// we will re-allocate them again later.",
"req",
".",
"getBuffer",
"(",
")",
".",
"release",
"(",
")",
";",
"req",
".",
"setBuffers",
"(",
"null",
")",
";",
"req",
".",
"setJITAllocateAction",
"(",
"true",
")",
";",
"}",
"return",
"rc",
";",
"}"
] | Attempt to read for the socket.
@param readReq
@param fromSelector
@return IOResult
@throws IOException | [
"Attempt",
"to",
"read",
"for",
"the",
"socket",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/SocketIOChannel.java#L117-L179 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/SocketIOChannel.java | SocketIOChannel.attemptWriteToSocket | protected IOResult attemptWriteToSocket(TCPBaseRequestContext req) throws IOException {
IOResult rc = IOResult.NOT_COMPLETE;
WsByteBuffer wsBuffArray[] = req.getBuffers();
long bytesWritten = attemptWriteToSocketUsingNIO(req, wsBuffArray);
req.setLastIOAmt(bytesWritten);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Wrote " + bytesWritten + " bytes, " + req.getIOAmount() + " requested on local: " + getSocket().getLocalSocketAddress() + " remote: "
+ getSocket().getRemoteSocketAddress());
}
// when request came from selector, it should always write at least 1 byte
// if it does write 0 (saw this 1 time), just let it retry
if (bytesWritten < 0) {
// invalid value returned for number of bytes written
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled() && !req.getTCPConnLink().getConfig().isInbound()) {
Tr.event(this, tc, "invalid value returned for bytes written");
}
return IOResult.FAILED;
}
// Determine if we should consider this operation
// complete or not.
if (req.getIOAmount() == TCPWriteRequestContext.WRITE_ALL_DATA) {
ByteBuffer[] buffers = req.getByteBufferArray();
rc = IOResult.COMPLETE;
for (int i = 0; i < buffers.length; i++) {
if (buffers[i].hasRemaining()) {
rc = IOResult.NOT_COMPLETE;
break; // out of loop
}
}
req.setIODoneAmount(req.getIODoneAmount() + bytesWritten);
} else {
req.setIODoneAmount(req.getIODoneAmount() + bytesWritten);
if (req.getIODoneAmount() >= req.getIOAmount()) {
rc = IOResult.COMPLETE;
}
}
if (rc == IOResult.COMPLETE) {
req.setIOCompleteAmount(req.getIODoneAmount());
req.setIODoneAmount(0);
}
return rc;
} | java | protected IOResult attemptWriteToSocket(TCPBaseRequestContext req) throws IOException {
IOResult rc = IOResult.NOT_COMPLETE;
WsByteBuffer wsBuffArray[] = req.getBuffers();
long bytesWritten = attemptWriteToSocketUsingNIO(req, wsBuffArray);
req.setLastIOAmt(bytesWritten);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Wrote " + bytesWritten + " bytes, " + req.getIOAmount() + " requested on local: " + getSocket().getLocalSocketAddress() + " remote: "
+ getSocket().getRemoteSocketAddress());
}
// when request came from selector, it should always write at least 1 byte
// if it does write 0 (saw this 1 time), just let it retry
if (bytesWritten < 0) {
// invalid value returned for number of bytes written
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled() && !req.getTCPConnLink().getConfig().isInbound()) {
Tr.event(this, tc, "invalid value returned for bytes written");
}
return IOResult.FAILED;
}
// Determine if we should consider this operation
// complete or not.
if (req.getIOAmount() == TCPWriteRequestContext.WRITE_ALL_DATA) {
ByteBuffer[] buffers = req.getByteBufferArray();
rc = IOResult.COMPLETE;
for (int i = 0; i < buffers.length; i++) {
if (buffers[i].hasRemaining()) {
rc = IOResult.NOT_COMPLETE;
break; // out of loop
}
}
req.setIODoneAmount(req.getIODoneAmount() + bytesWritten);
} else {
req.setIODoneAmount(req.getIODoneAmount() + bytesWritten);
if (req.getIODoneAmount() >= req.getIOAmount()) {
rc = IOResult.COMPLETE;
}
}
if (rc == IOResult.COMPLETE) {
req.setIOCompleteAmount(req.getIODoneAmount());
req.setIODoneAmount(0);
}
return rc;
} | [
"protected",
"IOResult",
"attemptWriteToSocket",
"(",
"TCPBaseRequestContext",
"req",
")",
"throws",
"IOException",
"{",
"IOResult",
"rc",
"=",
"IOResult",
".",
"NOT_COMPLETE",
";",
"WsByteBuffer",
"wsBuffArray",
"[",
"]",
"=",
"req",
".",
"getBuffers",
"(",
")",
";",
"long",
"bytesWritten",
"=",
"attemptWriteToSocketUsingNIO",
"(",
"req",
",",
"wsBuffArray",
")",
";",
"req",
".",
"setLastIOAmt",
"(",
"bytesWritten",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Wrote \"",
"+",
"bytesWritten",
"+",
"\" bytes, \"",
"+",
"req",
".",
"getIOAmount",
"(",
")",
"+",
"\" requested on local: \"",
"+",
"getSocket",
"(",
")",
".",
"getLocalSocketAddress",
"(",
")",
"+",
"\" remote: \"",
"+",
"getSocket",
"(",
")",
".",
"getRemoteSocketAddress",
"(",
")",
")",
";",
"}",
"// when request came from selector, it should always write at least 1 byte",
"// if it does write 0 (saw this 1 time), just let it retry",
"if",
"(",
"bytesWritten",
"<",
"0",
")",
"{",
"// invalid value returned for number of bytes written",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
"&&",
"!",
"req",
".",
"getTCPConnLink",
"(",
")",
".",
"getConfig",
"(",
")",
".",
"isInbound",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"invalid value returned for bytes written\"",
")",
";",
"}",
"return",
"IOResult",
".",
"FAILED",
";",
"}",
"// Determine if we should consider this operation",
"// complete or not.",
"if",
"(",
"req",
".",
"getIOAmount",
"(",
")",
"==",
"TCPWriteRequestContext",
".",
"WRITE_ALL_DATA",
")",
"{",
"ByteBuffer",
"[",
"]",
"buffers",
"=",
"req",
".",
"getByteBufferArray",
"(",
")",
";",
"rc",
"=",
"IOResult",
".",
"COMPLETE",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"buffers",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"buffers",
"[",
"i",
"]",
".",
"hasRemaining",
"(",
")",
")",
"{",
"rc",
"=",
"IOResult",
".",
"NOT_COMPLETE",
";",
"break",
";",
"// out of loop",
"}",
"}",
"req",
".",
"setIODoneAmount",
"(",
"req",
".",
"getIODoneAmount",
"(",
")",
"+",
"bytesWritten",
")",
";",
"}",
"else",
"{",
"req",
".",
"setIODoneAmount",
"(",
"req",
".",
"getIODoneAmount",
"(",
")",
"+",
"bytesWritten",
")",
";",
"if",
"(",
"req",
".",
"getIODoneAmount",
"(",
")",
">=",
"req",
".",
"getIOAmount",
"(",
")",
")",
"{",
"rc",
"=",
"IOResult",
".",
"COMPLETE",
";",
"}",
"}",
"if",
"(",
"rc",
"==",
"IOResult",
".",
"COMPLETE",
")",
"{",
"req",
".",
"setIOCompleteAmount",
"(",
"req",
".",
"getIODoneAmount",
"(",
")",
")",
";",
"req",
".",
"setIODoneAmount",
"(",
"0",
")",
";",
"}",
"return",
"rc",
";",
"}"
] | Attempt to write information stored in the active buffers to the network.
@param req
@return IOResult
@throws IOException | [
"Attempt",
"to",
"write",
"information",
"stored",
"in",
"the",
"active",
"buffers",
"to",
"the",
"network",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/SocketIOChannel.java#L193-L244 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jaspic/src/com/ibm/ws/security/jaspi/JaspiServiceImpl.java | JaspiServiceImpl.getServerResourceAbsolutePath | static String getServerResourceAbsolutePath(String resourcePath) {
String path = null;
File f = new File(resourcePath);
if (f.isAbsolute()) {
path = resourcePath;
} else {
WsLocationAdmin wla = locationService.getServiceWithException();
if (wla != null)
path = wla.resolveString(SERVER_CONFIG_LOCATION + "/" + resourcePath);
}
return path;
} | java | static String getServerResourceAbsolutePath(String resourcePath) {
String path = null;
File f = new File(resourcePath);
if (f.isAbsolute()) {
path = resourcePath;
} else {
WsLocationAdmin wla = locationService.getServiceWithException();
if (wla != null)
path = wla.resolveString(SERVER_CONFIG_LOCATION + "/" + resourcePath);
}
return path;
} | [
"static",
"String",
"getServerResourceAbsolutePath",
"(",
"String",
"resourcePath",
")",
"{",
"String",
"path",
"=",
"null",
";",
"File",
"f",
"=",
"new",
"File",
"(",
"resourcePath",
")",
";",
"if",
"(",
"f",
".",
"isAbsolute",
"(",
")",
")",
"{",
"path",
"=",
"resourcePath",
";",
"}",
"else",
"{",
"WsLocationAdmin",
"wla",
"=",
"locationService",
".",
"getServiceWithException",
"(",
")",
";",
"if",
"(",
"wla",
"!=",
"null",
")",
"path",
"=",
"wla",
".",
"resolveString",
"(",
"SERVER_CONFIG_LOCATION",
"+",
"\"/\"",
"+",
"resourcePath",
")",
";",
"}",
"return",
"path",
";",
"}"
] | Return the absolute path of the given resource path relative to the
server config dir. If the given resource path is already absolute
then just return it. If the location admin service is not available
then return null.
@param resourcePath path to resource
@return absolute path or null | [
"Return",
"the",
"absolute",
"path",
"of",
"the",
"given",
"resource",
"path",
"relative",
"to",
"the",
"server",
"config",
"dir",
".",
"If",
"the",
"given",
"resource",
"path",
"is",
"already",
"absolute",
"then",
"just",
"return",
"it",
".",
"If",
"the",
"location",
"admin",
"service",
"is",
"not",
"available",
"then",
"return",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jaspic/src/com/ibm/ws/security/jaspi/JaspiServiceImpl.java#L199-L210 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jaspic/src/com/ibm/ws/security/jaspi/JaspiServiceImpl.java | JaspiServiceImpl.getAuthConfigProvider | private AuthConfigProvider getAuthConfigProvider(String appContext) {
AuthConfigProvider provider = null;
AuthConfigFactory providerFactory = getAuthConfigFactory();
if (providerFactory != null) {
if (providerConfigModified &&
providerFactory instanceof ProviderRegistry) {
((ProviderRegistry) providerFactory).setProvider(jaspiProviderServiceRef.getService());
providerConfigModified = false;
}
provider = providerFactory.getConfigProvider("HttpServlet", appContext, (RegistrationListener) null);
}
return provider;
} | java | private AuthConfigProvider getAuthConfigProvider(String appContext) {
AuthConfigProvider provider = null;
AuthConfigFactory providerFactory = getAuthConfigFactory();
if (providerFactory != null) {
if (providerConfigModified &&
providerFactory instanceof ProviderRegistry) {
((ProviderRegistry) providerFactory).setProvider(jaspiProviderServiceRef.getService());
providerConfigModified = false;
}
provider = providerFactory.getConfigProvider("HttpServlet", appContext, (RegistrationListener) null);
}
return provider;
} | [
"private",
"AuthConfigProvider",
"getAuthConfigProvider",
"(",
"String",
"appContext",
")",
"{",
"AuthConfigProvider",
"provider",
"=",
"null",
";",
"AuthConfigFactory",
"providerFactory",
"=",
"getAuthConfigFactory",
"(",
")",
";",
"if",
"(",
"providerFactory",
"!=",
"null",
")",
"{",
"if",
"(",
"providerConfigModified",
"&&",
"providerFactory",
"instanceof",
"ProviderRegistry",
")",
"{",
"(",
"(",
"ProviderRegistry",
")",
"providerFactory",
")",
".",
"setProvider",
"(",
"jaspiProviderServiceRef",
".",
"getService",
"(",
")",
")",
";",
"providerConfigModified",
"=",
"false",
";",
"}",
"provider",
"=",
"providerFactory",
".",
"getConfigProvider",
"(",
"\"HttpServlet\"",
",",
"appContext",
",",
"(",
"RegistrationListener",
")",
"null",
")",
";",
"}",
"return",
"provider",
";",
"}"
] | Some comment why we're doing this | [
"Some",
"comment",
"why",
"we",
"re",
"doing",
"this"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jaspic/src/com/ibm/ws/security/jaspi/JaspiServiceImpl.java#L507-L519 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jaspic/src/com/ibm/ws/security/jaspi/JaspiServiceImpl.java | JaspiServiceImpl.doHashTableLogin | protected Subject doHashTableLogin(Subject clientSubject, JaspiRequest jaspiRequest) throws WSLoginFailedException {
Subject authenticatedSubject = null;
final Hashtable<String, Object> hashTable = getCustomCredentials(clientSubject);
String unauthenticatedSubjectString = UNAUTHENTICATED_ID;
String user = null;
if (hashTable == null) {
// The JASPI provider did not add creds to the clientSubject. If we
// have a session subject then just return success and we'll use the
// session subject which has already been set on the thread
Subject sessionSubject = getSessionSubject(jaspiRequest);
if (sessionSubject != null) {
if (tc.isDebugEnabled())
Tr.debug(tc, "No HashTable returned by the JASPI provider. Using JASPI session subject.");
return sessionSubject;
}
MessageInfo msgInfo = jaspiRequest.getMessageInfo();
boolean isProtected = Boolean.parseBoolean((String) msgInfo.getMap().get(IS_MANDATORY_POLICY));
if (isProtected) {
String msg = "JASPI HashTable login cannot be performed, JASPI provider did not return a HashTable.";
throw new WSLoginFailedException(msg);
} else {
user = unauthenticatedSubjectString;
if (tc.isDebugEnabled())
Tr.debug(tc, "Web resource is unprotected and Subject does not have a HashTable.");
}
} else {
user = (String) hashTable.get(AttributeNameConstants.WSCREDENTIAL_SECURITYNAME);
}
boolean isUnauthenticated = unauthenticatedSubjectString.equals(user);
if (isUnauthenticated) {
authenticatedSubject = getUnauthenticatedSubject();
if (tc.isDebugEnabled())
Tr.debug(tc, "JASPI Subject is unauthenticated, HashTable login is not necessary.");
} else {
if (user == null)
user = "";
Subject loginSubject = clientSubject;
// If we have a session subject then do the hashtable login with the session subject
// so we pick up all the creds from the original session login. Add the custom
// credential hashtable (that the JASPI provider returned) to the session subject.
// Note we must "clone" the session subject as it is read only
final Subject sessionSubject = getSessionSubject(jaspiRequest);
if (sessionSubject != null) {
final Subject clone = new Subject();
clone.getPrivateCredentials().addAll(sessionSubject.getPrivateCredentials());
clone.getPublicCredentials().addAll(sessionSubject.getPublicCredentials());
clone.getPrincipals().addAll(sessionSubject.getPrincipals());
// add the hashtable from the JASPI provider
clone.getPrivateCredentials().add(hashTable);
loginSubject = clone;
}
final HttpServletRequest req = jaspiRequest.getHttpServletRequest();
final HttpServletResponse res = (HttpServletResponse) jaspiRequest.getMessageInfo().getResponseMessage();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JASPI login with HashTable: " + hashTable);
}
AuthenticationResult result = getWebProviderAuthenticatorHelper().loginWithHashtable(req, res, loginSubject);
authenticatedSubject = result.getSubject();
// Remove the custom credential hashtable from the session subject
if (sessionSubject != null) {
removeCustomCredentials(sessionSubject, hashTable);
}
if (authenticatedSubject == null) {
throw new WSLoginFailedException("JASPI HashTable login failed, user: " + user);
}
}
return authenticatedSubject;
} | java | protected Subject doHashTableLogin(Subject clientSubject, JaspiRequest jaspiRequest) throws WSLoginFailedException {
Subject authenticatedSubject = null;
final Hashtable<String, Object> hashTable = getCustomCredentials(clientSubject);
String unauthenticatedSubjectString = UNAUTHENTICATED_ID;
String user = null;
if (hashTable == null) {
// The JASPI provider did not add creds to the clientSubject. If we
// have a session subject then just return success and we'll use the
// session subject which has already been set on the thread
Subject sessionSubject = getSessionSubject(jaspiRequest);
if (sessionSubject != null) {
if (tc.isDebugEnabled())
Tr.debug(tc, "No HashTable returned by the JASPI provider. Using JASPI session subject.");
return sessionSubject;
}
MessageInfo msgInfo = jaspiRequest.getMessageInfo();
boolean isProtected = Boolean.parseBoolean((String) msgInfo.getMap().get(IS_MANDATORY_POLICY));
if (isProtected) {
String msg = "JASPI HashTable login cannot be performed, JASPI provider did not return a HashTable.";
throw new WSLoginFailedException(msg);
} else {
user = unauthenticatedSubjectString;
if (tc.isDebugEnabled())
Tr.debug(tc, "Web resource is unprotected and Subject does not have a HashTable.");
}
} else {
user = (String) hashTable.get(AttributeNameConstants.WSCREDENTIAL_SECURITYNAME);
}
boolean isUnauthenticated = unauthenticatedSubjectString.equals(user);
if (isUnauthenticated) {
authenticatedSubject = getUnauthenticatedSubject();
if (tc.isDebugEnabled())
Tr.debug(tc, "JASPI Subject is unauthenticated, HashTable login is not necessary.");
} else {
if (user == null)
user = "";
Subject loginSubject = clientSubject;
// If we have a session subject then do the hashtable login with the session subject
// so we pick up all the creds from the original session login. Add the custom
// credential hashtable (that the JASPI provider returned) to the session subject.
// Note we must "clone" the session subject as it is read only
final Subject sessionSubject = getSessionSubject(jaspiRequest);
if (sessionSubject != null) {
final Subject clone = new Subject();
clone.getPrivateCredentials().addAll(sessionSubject.getPrivateCredentials());
clone.getPublicCredentials().addAll(sessionSubject.getPublicCredentials());
clone.getPrincipals().addAll(sessionSubject.getPrincipals());
// add the hashtable from the JASPI provider
clone.getPrivateCredentials().add(hashTable);
loginSubject = clone;
}
final HttpServletRequest req = jaspiRequest.getHttpServletRequest();
final HttpServletResponse res = (HttpServletResponse) jaspiRequest.getMessageInfo().getResponseMessage();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JASPI login with HashTable: " + hashTable);
}
AuthenticationResult result = getWebProviderAuthenticatorHelper().loginWithHashtable(req, res, loginSubject);
authenticatedSubject = result.getSubject();
// Remove the custom credential hashtable from the session subject
if (sessionSubject != null) {
removeCustomCredentials(sessionSubject, hashTable);
}
if (authenticatedSubject == null) {
throw new WSLoginFailedException("JASPI HashTable login failed, user: " + user);
}
}
return authenticatedSubject;
} | [
"protected",
"Subject",
"doHashTableLogin",
"(",
"Subject",
"clientSubject",
",",
"JaspiRequest",
"jaspiRequest",
")",
"throws",
"WSLoginFailedException",
"{",
"Subject",
"authenticatedSubject",
"=",
"null",
";",
"final",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"hashTable",
"=",
"getCustomCredentials",
"(",
"clientSubject",
")",
";",
"String",
"unauthenticatedSubjectString",
"=",
"UNAUTHENTICATED_ID",
";",
"String",
"user",
"=",
"null",
";",
"if",
"(",
"hashTable",
"==",
"null",
")",
"{",
"// The JASPI provider did not add creds to the clientSubject. If we",
"// have a session subject then just return success and we'll use the",
"// session subject which has already been set on the thread",
"Subject",
"sessionSubject",
"=",
"getSessionSubject",
"(",
"jaspiRequest",
")",
";",
"if",
"(",
"sessionSubject",
"!=",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"No HashTable returned by the JASPI provider. Using JASPI session subject.\"",
")",
";",
"return",
"sessionSubject",
";",
"}",
"MessageInfo",
"msgInfo",
"=",
"jaspiRequest",
".",
"getMessageInfo",
"(",
")",
";",
"boolean",
"isProtected",
"=",
"Boolean",
".",
"parseBoolean",
"(",
"(",
"String",
")",
"msgInfo",
".",
"getMap",
"(",
")",
".",
"get",
"(",
"IS_MANDATORY_POLICY",
")",
")",
";",
"if",
"(",
"isProtected",
")",
"{",
"String",
"msg",
"=",
"\"JASPI HashTable login cannot be performed, JASPI provider did not return a HashTable.\"",
";",
"throw",
"new",
"WSLoginFailedException",
"(",
"msg",
")",
";",
"}",
"else",
"{",
"user",
"=",
"unauthenticatedSubjectString",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Web resource is unprotected and Subject does not have a HashTable.\"",
")",
";",
"}",
"}",
"else",
"{",
"user",
"=",
"(",
"String",
")",
"hashTable",
".",
"get",
"(",
"AttributeNameConstants",
".",
"WSCREDENTIAL_SECURITYNAME",
")",
";",
"}",
"boolean",
"isUnauthenticated",
"=",
"unauthenticatedSubjectString",
".",
"equals",
"(",
"user",
")",
";",
"if",
"(",
"isUnauthenticated",
")",
"{",
"authenticatedSubject",
"=",
"getUnauthenticatedSubject",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"JASPI Subject is unauthenticated, HashTable login is not necessary.\"",
")",
";",
"}",
"else",
"{",
"if",
"(",
"user",
"==",
"null",
")",
"user",
"=",
"\"\"",
";",
"Subject",
"loginSubject",
"=",
"clientSubject",
";",
"// If we have a session subject then do the hashtable login with the session subject",
"// so we pick up all the creds from the original session login. Add the custom",
"// credential hashtable (that the JASPI provider returned) to the session subject.",
"// Note we must \"clone\" the session subject as it is read only",
"final",
"Subject",
"sessionSubject",
"=",
"getSessionSubject",
"(",
"jaspiRequest",
")",
";",
"if",
"(",
"sessionSubject",
"!=",
"null",
")",
"{",
"final",
"Subject",
"clone",
"=",
"new",
"Subject",
"(",
")",
";",
"clone",
".",
"getPrivateCredentials",
"(",
")",
".",
"addAll",
"(",
"sessionSubject",
".",
"getPrivateCredentials",
"(",
")",
")",
";",
"clone",
".",
"getPublicCredentials",
"(",
")",
".",
"addAll",
"(",
"sessionSubject",
".",
"getPublicCredentials",
"(",
")",
")",
";",
"clone",
".",
"getPrincipals",
"(",
")",
".",
"addAll",
"(",
"sessionSubject",
".",
"getPrincipals",
"(",
")",
")",
";",
"// add the hashtable from the JASPI provider",
"clone",
".",
"getPrivateCredentials",
"(",
")",
".",
"add",
"(",
"hashTable",
")",
";",
"loginSubject",
"=",
"clone",
";",
"}",
"final",
"HttpServletRequest",
"req",
"=",
"jaspiRequest",
".",
"getHttpServletRequest",
"(",
")",
";",
"final",
"HttpServletResponse",
"res",
"=",
"(",
"HttpServletResponse",
")",
"jaspiRequest",
".",
"getMessageInfo",
"(",
")",
".",
"getResponseMessage",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"JASPI login with HashTable: \"",
"+",
"hashTable",
")",
";",
"}",
"AuthenticationResult",
"result",
"=",
"getWebProviderAuthenticatorHelper",
"(",
")",
".",
"loginWithHashtable",
"(",
"req",
",",
"res",
",",
"loginSubject",
")",
";",
"authenticatedSubject",
"=",
"result",
".",
"getSubject",
"(",
")",
";",
"// Remove the custom credential hashtable from the session subject",
"if",
"(",
"sessionSubject",
"!=",
"null",
")",
"{",
"removeCustomCredentials",
"(",
"sessionSubject",
",",
"hashTable",
")",
";",
"}",
"if",
"(",
"authenticatedSubject",
"==",
"null",
")",
"{",
"throw",
"new",
"WSLoginFailedException",
"(",
"\"JASPI HashTable login failed, user: \"",
"+",
"user",
")",
";",
"}",
"}",
"return",
"authenticatedSubject",
";",
"}"
] | Create a WAS Subject using the HashTable obtained from the JASPI provider
@param clientSubject Subject containing the JASPI HashTable
@param jaspiRequest
@return the WAS Subject
@throws WSLoginFailedException | [
"Create",
"a",
"WAS",
"Subject",
"using",
"the",
"HashTable",
"obtained",
"from",
"the",
"JASPI",
"provider"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jaspic/src/com/ibm/ws/security/jaspi/JaspiServiceImpl.java#L760-L828 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Root.java | Root.getContexts | public List<com.ibm.wsspi.security.wim.model.Context> getContexts() {
if (contexts == null) {
contexts = new ArrayList<com.ibm.wsspi.security.wim.model.Context>();
}
return this.contexts;
} | java | public List<com.ibm.wsspi.security.wim.model.Context> getContexts() {
if (contexts == null) {
contexts = new ArrayList<com.ibm.wsspi.security.wim.model.Context>();
}
return this.contexts;
} | [
"public",
"List",
"<",
"com",
".",
"ibm",
".",
"wsspi",
".",
"security",
".",
"wim",
".",
"model",
".",
"Context",
">",
"getContexts",
"(",
")",
"{",
"if",
"(",
"contexts",
"==",
"null",
")",
"{",
"contexts",
"=",
"new",
"ArrayList",
"<",
"com",
".",
"ibm",
".",
"wsspi",
".",
"security",
".",
"wim",
".",
"model",
".",
"Context",
">",
"(",
")",
";",
"}",
"return",
"this",
".",
"contexts",
";",
"}"
] | Gets the value of the contexts property.
<p>
This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a <CODE>set</CODE> method for the contexts property.
<p>
For example, to add a new item, do as follows:
<pre>
getContexts().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list {@link com.ibm.wsspi.security.wim.model.Context } | [
"Gets",
"the",
"value",
"of",
"the",
"contexts",
"property",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Root.java#L113-L118 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Root.java | Root.getEntities | public List<com.ibm.wsspi.security.wim.model.Entity> getEntities() {
if (entities == null) {
entities = new ArrayList<com.ibm.wsspi.security.wim.model.Entity>();
}
return this.entities;
} | java | public List<com.ibm.wsspi.security.wim.model.Entity> getEntities() {
if (entities == null) {
entities = new ArrayList<com.ibm.wsspi.security.wim.model.Entity>();
}
return this.entities;
} | [
"public",
"List",
"<",
"com",
".",
"ibm",
".",
"wsspi",
".",
"security",
".",
"wim",
".",
"model",
".",
"Entity",
">",
"getEntities",
"(",
")",
"{",
"if",
"(",
"entities",
"==",
"null",
")",
"{",
"entities",
"=",
"new",
"ArrayList",
"<",
"com",
".",
"ibm",
".",
"wsspi",
".",
"security",
".",
"wim",
".",
"model",
".",
"Entity",
">",
"(",
")",
";",
"}",
"return",
"this",
".",
"entities",
";",
"}"
] | Gets the value of the entities property.
<p>
This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a <CODE>set</CODE> method for the entities property.
<p>
For example, to add a new item, do as follows:
<pre>
getEntities().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list {@link com.ibm.wsspi.security.wim.model.Entity } | [
"Gets",
"the",
"value",
"of",
"the",
"entities",
"property",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Root.java#L150-L155 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Root.java | Root.getControls | public List<com.ibm.wsspi.security.wim.model.Control> getControls() {
if (controls == null) {
controls = new ArrayList<com.ibm.wsspi.security.wim.model.Control>();
}
return this.controls;
} | java | public List<com.ibm.wsspi.security.wim.model.Control> getControls() {
if (controls == null) {
controls = new ArrayList<com.ibm.wsspi.security.wim.model.Control>();
}
return this.controls;
} | [
"public",
"List",
"<",
"com",
".",
"ibm",
".",
"wsspi",
".",
"security",
".",
"wim",
".",
"model",
".",
"Control",
">",
"getControls",
"(",
")",
"{",
"if",
"(",
"controls",
"==",
"null",
")",
"{",
"controls",
"=",
"new",
"ArrayList",
"<",
"com",
".",
"ibm",
".",
"wsspi",
".",
"security",
".",
"wim",
".",
"model",
".",
"Control",
">",
"(",
")",
";",
"}",
"return",
"this",
".",
"controls",
";",
"}"
] | Gets the value of the controls property.
<p>
This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a <CODE>set</CODE> method for the controls property.
<p>
For example, to add a new item, do as follows:
<pre>
getControls().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list {@link com.ibm.wsspi.security.wim.model.Control } | [
"Gets",
"the",
"value",
"of",
"the",
"controls",
"property",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Root.java#L187-L192 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/PartialTopicMatch.java | PartialTopicMatch.skipForward | private int skipForward(char[] chars, int start, int length) {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "skipForward", new Object[]{chars,new Integer(start),
new Integer(length)});
int ans = length;
for (int i = 0; i < length; i++)
if (chars[start+i] == MatchSpace.SUBTOPIC_SEPARATOR_CHAR) {
ans = i;
break;
}
if (tc.isEntryEnabled())
tc.exit(this,cclass, "skipForward", new Integer(ans));
return ans;
} | java | private int skipForward(char[] chars, int start, int length) {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "skipForward", new Object[]{chars,new Integer(start),
new Integer(length)});
int ans = length;
for (int i = 0; i < length; i++)
if (chars[start+i] == MatchSpace.SUBTOPIC_SEPARATOR_CHAR) {
ans = i;
break;
}
if (tc.isEntryEnabled())
tc.exit(this,cclass, "skipForward", new Integer(ans));
return ans;
} | [
"private",
"int",
"skipForward",
"(",
"char",
"[",
"]",
"chars",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"skipForward\"",
",",
"new",
"Object",
"[",
"]",
"{",
"chars",
",",
"new",
"Integer",
"(",
"start",
")",
",",
"new",
"Integer",
"(",
"length",
")",
"}",
")",
";",
"int",
"ans",
"=",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"if",
"(",
"chars",
"[",
"start",
"+",
"i",
"]",
"==",
"MatchSpace",
".",
"SUBTOPIC_SEPARATOR_CHAR",
")",
"{",
"ans",
"=",
"i",
";",
"break",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"skipForward\"",
",",
"new",
"Integer",
"(",
"ans",
")",
")",
";",
"return",
"ans",
";",
"}"
] | Skip forward to next separator | [
"Skip",
"forward",
"to",
"next",
"separator"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/PartialTopicMatch.java#L118-L131 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/PartialTopicMatch.java | PartialTopicMatch.get | void get(
char[] chars,
int start,
int length,
boolean invert,
MatchSpaceKey msg,
EvalCache cache,
Object contextValue,
SearchResults result)
throws MatchingException, BadMessageFormatMatchingException {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "get", new Object[]{chars,new Integer(start),new Integer(length),
new Boolean(invert),msg,cache,result});
if (start == chars.length || chars[start] != MatchSpace.NONWILD_MARKER)
super.get(chars, start, length, invert, msg, cache, contextValue, result);
if (tc.isEntryEnabled())
tc.exit(this,cclass, "get");
} | java | void get(
char[] chars,
int start,
int length,
boolean invert,
MatchSpaceKey msg,
EvalCache cache,
Object contextValue,
SearchResults result)
throws MatchingException, BadMessageFormatMatchingException {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "get", new Object[]{chars,new Integer(start),new Integer(length),
new Boolean(invert),msg,cache,result});
if (start == chars.length || chars[start] != MatchSpace.NONWILD_MARKER)
super.get(chars, start, length, invert, msg, cache, contextValue, result);
if (tc.isEntryEnabled())
tc.exit(this,cclass, "get");
} | [
"void",
"get",
"(",
"char",
"[",
"]",
"chars",
",",
"int",
"start",
",",
"int",
"length",
",",
"boolean",
"invert",
",",
"MatchSpaceKey",
"msg",
",",
"EvalCache",
"cache",
",",
"Object",
"contextValue",
",",
"SearchResults",
"result",
")",
"throws",
"MatchingException",
",",
"BadMessageFormatMatchingException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"get\"",
",",
"new",
"Object",
"[",
"]",
"{",
"chars",
",",
"new",
"Integer",
"(",
"start",
")",
",",
"new",
"Integer",
"(",
"length",
")",
",",
"new",
"Boolean",
"(",
"invert",
")",
",",
"msg",
",",
"cache",
",",
"result",
"}",
")",
";",
"if",
"(",
"start",
"==",
"chars",
".",
"length",
"||",
"chars",
"[",
"start",
"]",
"!=",
"MatchSpace",
".",
"NONWILD_MARKER",
")",
"super",
".",
"get",
"(",
"chars",
",",
"start",
",",
"length",
",",
"invert",
",",
"msg",
",",
"cache",
",",
"contextValue",
",",
"result",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"get\"",
")",
";",
"}"
] | Override get to rule out NONWILD_MARKER | [
"Override",
"get",
"to",
"rule",
"out",
"NONWILD_MARKER"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/PartialTopicMatch.java#L150-L167 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/FATHelper.java | FATHelper.reloadApplications | public static void reloadApplications(LibertyServer server, final Set<String> appIdsToReload) throws Exception {
ServerConfiguration config = server.getServerConfiguration().clone();
/*
* Get the apps to remove.
*/
ConfigElementList<Application> toRemove = new ConfigElementList<Application>(config.getApplications().stream().filter(app -> appIdsToReload.contains(app.getId())).collect(Collectors.toList()));
/*
* Remove the applications.
*/
config.getApplications().removeAll(toRemove);
updateConfigDynamically(server, config, true);
/*
* Reload applications.
*/
config.getApplications().addAll(toRemove);
updateConfigDynamically(server, config, true);
} | java | public static void reloadApplications(LibertyServer server, final Set<String> appIdsToReload) throws Exception {
ServerConfiguration config = server.getServerConfiguration().clone();
/*
* Get the apps to remove.
*/
ConfigElementList<Application> toRemove = new ConfigElementList<Application>(config.getApplications().stream().filter(app -> appIdsToReload.contains(app.getId())).collect(Collectors.toList()));
/*
* Remove the applications.
*/
config.getApplications().removeAll(toRemove);
updateConfigDynamically(server, config, true);
/*
* Reload applications.
*/
config.getApplications().addAll(toRemove);
updateConfigDynamically(server, config, true);
} | [
"public",
"static",
"void",
"reloadApplications",
"(",
"LibertyServer",
"server",
",",
"final",
"Set",
"<",
"String",
">",
"appIdsToReload",
")",
"throws",
"Exception",
"{",
"ServerConfiguration",
"config",
"=",
"server",
".",
"getServerConfiguration",
"(",
")",
".",
"clone",
"(",
")",
";",
"/*\n * Get the apps to remove.\n */",
"ConfigElementList",
"<",
"Application",
">",
"toRemove",
"=",
"new",
"ConfigElementList",
"<",
"Application",
">",
"(",
"config",
".",
"getApplications",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"app",
"->",
"appIdsToReload",
".",
"contains",
"(",
"app",
".",
"getId",
"(",
")",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
")",
";",
"/*\n * Remove the applications.\n */",
"config",
".",
"getApplications",
"(",
")",
".",
"removeAll",
"(",
"toRemove",
")",
";",
"updateConfigDynamically",
"(",
"server",
",",
"config",
",",
"true",
")",
";",
"/*\n * Reload applications.\n */",
"config",
".",
"getApplications",
"(",
")",
".",
"addAll",
"(",
"toRemove",
")",
";",
"updateConfigDynamically",
"(",
"server",
",",
"config",
",",
"true",
")",
";",
"}"
] | Reload select applications.
@throws Exception If there was an error reloading the applications for some unforeseen reason. | [
"Reload",
"select",
"applications",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/FATHelper.java#L31-L50 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/FATHelper.java | FATHelper.updateConfigDynamically | public static void updateConfigDynamically(LibertyServer server, ServerConfiguration config, boolean waitForAppToStart) throws Exception {
resetMarksInLogs(server);
server.updateServerConfiguration(config);
server.waitForStringInLogUsingMark("CWWKG001[7-8]I");
if (waitForAppToStart) {
server.waitForStringInLogUsingMark("CWWKZ0003I"); //CWWKZ0003I: The application **** updated in 0.020 seconds.
}
} | java | public static void updateConfigDynamically(LibertyServer server, ServerConfiguration config, boolean waitForAppToStart) throws Exception {
resetMarksInLogs(server);
server.updateServerConfiguration(config);
server.waitForStringInLogUsingMark("CWWKG001[7-8]I");
if (waitForAppToStart) {
server.waitForStringInLogUsingMark("CWWKZ0003I"); //CWWKZ0003I: The application **** updated in 0.020 seconds.
}
} | [
"public",
"static",
"void",
"updateConfigDynamically",
"(",
"LibertyServer",
"server",
",",
"ServerConfiguration",
"config",
",",
"boolean",
"waitForAppToStart",
")",
"throws",
"Exception",
"{",
"resetMarksInLogs",
"(",
"server",
")",
";",
"server",
".",
"updateServerConfiguration",
"(",
"config",
")",
";",
"server",
".",
"waitForStringInLogUsingMark",
"(",
"\"CWWKG001[7-8]I\"",
")",
";",
"if",
"(",
"waitForAppToStart",
")",
"{",
"server",
".",
"waitForStringInLogUsingMark",
"(",
"\"CWWKZ0003I\"",
")",
";",
"//CWWKZ0003I: The application **** updated in 0.020 seconds.",
"}",
"}"
] | This method will the reset the log and trace marks for log and trace searches, update the
configuration and then wait for the server to re-initialize. Optionally it will then wait for the application to start.
@param server The server to update.
@param config The configuration to use.
@param waitForAppToStart Wait for the application to start.
@throws Exception If there was an issue updating the server configuration. | [
"This",
"method",
"will",
"the",
"reset",
"the",
"log",
"and",
"trace",
"marks",
"for",
"log",
"and",
"trace",
"searches",
"update",
"the",
"configuration",
"and",
"then",
"wait",
"for",
"the",
"server",
"to",
"re",
"-",
"initialize",
".",
"Optionally",
"it",
"will",
"then",
"wait",
"for",
"the",
"application",
"to",
"start",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/FATHelper.java#L61-L68 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/FATHelper.java | FATHelper.resetMarksInLogs | public static void resetMarksInLogs(LibertyServer server) throws Exception {
server.setMarkToEndOfLog(server.getDefaultLogFile());
server.setMarkToEndOfLog(server.getMostRecentTraceFile());
} | java | public static void resetMarksInLogs(LibertyServer server) throws Exception {
server.setMarkToEndOfLog(server.getDefaultLogFile());
server.setMarkToEndOfLog(server.getMostRecentTraceFile());
} | [
"public",
"static",
"void",
"resetMarksInLogs",
"(",
"LibertyServer",
"server",
")",
"throws",
"Exception",
"{",
"server",
".",
"setMarkToEndOfLog",
"(",
"server",
".",
"getDefaultLogFile",
"(",
")",
")",
";",
"server",
".",
"setMarkToEndOfLog",
"(",
"server",
".",
"getMostRecentTraceFile",
"(",
")",
")",
";",
"}"
] | Reset the marks in all Liberty logs.
@param server The server for the logs to reset the marks.
@throws Exception If there was an error resetting the marks. | [
"Reset",
"the",
"marks",
"in",
"all",
"Liberty",
"logs",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/FATHelper.java#L76-L79 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeAtCatchMethodAdapter.java | ProbeAtCatchMethodAdapter.onHandlerEntry | private void onHandlerEntry() {
if (enabled) {
Type exceptionType = handlers.get(handlerPendingInstruction);
// Clear the pending instruction flag
handlerPendingInstruction = null;
// Filter the interested down to this exception
Set<ProbeListener> filtered = new HashSet<ProbeListener>();
for (ProbeListener listener : enabledListeners) {
ListenerConfiguration config = listener.getListenerConfiguration();
ProbeFilter filter = config.getTransformerData(EXCEPTION_FILTER_KEY);
if (filter.isBasicFilter() && filter.basicClassNameMatches(exceptionType.getClassName())) {
filtered.add(listener);
} else if (filter.isAdvancedFilter()) {
Class<?> clazz = getOwningClass(exceptionType.getInternalName());
if (clazz != null && filter.matches(clazz)) {
filtered.add(listener);
}
}
}
if (filtered.isEmpty()) {
return;
}
String key = createKey(exceptionType);
ProbeImpl probe = getProbe(key);
long probeId = probe.getIdentifier();
setProbeInProgress(true);
visitInsn(DUP); // throwable throwable
visitLdcInsn(Long.valueOf(probeId)); // throwable throwable long1 long2
visitInsn(DUP2_X1); // throwable long1 long2 throwable long1 long2
visitInsn(POP2); // throwable long1 long2 throwable
if (isStatic()) {
visitInsn(ACONST_NULL); // throwable long1 long2 throwable this
} else {
visitVarInsn(ALOAD, 0); // throwable long1 long2 throwable this
}
visitInsn(SWAP); // throwable long1 long2 this throwable
visitInsn(ACONST_NULL); // throwable long1 long2 this throwable null
visitInsn(SWAP); // throwable long1 long2 this null throwable
visitFireProbeInvocation(); // throwable
setProbeInProgress(false);
setProbeListeners(probe, filtered);
}
} | java | private void onHandlerEntry() {
if (enabled) {
Type exceptionType = handlers.get(handlerPendingInstruction);
// Clear the pending instruction flag
handlerPendingInstruction = null;
// Filter the interested down to this exception
Set<ProbeListener> filtered = new HashSet<ProbeListener>();
for (ProbeListener listener : enabledListeners) {
ListenerConfiguration config = listener.getListenerConfiguration();
ProbeFilter filter = config.getTransformerData(EXCEPTION_FILTER_KEY);
if (filter.isBasicFilter() && filter.basicClassNameMatches(exceptionType.getClassName())) {
filtered.add(listener);
} else if (filter.isAdvancedFilter()) {
Class<?> clazz = getOwningClass(exceptionType.getInternalName());
if (clazz != null && filter.matches(clazz)) {
filtered.add(listener);
}
}
}
if (filtered.isEmpty()) {
return;
}
String key = createKey(exceptionType);
ProbeImpl probe = getProbe(key);
long probeId = probe.getIdentifier();
setProbeInProgress(true);
visitInsn(DUP); // throwable throwable
visitLdcInsn(Long.valueOf(probeId)); // throwable throwable long1 long2
visitInsn(DUP2_X1); // throwable long1 long2 throwable long1 long2
visitInsn(POP2); // throwable long1 long2 throwable
if (isStatic()) {
visitInsn(ACONST_NULL); // throwable long1 long2 throwable this
} else {
visitVarInsn(ALOAD, 0); // throwable long1 long2 throwable this
}
visitInsn(SWAP); // throwable long1 long2 this throwable
visitInsn(ACONST_NULL); // throwable long1 long2 this throwable null
visitInsn(SWAP); // throwable long1 long2 this null throwable
visitFireProbeInvocation(); // throwable
setProbeInProgress(false);
setProbeListeners(probe, filtered);
}
} | [
"private",
"void",
"onHandlerEntry",
"(",
")",
"{",
"if",
"(",
"enabled",
")",
"{",
"Type",
"exceptionType",
"=",
"handlers",
".",
"get",
"(",
"handlerPendingInstruction",
")",
";",
"// Clear the pending instruction flag",
"handlerPendingInstruction",
"=",
"null",
";",
"// Filter the interested down to this exception",
"Set",
"<",
"ProbeListener",
">",
"filtered",
"=",
"new",
"HashSet",
"<",
"ProbeListener",
">",
"(",
")",
";",
"for",
"(",
"ProbeListener",
"listener",
":",
"enabledListeners",
")",
"{",
"ListenerConfiguration",
"config",
"=",
"listener",
".",
"getListenerConfiguration",
"(",
")",
";",
"ProbeFilter",
"filter",
"=",
"config",
".",
"getTransformerData",
"(",
"EXCEPTION_FILTER_KEY",
")",
";",
"if",
"(",
"filter",
".",
"isBasicFilter",
"(",
")",
"&&",
"filter",
".",
"basicClassNameMatches",
"(",
"exceptionType",
".",
"getClassName",
"(",
")",
")",
")",
"{",
"filtered",
".",
"add",
"(",
"listener",
")",
";",
"}",
"else",
"if",
"(",
"filter",
".",
"isAdvancedFilter",
"(",
")",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"getOwningClass",
"(",
"exceptionType",
".",
"getInternalName",
"(",
")",
")",
";",
"if",
"(",
"clazz",
"!=",
"null",
"&&",
"filter",
".",
"matches",
"(",
"clazz",
")",
")",
"{",
"filtered",
".",
"add",
"(",
"listener",
")",
";",
"}",
"}",
"}",
"if",
"(",
"filtered",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"String",
"key",
"=",
"createKey",
"(",
"exceptionType",
")",
";",
"ProbeImpl",
"probe",
"=",
"getProbe",
"(",
"key",
")",
";",
"long",
"probeId",
"=",
"probe",
".",
"getIdentifier",
"(",
")",
";",
"setProbeInProgress",
"(",
"true",
")",
";",
"visitInsn",
"(",
"DUP",
")",
";",
"// throwable throwable",
"visitLdcInsn",
"(",
"Long",
".",
"valueOf",
"(",
"probeId",
")",
")",
";",
"// throwable throwable long1 long2",
"visitInsn",
"(",
"DUP2_X1",
")",
";",
"// throwable long1 long2 throwable long1 long2",
"visitInsn",
"(",
"POP2",
")",
";",
"// throwable long1 long2 throwable",
"if",
"(",
"isStatic",
"(",
")",
")",
"{",
"visitInsn",
"(",
"ACONST_NULL",
")",
";",
"// throwable long1 long2 throwable this",
"}",
"else",
"{",
"visitVarInsn",
"(",
"ALOAD",
",",
"0",
")",
";",
"// throwable long1 long2 throwable this",
"}",
"visitInsn",
"(",
"SWAP",
")",
";",
"// throwable long1 long2 this throwable",
"visitInsn",
"(",
"ACONST_NULL",
")",
";",
"// throwable long1 long2 this throwable null",
"visitInsn",
"(",
"SWAP",
")",
";",
"// throwable long1 long2 this null throwable",
"visitFireProbeInvocation",
"(",
")",
";",
"// throwable",
"setProbeInProgress",
"(",
"false",
")",
";",
"setProbeListeners",
"(",
"probe",
",",
"filtered",
")",
";",
"}",
"}"
] | Generate the code required to fire a probe out of an exception
handler. | [
"Generate",
"the",
"code",
"required",
"to",
"fire",
"a",
"probe",
"out",
"of",
"an",
"exception",
"handler",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeAtCatchMethodAdapter.java#L123-L171 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/FileLock.java | FileLock.getFileLock | public static FileLock getFileLock(java.io.RandomAccessFile file, String fileName) throws java.io.IOException
{
return (FileLock) Utils.getImpl("com.ibm.ws.objectManager.utils.FileLockImpl",
new Class[] { java.io.RandomAccessFile.class, String.class },
new Object[] { file, fileName });
} | java | public static FileLock getFileLock(java.io.RandomAccessFile file, String fileName) throws java.io.IOException
{
return (FileLock) Utils.getImpl("com.ibm.ws.objectManager.utils.FileLockImpl",
new Class[] { java.io.RandomAccessFile.class, String.class },
new Object[] { file, fileName });
} | [
"public",
"static",
"FileLock",
"getFileLock",
"(",
"java",
".",
"io",
".",
"RandomAccessFile",
"file",
",",
"String",
"fileName",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
"{",
"return",
"(",
"FileLock",
")",
"Utils",
".",
"getImpl",
"(",
"\"com.ibm.ws.objectManager.utils.FileLockImpl\"",
",",
"new",
"Class",
"[",
"]",
"{",
"java",
".",
"io",
".",
"RandomAccessFile",
".",
"class",
",",
"String",
".",
"class",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"file",
",",
"fileName",
"}",
")",
";",
"}"
] | Create a platform specific FileLock instance.
@param file to be locked. The file must be already open.
@param fileName of the file.
@return FileLock for the file.
@throws java.io.IOException | [
"Create",
"a",
"platform",
"specific",
"FileLock",
"instance",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/FileLock.java#L33-L38 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/ViewPoolProcessor.java | ViewPoolProcessor.initialize | public static void initialize(FacesContext context)
{
if (context.isProjectStage(ProjectStage.Production))
{
boolean initialize = true;
String elMode = WebConfigParamUtils.getStringInitParameter(
context.getExternalContext(),
FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS,
ELExpressionCacheMode.noCache.name());
if (!elMode.equals(ELExpressionCacheMode.alwaysRecompile.name()))
{
Logger.getLogger(ViewPoolProcessor.class.getName()).log(
Level.INFO, FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS +
" web config parameter is set to \"" + ( (elMode == null) ? "none" : elMode) +
"\". To enable view pooling this param"+
" must be set to \"alwaysRecompile\". View Pooling disabled.");
initialize = false;
}
long refreshPeriod = WebConfigParamUtils.getLongInitParameter(context.getExternalContext(),
FaceletViewDeclarationLanguage.PARAMS_REFRESH_PERIOD,
FaceletViewDeclarationLanguage.DEFAULT_REFRESH_PERIOD_PRODUCTION);
if (refreshPeriod != -1)
{
Logger.getLogger(ViewPoolProcessor.class.getName()).log(
Level.INFO, ViewHandler.FACELETS_REFRESH_PERIOD_PARAM_NAME +
" web config parameter is set to \"" + Long.toString(refreshPeriod) +
"\". To enable view pooling this param"+
" must be set to \"-1\". View Pooling disabled.");
initialize = false;
}
if (MyfacesConfig.getCurrentInstance(context.getExternalContext()).isStrictJsf2FaceletsCompatibility())
{
Logger.getLogger(ViewPoolProcessor.class.getName()).log(
Level.INFO, MyfacesConfig.INIT_PARAM_STRICT_JSF_2_FACELETS_COMPATIBILITY +
" web config parameter is set to \"" + "true" +
"\". To enable view pooling this param "+
" must be set to \"false\". View Pooling disabled.");
initialize = false;
}
if (initialize)
{
ViewPoolProcessor processor = new ViewPoolProcessor(context);
context.getExternalContext().
getApplicationMap().put(INSTANCE, processor);
}
}
} | java | public static void initialize(FacesContext context)
{
if (context.isProjectStage(ProjectStage.Production))
{
boolean initialize = true;
String elMode = WebConfigParamUtils.getStringInitParameter(
context.getExternalContext(),
FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS,
ELExpressionCacheMode.noCache.name());
if (!elMode.equals(ELExpressionCacheMode.alwaysRecompile.name()))
{
Logger.getLogger(ViewPoolProcessor.class.getName()).log(
Level.INFO, FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS +
" web config parameter is set to \"" + ( (elMode == null) ? "none" : elMode) +
"\". To enable view pooling this param"+
" must be set to \"alwaysRecompile\". View Pooling disabled.");
initialize = false;
}
long refreshPeriod = WebConfigParamUtils.getLongInitParameter(context.getExternalContext(),
FaceletViewDeclarationLanguage.PARAMS_REFRESH_PERIOD,
FaceletViewDeclarationLanguage.DEFAULT_REFRESH_PERIOD_PRODUCTION);
if (refreshPeriod != -1)
{
Logger.getLogger(ViewPoolProcessor.class.getName()).log(
Level.INFO, ViewHandler.FACELETS_REFRESH_PERIOD_PARAM_NAME +
" web config parameter is set to \"" + Long.toString(refreshPeriod) +
"\". To enable view pooling this param"+
" must be set to \"-1\". View Pooling disabled.");
initialize = false;
}
if (MyfacesConfig.getCurrentInstance(context.getExternalContext()).isStrictJsf2FaceletsCompatibility())
{
Logger.getLogger(ViewPoolProcessor.class.getName()).log(
Level.INFO, MyfacesConfig.INIT_PARAM_STRICT_JSF_2_FACELETS_COMPATIBILITY +
" web config parameter is set to \"" + "true" +
"\". To enable view pooling this param "+
" must be set to \"false\". View Pooling disabled.");
initialize = false;
}
if (initialize)
{
ViewPoolProcessor processor = new ViewPoolProcessor(context);
context.getExternalContext().
getApplicationMap().put(INSTANCE, processor);
}
}
} | [
"public",
"static",
"void",
"initialize",
"(",
"FacesContext",
"context",
")",
"{",
"if",
"(",
"context",
".",
"isProjectStage",
"(",
"ProjectStage",
".",
"Production",
")",
")",
"{",
"boolean",
"initialize",
"=",
"true",
";",
"String",
"elMode",
"=",
"WebConfigParamUtils",
".",
"getStringInitParameter",
"(",
"context",
".",
"getExternalContext",
"(",
")",
",",
"FaceletCompositionContextImpl",
".",
"INIT_PARAM_CACHE_EL_EXPRESSIONS",
",",
"ELExpressionCacheMode",
".",
"noCache",
".",
"name",
"(",
")",
")",
";",
"if",
"(",
"!",
"elMode",
".",
"equals",
"(",
"ELExpressionCacheMode",
".",
"alwaysRecompile",
".",
"name",
"(",
")",
")",
")",
"{",
"Logger",
".",
"getLogger",
"(",
"ViewPoolProcessor",
".",
"class",
".",
"getName",
"(",
")",
")",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"FaceletCompositionContextImpl",
".",
"INIT_PARAM_CACHE_EL_EXPRESSIONS",
"+",
"\" web config parameter is set to \\\"\"",
"+",
"(",
"(",
"elMode",
"==",
"null",
")",
"?",
"\"none\"",
":",
"elMode",
")",
"+",
"\"\\\". To enable view pooling this param\"",
"+",
"\" must be set to \\\"alwaysRecompile\\\". View Pooling disabled.\"",
")",
";",
"initialize",
"=",
"false",
";",
"}",
"long",
"refreshPeriod",
"=",
"WebConfigParamUtils",
".",
"getLongInitParameter",
"(",
"context",
".",
"getExternalContext",
"(",
")",
",",
"FaceletViewDeclarationLanguage",
".",
"PARAMS_REFRESH_PERIOD",
",",
"FaceletViewDeclarationLanguage",
".",
"DEFAULT_REFRESH_PERIOD_PRODUCTION",
")",
";",
"if",
"(",
"refreshPeriod",
"!=",
"-",
"1",
")",
"{",
"Logger",
".",
"getLogger",
"(",
"ViewPoolProcessor",
".",
"class",
".",
"getName",
"(",
")",
")",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"ViewHandler",
".",
"FACELETS_REFRESH_PERIOD_PARAM_NAME",
"+",
"\" web config parameter is set to \\\"\"",
"+",
"Long",
".",
"toString",
"(",
"refreshPeriod",
")",
"+",
"\"\\\". To enable view pooling this param\"",
"+",
"\" must be set to \\\"-1\\\". View Pooling disabled.\"",
")",
";",
"initialize",
"=",
"false",
";",
"}",
"if",
"(",
"MyfacesConfig",
".",
"getCurrentInstance",
"(",
"context",
".",
"getExternalContext",
"(",
")",
")",
".",
"isStrictJsf2FaceletsCompatibility",
"(",
")",
")",
"{",
"Logger",
".",
"getLogger",
"(",
"ViewPoolProcessor",
".",
"class",
".",
"getName",
"(",
")",
")",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"MyfacesConfig",
".",
"INIT_PARAM_STRICT_JSF_2_FACELETS_COMPATIBILITY",
"+",
"\" web config parameter is set to \\\"\"",
"+",
"\"true\"",
"+",
"\"\\\". To enable view pooling this param \"",
"+",
"\" must be set to \\\"false\\\". View Pooling disabled.\"",
")",
";",
"initialize",
"=",
"false",
";",
"}",
"if",
"(",
"initialize",
")",
"{",
"ViewPoolProcessor",
"processor",
"=",
"new",
"ViewPoolProcessor",
"(",
"context",
")",
";",
"context",
".",
"getExternalContext",
"(",
")",
".",
"getApplicationMap",
"(",
")",
".",
"put",
"(",
"INSTANCE",
",",
"processor",
")",
";",
"}",
"}",
"}"
] | This method should be called at startup to decide if a view processor should be
provided or not to the runtime.
@param context | [
"This",
"method",
"should",
"be",
"called",
"at",
"startup",
"to",
"decide",
"if",
"a",
"view",
"processor",
"should",
"be",
"provided",
"or",
"not",
"to",
"the",
"runtime",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/ViewPoolProcessor.java#L162-L212 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/ViewPoolProcessor.java | ViewPoolProcessor.clearTransientAndNonFaceletComponents | private void clearTransientAndNonFaceletComponents(final FacesContext context, final UIComponent component)
{
//Scan children
int childCount = component.getChildCount();
if (childCount > 0)
{
for (int i = 0; i < childCount; i++)
{
UIComponent child = component.getChildren().get(i);
if (child != null && child.isTransient() &&
child.getAttributes().get(ComponentSupport.MARK_CREATED) == null)
{
component.getChildren().remove(i);
i--;
childCount--;
}
else
{
if (child.getChildCount() > 0 || !child.getFacets().isEmpty())
{
clearTransientAndNonFaceletComponents(context, child);
}
}
}
}
//Scan facets
if (component.getFacetCount() > 0)
{
Map<String, UIComponent> facets = component.getFacets();
for (Iterator<UIComponent> itr = facets.values().iterator(); itr.hasNext();)
{
UIComponent fc = itr.next();
if (fc != null && fc.isTransient() &&
fc.getAttributes().get(ComponentSupport.MARK_CREATED) == null)
{
itr.remove();
}
else
{
if (fc.getChildCount() > 0 || !fc.getFacets().isEmpty())
{
clearTransientAndNonFaceletComponents(context, fc);
}
}
}
}
} | java | private void clearTransientAndNonFaceletComponents(final FacesContext context, final UIComponent component)
{
//Scan children
int childCount = component.getChildCount();
if (childCount > 0)
{
for (int i = 0; i < childCount; i++)
{
UIComponent child = component.getChildren().get(i);
if (child != null && child.isTransient() &&
child.getAttributes().get(ComponentSupport.MARK_CREATED) == null)
{
component.getChildren().remove(i);
i--;
childCount--;
}
else
{
if (child.getChildCount() > 0 || !child.getFacets().isEmpty())
{
clearTransientAndNonFaceletComponents(context, child);
}
}
}
}
//Scan facets
if (component.getFacetCount() > 0)
{
Map<String, UIComponent> facets = component.getFacets();
for (Iterator<UIComponent> itr = facets.values().iterator(); itr.hasNext();)
{
UIComponent fc = itr.next();
if (fc != null && fc.isTransient() &&
fc.getAttributes().get(ComponentSupport.MARK_CREATED) == null)
{
itr.remove();
}
else
{
if (fc.getChildCount() > 0 || !fc.getFacets().isEmpty())
{
clearTransientAndNonFaceletComponents(context, fc);
}
}
}
}
} | [
"private",
"void",
"clearTransientAndNonFaceletComponents",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"UIComponent",
"component",
")",
"{",
"//Scan children",
"int",
"childCount",
"=",
"component",
".",
"getChildCount",
"(",
")",
";",
"if",
"(",
"childCount",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"childCount",
";",
"i",
"++",
")",
"{",
"UIComponent",
"child",
"=",
"component",
".",
"getChildren",
"(",
")",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"child",
"!=",
"null",
"&&",
"child",
".",
"isTransient",
"(",
")",
"&&",
"child",
".",
"getAttributes",
"(",
")",
".",
"get",
"(",
"ComponentSupport",
".",
"MARK_CREATED",
")",
"==",
"null",
")",
"{",
"component",
".",
"getChildren",
"(",
")",
".",
"remove",
"(",
"i",
")",
";",
"i",
"--",
";",
"childCount",
"--",
";",
"}",
"else",
"{",
"if",
"(",
"child",
".",
"getChildCount",
"(",
")",
">",
"0",
"||",
"!",
"child",
".",
"getFacets",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"clearTransientAndNonFaceletComponents",
"(",
"context",
",",
"child",
")",
";",
"}",
"}",
"}",
"}",
"//Scan facets",
"if",
"(",
"component",
".",
"getFacetCount",
"(",
")",
">",
"0",
")",
"{",
"Map",
"<",
"String",
",",
"UIComponent",
">",
"facets",
"=",
"component",
".",
"getFacets",
"(",
")",
";",
"for",
"(",
"Iterator",
"<",
"UIComponent",
">",
"itr",
"=",
"facets",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"itr",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"UIComponent",
"fc",
"=",
"itr",
".",
"next",
"(",
")",
";",
"if",
"(",
"fc",
"!=",
"null",
"&&",
"fc",
".",
"isTransient",
"(",
")",
"&&",
"fc",
".",
"getAttributes",
"(",
")",
".",
"get",
"(",
"ComponentSupport",
".",
"MARK_CREATED",
")",
"==",
"null",
")",
"{",
"itr",
".",
"remove",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"fc",
".",
"getChildCount",
"(",
")",
">",
"0",
"||",
"!",
"fc",
".",
"getFacets",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"clearTransientAndNonFaceletComponents",
"(",
"context",
",",
"fc",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | Clear all transient components not created by facelets algorithm. In this way,
we ensure the component tree does not have any changes done after markInitialState.
@param context
@param component | [
"Clear",
"all",
"transient",
"components",
"not",
"created",
"by",
"facelets",
"algorithm",
".",
"In",
"this",
"way",
"we",
"ensure",
"the",
"component",
"tree",
"does",
"not",
"have",
"any",
"changes",
"done",
"after",
"markInitialState",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/ViewPoolProcessor.java#L712-L759 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transaction.cdi/src/com/ibm/tx/jta/cdi/TransactionContext.java | TransactionContext.destroy | @Override
public void destroy() {
if (tc.isEntryEnabled())
Tr.entry(tc, "destroy", this);
// check the TSR is active - otherwise we can trigger exceptions when we
// try to get data out of it.
if (tsr.getTransactionKey() != null) {
final Map<String, InstanceAndContext<?>> storage = getStorage(false);
if (storage != null) {
try {
for (InstanceAndContext<?> entry : storage.values()) {
final String id = getContextualId(entry.context);
destroyItem(id, entry);
}
} finally {
tsr.putResource(TXC_STORAGE_ID, null);
}
}
} else {
if (tc.isDebugEnabled())
Tr.debug(tc, "Tran synchronization registry not available, skipping destroy");
}
//Fire any observers
beanManager.fireEvent("Destroying transaction context", destroyedQualifier);
if (tc.isEntryEnabled())
Tr.exit(tc, "destroy");
} | java | @Override
public void destroy() {
if (tc.isEntryEnabled())
Tr.entry(tc, "destroy", this);
// check the TSR is active - otherwise we can trigger exceptions when we
// try to get data out of it.
if (tsr.getTransactionKey() != null) {
final Map<String, InstanceAndContext<?>> storage = getStorage(false);
if (storage != null) {
try {
for (InstanceAndContext<?> entry : storage.values()) {
final String id = getContextualId(entry.context);
destroyItem(id, entry);
}
} finally {
tsr.putResource(TXC_STORAGE_ID, null);
}
}
} else {
if (tc.isDebugEnabled())
Tr.debug(tc, "Tran synchronization registry not available, skipping destroy");
}
//Fire any observers
beanManager.fireEvent("Destroying transaction context", destroyedQualifier);
if (tc.isEntryEnabled())
Tr.exit(tc, "destroy");
} | [
"@",
"Override",
"public",
"void",
"destroy",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"destroy\"",
",",
"this",
")",
";",
"// check the TSR is active - otherwise we can trigger exceptions when we",
"// try to get data out of it.",
"if",
"(",
"tsr",
".",
"getTransactionKey",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"InstanceAndContext",
"<",
"?",
">",
">",
"storage",
"=",
"getStorage",
"(",
"false",
")",
";",
"if",
"(",
"storage",
"!=",
"null",
")",
"{",
"try",
"{",
"for",
"(",
"InstanceAndContext",
"<",
"?",
">",
"entry",
":",
"storage",
".",
"values",
"(",
")",
")",
"{",
"final",
"String",
"id",
"=",
"getContextualId",
"(",
"entry",
".",
"context",
")",
";",
"destroyItem",
"(",
"id",
",",
"entry",
")",
";",
"}",
"}",
"finally",
"{",
"tsr",
".",
"putResource",
"(",
"TXC_STORAGE_ID",
",",
"null",
")",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Tran synchronization registry not available, skipping destroy\"",
")",
";",
"}",
"//Fire any observers",
"beanManager",
".",
"fireEvent",
"(",
"\"Destroying transaction context\"",
",",
"destroyedQualifier",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"destroy\"",
")",
";",
"}"
] | Destroy the entire context. This causes @PreDestroy annotated methods to be
called on all the bean instances that this scope has created. | [
"Destroy",
"the",
"entire",
"context",
".",
"This",
"causes"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transaction.cdi/src/com/ibm/tx/jta/cdi/TransactionContext.java#L186-L216 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl.doPrePhaseActions | @Override
public void doPrePhaseActions(FacesContext facesContext)
{
if (!_flashScopeDisabled)
{
final PhaseId currentPhaseId = facesContext.getCurrentPhaseId();
if (PhaseId.RESTORE_VIEW.equals(currentPhaseId))
{
// restore the redirect value
// note that the result of this method is used in many places,
// thus it has to be the first thing to do
_restoreRedirectValue(facesContext);
// restore the FlashMap token from the previous request
// and create a new token for this request
_manageFlashMapTokens(facesContext);
// try to restore any saved messages
_restoreMessages(facesContext);
}
}
} | java | @Override
public void doPrePhaseActions(FacesContext facesContext)
{
if (!_flashScopeDisabled)
{
final PhaseId currentPhaseId = facesContext.getCurrentPhaseId();
if (PhaseId.RESTORE_VIEW.equals(currentPhaseId))
{
// restore the redirect value
// note that the result of this method is used in many places,
// thus it has to be the first thing to do
_restoreRedirectValue(facesContext);
// restore the FlashMap token from the previous request
// and create a new token for this request
_manageFlashMapTokens(facesContext);
// try to restore any saved messages
_restoreMessages(facesContext);
}
}
} | [
"@",
"Override",
"public",
"void",
"doPrePhaseActions",
"(",
"FacesContext",
"facesContext",
")",
"{",
"if",
"(",
"!",
"_flashScopeDisabled",
")",
"{",
"final",
"PhaseId",
"currentPhaseId",
"=",
"facesContext",
".",
"getCurrentPhaseId",
"(",
")",
";",
"if",
"(",
"PhaseId",
".",
"RESTORE_VIEW",
".",
"equals",
"(",
"currentPhaseId",
")",
")",
"{",
"// restore the redirect value",
"// note that the result of this method is used in many places, ",
"// thus it has to be the first thing to do",
"_restoreRedirectValue",
"(",
"facesContext",
")",
";",
"// restore the FlashMap token from the previous request",
"// and create a new token for this request",
"_manageFlashMapTokens",
"(",
"facesContext",
")",
";",
"// try to restore any saved messages",
"_restoreMessages",
"(",
"facesContext",
")",
";",
"}",
"}",
"}"
] | Used to restore the redirect value and the FacesMessages of the previous
request and to manage the flashMap tokens for this request before phase
restore view starts. | [
"Used",
"to",
"restore",
"the",
"redirect",
"value",
"and",
"the",
"FacesMessages",
"of",
"the",
"previous",
"request",
"and",
"to",
"manage",
"the",
"flashMap",
"tokens",
"for",
"this",
"request",
"before",
"phase",
"restore",
"view",
"starts",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L211-L233 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl.isRedirect | @Override
public boolean isRedirect()
{
FacesContext facesContext = FacesContext.getCurrentInstance();
boolean thisRedirect = _isRedirectTrueOnThisRequest(facesContext);
boolean prevRedirect = _isRedirectTrueOnPreviousRequest(facesContext);
boolean executePhase = !PhaseId.RENDER_RESPONSE.equals(facesContext.getCurrentPhaseId());
return thisRedirect || (executePhase && prevRedirect);
} | java | @Override
public boolean isRedirect()
{
FacesContext facesContext = FacesContext.getCurrentInstance();
boolean thisRedirect = _isRedirectTrueOnThisRequest(facesContext);
boolean prevRedirect = _isRedirectTrueOnPreviousRequest(facesContext);
boolean executePhase = !PhaseId.RENDER_RESPONSE.equals(facesContext.getCurrentPhaseId());
return thisRedirect || (executePhase && prevRedirect);
} | [
"@",
"Override",
"public",
"boolean",
"isRedirect",
"(",
")",
"{",
"FacesContext",
"facesContext",
"=",
"FacesContext",
".",
"getCurrentInstance",
"(",
")",
";",
"boolean",
"thisRedirect",
"=",
"_isRedirectTrueOnThisRequest",
"(",
"facesContext",
")",
";",
"boolean",
"prevRedirect",
"=",
"_isRedirectTrueOnPreviousRequest",
"(",
"facesContext",
")",
";",
"boolean",
"executePhase",
"=",
"!",
"PhaseId",
".",
"RENDER_RESPONSE",
".",
"equals",
"(",
"facesContext",
".",
"getCurrentPhaseId",
"(",
")",
")",
";",
"return",
"thisRedirect",
"||",
"(",
"executePhase",
"&&",
"prevRedirect",
")",
";",
"}"
] | Return the value of this property for the flash for this session.
This must be false unless:
- setRedirect(boolean) was called for the current lifecycle traversal
with true as the argument.
- The current lifecycle traversal for this session is in the "execute"
phase and the previous traversal had setRedirect(boolean) called with
true as the argument. | [
"Return",
"the",
"value",
"of",
"this",
"property",
"for",
"the",
"flash",
"for",
"this",
"session",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L288-L297 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl.keep | @Override
public void keep(String key)
{
_checkFlashScopeDisabled();
FacesContext facesContext = FacesContext.getCurrentInstance();
Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
Object value = requestMap.get(key);
// if the key does not exist in the requestMap,
// try to get it from the execute FlashMap
if (value == null)
{
Map<String, Object> executeMap = _getExecuteFlashMap(facesContext);
// Null-check, because in the GET request of a POST-REDIRECT-GET
// pattern there is no execute map
if (executeMap != null)
{
value = executeMap.get(key);
// Store it on request map so we can get it later. For example,
// this is used by org.apache.myfaces.el.FlashELResolver to return
// the value that has been promoted.
requestMap.put(key, value);
}
}
// put it in the render FlashMap
_getRenderFlashMap(facesContext).put(key, value);
facesContext.getApplication().publishEvent(facesContext,
PostKeepFlashValueEvent.class, key);
} | java | @Override
public void keep(String key)
{
_checkFlashScopeDisabled();
FacesContext facesContext = FacesContext.getCurrentInstance();
Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
Object value = requestMap.get(key);
// if the key does not exist in the requestMap,
// try to get it from the execute FlashMap
if (value == null)
{
Map<String, Object> executeMap = _getExecuteFlashMap(facesContext);
// Null-check, because in the GET request of a POST-REDIRECT-GET
// pattern there is no execute map
if (executeMap != null)
{
value = executeMap.get(key);
// Store it on request map so we can get it later. For example,
// this is used by org.apache.myfaces.el.FlashELResolver to return
// the value that has been promoted.
requestMap.put(key, value);
}
}
// put it in the render FlashMap
_getRenderFlashMap(facesContext).put(key, value);
facesContext.getApplication().publishEvent(facesContext,
PostKeepFlashValueEvent.class, key);
} | [
"@",
"Override",
"public",
"void",
"keep",
"(",
"String",
"key",
")",
"{",
"_checkFlashScopeDisabled",
"(",
")",
";",
"FacesContext",
"facesContext",
"=",
"FacesContext",
".",
"getCurrentInstance",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"requestMap",
"=",
"facesContext",
".",
"getExternalContext",
"(",
")",
".",
"getRequestMap",
"(",
")",
";",
"Object",
"value",
"=",
"requestMap",
".",
"get",
"(",
"key",
")",
";",
"// if the key does not exist in the requestMap,",
"// try to get it from the execute FlashMap",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"executeMap",
"=",
"_getExecuteFlashMap",
"(",
"facesContext",
")",
";",
"// Null-check, because in the GET request of a POST-REDIRECT-GET ",
"// pattern there is no execute map",
"if",
"(",
"executeMap",
"!=",
"null",
")",
"{",
"value",
"=",
"executeMap",
".",
"get",
"(",
"key",
")",
";",
"// Store it on request map so we can get it later. For example, ",
"// this is used by org.apache.myfaces.el.FlashELResolver to return",
"// the value that has been promoted.",
"requestMap",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"}",
"// put it in the render FlashMap",
"_getRenderFlashMap",
"(",
"facesContext",
")",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"facesContext",
".",
"getApplication",
"(",
")",
".",
"publishEvent",
"(",
"facesContext",
",",
"PostKeepFlashValueEvent",
".",
"class",
",",
"key",
")",
";",
"}"
] | Take a value from the requestMap, or if it does not exist from the
execute FlashMap, and put it on the render FlashMap, so it is visible on
the next request. | [
"Take",
"a",
"value",
"from",
"the",
"requestMap",
"or",
"if",
"it",
"does",
"not",
"exist",
"from",
"the",
"execute",
"FlashMap",
"and",
"put",
"it",
"on",
"the",
"render",
"FlashMap",
"so",
"it",
"is",
"visible",
"on",
"the",
"next",
"request",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L344-L374 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl.putNow | @Override
public void putNow(String key, Object value)
{
_checkFlashScopeDisabled();
FacesContext.getCurrentInstance().getExternalContext()
.getRequestMap().put(key, value);
} | java | @Override
public void putNow(String key, Object value)
{
_checkFlashScopeDisabled();
FacesContext.getCurrentInstance().getExternalContext()
.getRequestMap().put(key, value);
} | [
"@",
"Override",
"public",
"void",
"putNow",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"_checkFlashScopeDisabled",
"(",
")",
";",
"FacesContext",
".",
"getCurrentInstance",
"(",
")",
".",
"getExternalContext",
"(",
")",
".",
"getRequestMap",
"(",
")",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | This is just an alias for the request scope map. | [
"This",
"is",
"just",
"an",
"alias",
"for",
"the",
"request",
"scope",
"map",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L379-L385 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl.setKeepMessages | @Override
public void setKeepMessages(boolean keepMessages)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
Map<String, Object> requestMap = externalContext.getRequestMap();
requestMap.put(FLASH_KEEP_MESSAGES, keepMessages);
} | java | @Override
public void setKeepMessages(boolean keepMessages)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
Map<String, Object> requestMap = externalContext.getRequestMap();
requestMap.put(FLASH_KEEP_MESSAGES, keepMessages);
} | [
"@",
"Override",
"public",
"void",
"setKeepMessages",
"(",
"boolean",
"keepMessages",
")",
"{",
"FacesContext",
"facesContext",
"=",
"FacesContext",
".",
"getCurrentInstance",
"(",
")",
";",
"ExternalContext",
"externalContext",
"=",
"facesContext",
".",
"getExternalContext",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"requestMap",
"=",
"externalContext",
".",
"getRequestMap",
"(",
")",
";",
"requestMap",
".",
"put",
"(",
"FLASH_KEEP_MESSAGES",
",",
"keepMessages",
")",
";",
"}"
] | If this property is true, the messages should be kept for the next
request, no matter if it is a normal postback case or a POST-
REDIRECT-GET case.
Note that we don't have to store this value for the next request
(like setRedirect()), because we will know if it was true on the
next request, if we can find any stored messages in the FlashMap.
(also see _saveMessages() and _restoreMessages()). | [
"If",
"this",
"property",
"is",
"true",
"the",
"messages",
"should",
"be",
"kept",
"for",
"the",
"next",
"request",
"no",
"matter",
"if",
"it",
"is",
"a",
"normal",
"postback",
"case",
"or",
"a",
"POST",
"-",
"REDIRECT",
"-",
"GET",
"case",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L412-L419 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl._restoreMessages | @SuppressWarnings("unchecked")
private void _restoreMessages(FacesContext facesContext)
{
List<MessageEntry> messageList = (List<MessageEntry>)
_getExecuteFlashMap(facesContext).get(FLASH_KEEP_MESSAGES_LIST);
if (messageList != null)
{
Iterator<MessageEntry> iterMessages = messageList.iterator();
while (iterMessages.hasNext())
{
MessageEntry entry = iterMessages.next();
facesContext.addMessage(entry.clientId, entry.message);
}
// we can now remove the messagesList from the flashMap
_getExecuteFlashMap(facesContext).remove(FLASH_KEEP_MESSAGES_LIST);
}
} | java | @SuppressWarnings("unchecked")
private void _restoreMessages(FacesContext facesContext)
{
List<MessageEntry> messageList = (List<MessageEntry>)
_getExecuteFlashMap(facesContext).get(FLASH_KEEP_MESSAGES_LIST);
if (messageList != null)
{
Iterator<MessageEntry> iterMessages = messageList.iterator();
while (iterMessages.hasNext())
{
MessageEntry entry = iterMessages.next();
facesContext.addMessage(entry.clientId, entry.message);
}
// we can now remove the messagesList from the flashMap
_getExecuteFlashMap(facesContext).remove(FLASH_KEEP_MESSAGES_LIST);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"_restoreMessages",
"(",
"FacesContext",
"facesContext",
")",
"{",
"List",
"<",
"MessageEntry",
">",
"messageList",
"=",
"(",
"List",
"<",
"MessageEntry",
">",
")",
"_getExecuteFlashMap",
"(",
"facesContext",
")",
".",
"get",
"(",
"FLASH_KEEP_MESSAGES_LIST",
")",
";",
"if",
"(",
"messageList",
"!=",
"null",
")",
"{",
"Iterator",
"<",
"MessageEntry",
">",
"iterMessages",
"=",
"messageList",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterMessages",
".",
"hasNext",
"(",
")",
")",
"{",
"MessageEntry",
"entry",
"=",
"iterMessages",
".",
"next",
"(",
")",
";",
"facesContext",
".",
"addMessage",
"(",
"entry",
".",
"clientId",
",",
"entry",
".",
"message",
")",
";",
"}",
"// we can now remove the messagesList from the flashMap",
"_getExecuteFlashMap",
"(",
"facesContext",
")",
".",
"remove",
"(",
"FLASH_KEEP_MESSAGES_LIST",
")",
";",
"}",
"}"
] | Restore any saved FacesMessages from the previous request.
Note that we don't need to save the keepMessages value for this request,
because we just have to check if the value for FLASH_KEEP_MESSAGES_LIST exists.
@param facesContext | [
"Restore",
"any",
"saved",
"FacesMessages",
"from",
"the",
"previous",
"request",
".",
"Note",
"that",
"we",
"don",
"t",
"need",
"to",
"save",
"the",
"keepMessages",
"value",
"for",
"this",
"request",
"because",
"we",
"just",
"have",
"to",
"check",
"if",
"the",
"value",
"for",
"FLASH_KEEP_MESSAGES_LIST",
"exists",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L725-L744 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl._saveRenderFlashMapTokenForNextRequest | private void _saveRenderFlashMapTokenForNextRequest(FacesContext facesContext)
{
ExternalContext externalContext = facesContext.getExternalContext();
String tokenValue = (String) externalContext.getRequestMap().get(FLASH_RENDER_MAP_TOKEN);
ClientWindow clientWindow = externalContext.getClientWindow();
if (clientWindow != null)
{
if (facesContext.getApplication().getStateManager().isSavingStateInClient(facesContext))
{
//Use HttpSession or PortletSession object
Map<String, Object> sessionMap = externalContext.getSessionMap();
sessionMap.put(FLASH_RENDER_MAP_TOKEN+SEPARATOR_CHAR+clientWindow.getId(), tokenValue);
}
else
{
FlashClientWindowTokenCollection lruMap = getFlashClientWindowTokenCollection(externalContext, true);
lruMap.put(clientWindow.getId(), tokenValue);
}
}
else
{
HttpServletResponse httpResponse = ExternalContextUtils.getHttpServletResponse(externalContext);
if (httpResponse != null)
{
Cookie cookie = _createFlashCookie(FLASH_RENDER_MAP_TOKEN, tokenValue, externalContext);
httpResponse.addCookie(cookie);
}
else
{
//Use HttpSession or PortletSession object
Map<String, Object> sessionMap = externalContext.getSessionMap();
sessionMap.put(FLASH_RENDER_MAP_TOKEN, tokenValue);
}
}
} | java | private void _saveRenderFlashMapTokenForNextRequest(FacesContext facesContext)
{
ExternalContext externalContext = facesContext.getExternalContext();
String tokenValue = (String) externalContext.getRequestMap().get(FLASH_RENDER_MAP_TOKEN);
ClientWindow clientWindow = externalContext.getClientWindow();
if (clientWindow != null)
{
if (facesContext.getApplication().getStateManager().isSavingStateInClient(facesContext))
{
//Use HttpSession or PortletSession object
Map<String, Object> sessionMap = externalContext.getSessionMap();
sessionMap.put(FLASH_RENDER_MAP_TOKEN+SEPARATOR_CHAR+clientWindow.getId(), tokenValue);
}
else
{
FlashClientWindowTokenCollection lruMap = getFlashClientWindowTokenCollection(externalContext, true);
lruMap.put(clientWindow.getId(), tokenValue);
}
}
else
{
HttpServletResponse httpResponse = ExternalContextUtils.getHttpServletResponse(externalContext);
if (httpResponse != null)
{
Cookie cookie = _createFlashCookie(FLASH_RENDER_MAP_TOKEN, tokenValue, externalContext);
httpResponse.addCookie(cookie);
}
else
{
//Use HttpSession or PortletSession object
Map<String, Object> sessionMap = externalContext.getSessionMap();
sessionMap.put(FLASH_RENDER_MAP_TOKEN, tokenValue);
}
}
} | [
"private",
"void",
"_saveRenderFlashMapTokenForNextRequest",
"(",
"FacesContext",
"facesContext",
")",
"{",
"ExternalContext",
"externalContext",
"=",
"facesContext",
".",
"getExternalContext",
"(",
")",
";",
"String",
"tokenValue",
"=",
"(",
"String",
")",
"externalContext",
".",
"getRequestMap",
"(",
")",
".",
"get",
"(",
"FLASH_RENDER_MAP_TOKEN",
")",
";",
"ClientWindow",
"clientWindow",
"=",
"externalContext",
".",
"getClientWindow",
"(",
")",
";",
"if",
"(",
"clientWindow",
"!=",
"null",
")",
"{",
"if",
"(",
"facesContext",
".",
"getApplication",
"(",
")",
".",
"getStateManager",
"(",
")",
".",
"isSavingStateInClient",
"(",
"facesContext",
")",
")",
"{",
"//Use HttpSession or PortletSession object",
"Map",
"<",
"String",
",",
"Object",
">",
"sessionMap",
"=",
"externalContext",
".",
"getSessionMap",
"(",
")",
";",
"sessionMap",
".",
"put",
"(",
"FLASH_RENDER_MAP_TOKEN",
"+",
"SEPARATOR_CHAR",
"+",
"clientWindow",
".",
"getId",
"(",
")",
",",
"tokenValue",
")",
";",
"}",
"else",
"{",
"FlashClientWindowTokenCollection",
"lruMap",
"=",
"getFlashClientWindowTokenCollection",
"(",
"externalContext",
",",
"true",
")",
";",
"lruMap",
".",
"put",
"(",
"clientWindow",
".",
"getId",
"(",
")",
",",
"tokenValue",
")",
";",
"}",
"}",
"else",
"{",
"HttpServletResponse",
"httpResponse",
"=",
"ExternalContextUtils",
".",
"getHttpServletResponse",
"(",
"externalContext",
")",
";",
"if",
"(",
"httpResponse",
"!=",
"null",
")",
"{",
"Cookie",
"cookie",
"=",
"_createFlashCookie",
"(",
"FLASH_RENDER_MAP_TOKEN",
",",
"tokenValue",
",",
"externalContext",
")",
";",
"httpResponse",
".",
"addCookie",
"(",
"cookie",
")",
";",
"}",
"else",
"{",
"//Use HttpSession or PortletSession object",
"Map",
"<",
"String",
",",
"Object",
">",
"sessionMap",
"=",
"externalContext",
".",
"getSessionMap",
"(",
")",
";",
"sessionMap",
".",
"put",
"(",
"FLASH_RENDER_MAP_TOKEN",
",",
"tokenValue",
")",
";",
"}",
"}",
"}"
] | Take the render map key and store it as a key for the next request.
On the next request we can get it with _getRenderFlashMapTokenFromPreviousRequest().
@param externalContext | [
"Take",
"the",
"render",
"map",
"key",
"and",
"store",
"it",
"as",
"a",
"key",
"for",
"the",
"next",
"request",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L752-L786 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl._getRenderFlashMapTokenFromPreviousRequest | private String _getRenderFlashMapTokenFromPreviousRequest(FacesContext facesContext)
{
ExternalContext externalContext = facesContext.getExternalContext();
String tokenValue = null;
ClientWindow clientWindow = externalContext.getClientWindow();
if (clientWindow != null)
{
if (facesContext.getApplication().getStateManager().isSavingStateInClient(facesContext))
{
Map<String, Object> sessionMap = externalContext.getSessionMap();
tokenValue = (String) sessionMap.get(FLASH_RENDER_MAP_TOKEN+
SEPARATOR_CHAR+clientWindow.getId());
}
else
{
FlashClientWindowTokenCollection lruMap = getFlashClientWindowTokenCollection(externalContext, false);
if (lruMap != null)
{
tokenValue = (String) lruMap.get(clientWindow.getId());
}
}
}
else
{
HttpServletResponse httpResponse = ExternalContextUtils.getHttpServletResponse(externalContext);
if (httpResponse != null)
{
//Use a cookie
Cookie cookie = (Cookie) externalContext.getRequestCookieMap().get(FLASH_RENDER_MAP_TOKEN);
if (cookie != null)
{
tokenValue = cookie.getValue();
}
}
else
{
//Use HttpSession or PortletSession object
Map<String, Object> sessionMap = externalContext.getSessionMap();
tokenValue = (String) sessionMap.get(FLASH_RENDER_MAP_TOKEN);
}
}
return tokenValue;
} | java | private String _getRenderFlashMapTokenFromPreviousRequest(FacesContext facesContext)
{
ExternalContext externalContext = facesContext.getExternalContext();
String tokenValue = null;
ClientWindow clientWindow = externalContext.getClientWindow();
if (clientWindow != null)
{
if (facesContext.getApplication().getStateManager().isSavingStateInClient(facesContext))
{
Map<String, Object> sessionMap = externalContext.getSessionMap();
tokenValue = (String) sessionMap.get(FLASH_RENDER_MAP_TOKEN+
SEPARATOR_CHAR+clientWindow.getId());
}
else
{
FlashClientWindowTokenCollection lruMap = getFlashClientWindowTokenCollection(externalContext, false);
if (lruMap != null)
{
tokenValue = (String) lruMap.get(clientWindow.getId());
}
}
}
else
{
HttpServletResponse httpResponse = ExternalContextUtils.getHttpServletResponse(externalContext);
if (httpResponse != null)
{
//Use a cookie
Cookie cookie = (Cookie) externalContext.getRequestCookieMap().get(FLASH_RENDER_MAP_TOKEN);
if (cookie != null)
{
tokenValue = cookie.getValue();
}
}
else
{
//Use HttpSession or PortletSession object
Map<String, Object> sessionMap = externalContext.getSessionMap();
tokenValue = (String) sessionMap.get(FLASH_RENDER_MAP_TOKEN);
}
}
return tokenValue;
} | [
"private",
"String",
"_getRenderFlashMapTokenFromPreviousRequest",
"(",
"FacesContext",
"facesContext",
")",
"{",
"ExternalContext",
"externalContext",
"=",
"facesContext",
".",
"getExternalContext",
"(",
")",
";",
"String",
"tokenValue",
"=",
"null",
";",
"ClientWindow",
"clientWindow",
"=",
"externalContext",
".",
"getClientWindow",
"(",
")",
";",
"if",
"(",
"clientWindow",
"!=",
"null",
")",
"{",
"if",
"(",
"facesContext",
".",
"getApplication",
"(",
")",
".",
"getStateManager",
"(",
")",
".",
"isSavingStateInClient",
"(",
"facesContext",
")",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"sessionMap",
"=",
"externalContext",
".",
"getSessionMap",
"(",
")",
";",
"tokenValue",
"=",
"(",
"String",
")",
"sessionMap",
".",
"get",
"(",
"FLASH_RENDER_MAP_TOKEN",
"+",
"SEPARATOR_CHAR",
"+",
"clientWindow",
".",
"getId",
"(",
")",
")",
";",
"}",
"else",
"{",
"FlashClientWindowTokenCollection",
"lruMap",
"=",
"getFlashClientWindowTokenCollection",
"(",
"externalContext",
",",
"false",
")",
";",
"if",
"(",
"lruMap",
"!=",
"null",
")",
"{",
"tokenValue",
"=",
"(",
"String",
")",
"lruMap",
".",
"get",
"(",
"clientWindow",
".",
"getId",
"(",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"HttpServletResponse",
"httpResponse",
"=",
"ExternalContextUtils",
".",
"getHttpServletResponse",
"(",
"externalContext",
")",
";",
"if",
"(",
"httpResponse",
"!=",
"null",
")",
"{",
"//Use a cookie",
"Cookie",
"cookie",
"=",
"(",
"Cookie",
")",
"externalContext",
".",
"getRequestCookieMap",
"(",
")",
".",
"get",
"(",
"FLASH_RENDER_MAP_TOKEN",
")",
";",
"if",
"(",
"cookie",
"!=",
"null",
")",
"{",
"tokenValue",
"=",
"cookie",
".",
"getValue",
"(",
")",
";",
"}",
"}",
"else",
"{",
"//Use HttpSession or PortletSession object",
"Map",
"<",
"String",
",",
"Object",
">",
"sessionMap",
"=",
"externalContext",
".",
"getSessionMap",
"(",
")",
";",
"tokenValue",
"=",
"(",
"String",
")",
"sessionMap",
".",
"get",
"(",
"FLASH_RENDER_MAP_TOKEN",
")",
";",
"}",
"}",
"return",
"tokenValue",
";",
"}"
] | Retrieve the map token of the render map from the previous request.
Returns the value of _saveRenderFlashMapTokenForNextRequest() from
the previous request.
@param externalContext
@return | [
"Retrieve",
"the",
"map",
"token",
"of",
"the",
"render",
"map",
"from",
"the",
"previous",
"request",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L796-L838 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl._getRenderFlashMap | @SuppressWarnings("unchecked")
private Map<String, Object> _getRenderFlashMap(FacesContext context)
{
// Note that we don't have to synchronize here, because it is no problem
// if we create more SubKeyMaps with the same subkey, because they are
// totally equal and point to the same entries in the SessionMap.
Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
Map<String, Object> map = (Map<String, Object>) requestMap.get(FLASH_RENDER_MAP);
if (map == null)
{
String token = (String) requestMap.get(FLASH_RENDER_MAP_TOKEN);
String fullToken = FLASH_SESSION_MAP_SUBKEY_PREFIX + SEPARATOR_CHAR + token + SEPARATOR_CHAR;
map = _createSubKeyMap(context, fullToken);
requestMap.put(FLASH_RENDER_MAP, map);
}
return map;
} | java | @SuppressWarnings("unchecked")
private Map<String, Object> _getRenderFlashMap(FacesContext context)
{
// Note that we don't have to synchronize here, because it is no problem
// if we create more SubKeyMaps with the same subkey, because they are
// totally equal and point to the same entries in the SessionMap.
Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
Map<String, Object> map = (Map<String, Object>) requestMap.get(FLASH_RENDER_MAP);
if (map == null)
{
String token = (String) requestMap.get(FLASH_RENDER_MAP_TOKEN);
String fullToken = FLASH_SESSION_MAP_SUBKEY_PREFIX + SEPARATOR_CHAR + token + SEPARATOR_CHAR;
map = _createSubKeyMap(context, fullToken);
requestMap.put(FLASH_RENDER_MAP, map);
}
return map;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"Map",
"<",
"String",
",",
"Object",
">",
"_getRenderFlashMap",
"(",
"FacesContext",
"context",
")",
"{",
"// Note that we don't have to synchronize here, because it is no problem",
"// if we create more SubKeyMaps with the same subkey, because they are",
"// totally equal and point to the same entries in the SessionMap.",
"Map",
"<",
"String",
",",
"Object",
">",
"requestMap",
"=",
"context",
".",
"getExternalContext",
"(",
")",
".",
"getRequestMap",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"requestMap",
".",
"get",
"(",
"FLASH_RENDER_MAP",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"String",
"token",
"=",
"(",
"String",
")",
"requestMap",
".",
"get",
"(",
"FLASH_RENDER_MAP_TOKEN",
")",
";",
"String",
"fullToken",
"=",
"FLASH_SESSION_MAP_SUBKEY_PREFIX",
"+",
"SEPARATOR_CHAR",
"+",
"token",
"+",
"SEPARATOR_CHAR",
";",
"map",
"=",
"_createSubKeyMap",
"(",
"context",
",",
"fullToken",
")",
";",
"requestMap",
".",
"put",
"(",
"FLASH_RENDER_MAP",
",",
"map",
")",
";",
"}",
"return",
"map",
";",
"}"
] | Return the flash map created on this traversal.
This FlashMap will be the execute FlashMap of the next traversal.
Note that it is supposed that FLASH_RENDER_MAP_TOKEN is initialized
before restore view phase (see doPrePhaseActions() for details).
@param context
@return | [
"Return",
"the",
"flash",
"map",
"created",
"on",
"this",
"traversal",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L932-L949 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl._getExecuteFlashMap | @SuppressWarnings("unchecked")
private Map<String, Object> _getExecuteFlashMap(FacesContext context)
{
// Note that we don't have to synchronize here, because it is no problem
// if we create more SubKeyMaps with the same subkey, because they are
// totally equal and point to the same entries in the SessionMap.
Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
Map<String, Object> map = (Map<String, Object>) requestMap.get(FLASH_EXECUTE_MAP);
if (map == null)
{
String token = (String) requestMap.get(FLASH_EXECUTE_MAP_TOKEN);
String fullToken = FLASH_SESSION_MAP_SUBKEY_PREFIX + SEPARATOR_CHAR + token + SEPARATOR_CHAR;
map = _createSubKeyMap(context, fullToken);
requestMap.put(FLASH_EXECUTE_MAP, map);
}
return map;
} | java | @SuppressWarnings("unchecked")
private Map<String, Object> _getExecuteFlashMap(FacesContext context)
{
// Note that we don't have to synchronize here, because it is no problem
// if we create more SubKeyMaps with the same subkey, because they are
// totally equal and point to the same entries in the SessionMap.
Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
Map<String, Object> map = (Map<String, Object>) requestMap.get(FLASH_EXECUTE_MAP);
if (map == null)
{
String token = (String) requestMap.get(FLASH_EXECUTE_MAP_TOKEN);
String fullToken = FLASH_SESSION_MAP_SUBKEY_PREFIX + SEPARATOR_CHAR + token + SEPARATOR_CHAR;
map = _createSubKeyMap(context, fullToken);
requestMap.put(FLASH_EXECUTE_MAP, map);
}
return map;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"Map",
"<",
"String",
",",
"Object",
">",
"_getExecuteFlashMap",
"(",
"FacesContext",
"context",
")",
"{",
"// Note that we don't have to synchronize here, because it is no problem",
"// if we create more SubKeyMaps with the same subkey, because they are",
"// totally equal and point to the same entries in the SessionMap.",
"Map",
"<",
"String",
",",
"Object",
">",
"requestMap",
"=",
"context",
".",
"getExternalContext",
"(",
")",
".",
"getRequestMap",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"requestMap",
".",
"get",
"(",
"FLASH_EXECUTE_MAP",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"String",
"token",
"=",
"(",
"String",
")",
"requestMap",
".",
"get",
"(",
"FLASH_EXECUTE_MAP_TOKEN",
")",
";",
"String",
"fullToken",
"=",
"FLASH_SESSION_MAP_SUBKEY_PREFIX",
"+",
"SEPARATOR_CHAR",
"+",
"token",
"+",
"SEPARATOR_CHAR",
";",
"map",
"=",
"_createSubKeyMap",
"(",
"context",
",",
"fullToken",
")",
";",
"requestMap",
".",
"put",
"(",
"FLASH_EXECUTE_MAP",
",",
"map",
")",
";",
"}",
"return",
"map",
";",
"}"
] | Return the execute Flash Map.
This FlashMap was the render FlashMap of the previous traversal.
@param context
@return | [
"Return",
"the",
"execute",
"Flash",
"Map",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L959-L976 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl._clearExecuteFlashMap | private void _clearExecuteFlashMap(FacesContext facesContext)
{
Map<String, Object> map = _getExecuteFlashMap(facesContext);
if (!map.isEmpty()) { //RTC 168417 / JIRA MYFACES-3975
//JSF 2.2 invoke PreClearFlashEvent
facesContext.getApplication().publishEvent(facesContext,
PreClearFlashEvent.class, map);
// Clear everything - note that because of naming conventions,
// this will in fact automatically recurse through all children
// grandchildren etc. - which is kind of a design flaw of SubKeyMap,
// but one we're relying on
// NOTE that we do not need a null check here, because there will
// always be an execute Map, however sometimes an empty one!
map.clear();
}
} | java | private void _clearExecuteFlashMap(FacesContext facesContext)
{
Map<String, Object> map = _getExecuteFlashMap(facesContext);
if (!map.isEmpty()) { //RTC 168417 / JIRA MYFACES-3975
//JSF 2.2 invoke PreClearFlashEvent
facesContext.getApplication().publishEvent(facesContext,
PreClearFlashEvent.class, map);
// Clear everything - note that because of naming conventions,
// this will in fact automatically recurse through all children
// grandchildren etc. - which is kind of a design flaw of SubKeyMap,
// but one we're relying on
// NOTE that we do not need a null check here, because there will
// always be an execute Map, however sometimes an empty one!
map.clear();
}
} | [
"private",
"void",
"_clearExecuteFlashMap",
"(",
"FacesContext",
"facesContext",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"_getExecuteFlashMap",
"(",
"facesContext",
")",
";",
"if",
"(",
"!",
"map",
".",
"isEmpty",
"(",
")",
")",
"{",
"//RTC 168417 / JIRA MYFACES-3975",
"//JSF 2.2 invoke PreClearFlashEvent",
"facesContext",
".",
"getApplication",
"(",
")",
".",
"publishEvent",
"(",
"facesContext",
",",
"PreClearFlashEvent",
".",
"class",
",",
"map",
")",
";",
"// Clear everything - note that because of naming conventions,",
"// this will in fact automatically recurse through all children",
"// grandchildren etc. - which is kind of a design flaw of SubKeyMap,",
"// but one we're relying on",
"// NOTE that we do not need a null check here, because there will",
"// always be an execute Map, however sometimes an empty one!",
"map",
".",
"clear",
"(",
")",
";",
"}",
"}"
] | Destroy the execute FlashMap, because it is not needed anymore.
@param facesContext | [
"Destroy",
"the",
"execute",
"FlashMap",
"because",
"it",
"is",
"not",
"needed",
"anymore",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L1062-L1080 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl._createFlashCookie | private Cookie _createFlashCookie(String name, String value, ExternalContext externalContext)
{
Cookie cookie = new Cookie(name, value);
cookie.setMaxAge(-1);
cookie.setPath(_getCookiePath(externalContext));
cookie.setSecure(externalContext.isSecure());
//cookie.setHttpOnly(true);
if (ServletSpecifications.isServlet30Available())
{
_Servlet30Utils.setCookieHttpOnly(cookie, true);
}
return cookie;
} | java | private Cookie _createFlashCookie(String name, String value, ExternalContext externalContext)
{
Cookie cookie = new Cookie(name, value);
cookie.setMaxAge(-1);
cookie.setPath(_getCookiePath(externalContext));
cookie.setSecure(externalContext.isSecure());
//cookie.setHttpOnly(true);
if (ServletSpecifications.isServlet30Available())
{
_Servlet30Utils.setCookieHttpOnly(cookie, true);
}
return cookie;
} | [
"private",
"Cookie",
"_createFlashCookie",
"(",
"String",
"name",
",",
"String",
"value",
",",
"ExternalContext",
"externalContext",
")",
"{",
"Cookie",
"cookie",
"=",
"new",
"Cookie",
"(",
"name",
",",
"value",
")",
";",
"cookie",
".",
"setMaxAge",
"(",
"-",
"1",
")",
";",
"cookie",
".",
"setPath",
"(",
"_getCookiePath",
"(",
"externalContext",
")",
")",
";",
"cookie",
".",
"setSecure",
"(",
"externalContext",
".",
"isSecure",
"(",
")",
")",
";",
"//cookie.setHttpOnly(true);",
"if",
"(",
"ServletSpecifications",
".",
"isServlet30Available",
"(",
")",
")",
"{",
"_Servlet30Utils",
".",
"setCookieHttpOnly",
"(",
"cookie",
",",
"true",
")",
";",
"}",
"return",
"cookie",
";",
"}"
] | Creates a Cookie with the given name and value.
In addition, it will be configured with maxAge=-1, the current request path and secure value.
@param name
@param value
@param externalContext
@return | [
"Creates",
"a",
"Cookie",
"with",
"the",
"given",
"name",
"and",
"value",
".",
"In",
"addition",
"it",
"will",
"be",
"configured",
"with",
"maxAge",
"=",
"-",
"1",
"the",
"current",
"request",
"path",
"and",
"secure",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L1177-L1190 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl._getCookiePath | private String _getCookiePath(ExternalContext externalContext)
{
String contextPath = externalContext.getRequestContextPath();
if (contextPath == null || "".equals(contextPath))
{
contextPath = "/";
}
return contextPath;
} | java | private String _getCookiePath(ExternalContext externalContext)
{
String contextPath = externalContext.getRequestContextPath();
if (contextPath == null || "".equals(contextPath))
{
contextPath = "/";
}
return contextPath;
} | [
"private",
"String",
"_getCookiePath",
"(",
"ExternalContext",
"externalContext",
")",
"{",
"String",
"contextPath",
"=",
"externalContext",
".",
"getRequestContextPath",
"(",
")",
";",
"if",
"(",
"contextPath",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"contextPath",
")",
")",
"{",
"contextPath",
"=",
"\"/\"",
";",
"}",
"return",
"contextPath",
";",
"}"
] | Returns the path for the Flash-Cookies.
@param externalContext
@return | [
"Returns",
"the",
"path",
"for",
"the",
"Flash",
"-",
"Cookies",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L1197-L1207 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl._convertToBoolean | private Boolean _convertToBoolean(Object value)
{
Boolean booleanValue;
if (value instanceof Boolean)
{
booleanValue = (Boolean) value;
}
else
{
booleanValue = Boolean.parseBoolean(value.toString());
}
return booleanValue;
} | java | private Boolean _convertToBoolean(Object value)
{
Boolean booleanValue;
if (value instanceof Boolean)
{
booleanValue = (Boolean) value;
}
else
{
booleanValue = Boolean.parseBoolean(value.toString());
}
return booleanValue;
} | [
"private",
"Boolean",
"_convertToBoolean",
"(",
"Object",
"value",
")",
"{",
"Boolean",
"booleanValue",
";",
"if",
"(",
"value",
"instanceof",
"Boolean",
")",
"{",
"booleanValue",
"=",
"(",
"Boolean",
")",
"value",
";",
"}",
"else",
"{",
"booleanValue",
"=",
"Boolean",
".",
"parseBoolean",
"(",
"value",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"booleanValue",
";",
"}"
] | Convert the Object to a Boolean.
@param value
@return | [
"Convert",
"the",
"Object",
"to",
"a",
"Boolean",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L1214-L1226 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/MetatypeUtils.java | MetatypeUtils.evaluateDuration | @FFDCIgnore(NumberFormatException.class)
public static Long evaluateDuration(String strVal, TimeUnit endUnit) {
// If the value is a number, simply return the numeric value as a long
try {
return Long.valueOf(strVal);
} catch (NumberFormatException ex) {
// ignore
}
// Otherwise, parse the duration with unit descriptors.
return evaluateDuration(strVal, endUnit, UNIT_DESCRIPTORS);
} | java | @FFDCIgnore(NumberFormatException.class)
public static Long evaluateDuration(String strVal, TimeUnit endUnit) {
// If the value is a number, simply return the numeric value as a long
try {
return Long.valueOf(strVal);
} catch (NumberFormatException ex) {
// ignore
}
// Otherwise, parse the duration with unit descriptors.
return evaluateDuration(strVal, endUnit, UNIT_DESCRIPTORS);
} | [
"@",
"FFDCIgnore",
"(",
"NumberFormatException",
".",
"class",
")",
"public",
"static",
"Long",
"evaluateDuration",
"(",
"String",
"strVal",
",",
"TimeUnit",
"endUnit",
")",
"{",
"// If the value is a number, simply return the numeric value as a long",
"try",
"{",
"return",
"Long",
".",
"valueOf",
"(",
"strVal",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"ex",
")",
"{",
"// ignore",
"}",
"// Otherwise, parse the duration with unit descriptors.",
"return",
"evaluateDuration",
"(",
"strVal",
",",
"endUnit",
",",
"UNIT_DESCRIPTORS",
")",
";",
"}"
] | Converts a string value representing a unit of time into a Long value.
@param strVal
A String representing a unit of time.
@param unit
The unit of time that the string value should be converted into
@return Long The value of the string in the desired time unit | [
"Converts",
"a",
"string",
"value",
"representing",
"a",
"unit",
"of",
"time",
"into",
"a",
"Long",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/MetatypeUtils.java#L495-L506 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/MetatypeUtils.java | MetatypeUtils.collapseWhitespace | @Trivial
private static String collapseWhitespace(String value) {
final int length = value.length();
for (int i = 0; i < length; ++i) {
if (isSpace(value.charAt(i))) {
return collapse0(value, i, length);
}
}
return value;
} | java | @Trivial
private static String collapseWhitespace(String value) {
final int length = value.length();
for (int i = 0; i < length; ++i) {
if (isSpace(value.charAt(i))) {
return collapse0(value, i, length);
}
}
return value;
} | [
"@",
"Trivial",
"private",
"static",
"String",
"collapseWhitespace",
"(",
"String",
"value",
")",
"{",
"final",
"int",
"length",
"=",
"value",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"isSpace",
"(",
"value",
".",
"charAt",
"(",
"i",
")",
")",
")",
"{",
"return",
"collapse0",
"(",
"value",
",",
"i",
",",
"length",
")",
";",
"}",
"}",
"return",
"value",
";",
"}"
] | Collapses contiguous sequences of whitespace to a single 0x20.
Leading and trailing whitespace is removed. | [
"Collapses",
"contiguous",
"sequences",
"of",
"whitespace",
"to",
"a",
"single",
"0x20",
".",
"Leading",
"and",
"trailing",
"whitespace",
"is",
"removed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/MetatypeUtils.java#L557-L566 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/jfap/inbound/channel/CommsInboundChain.java | CommsInboundChain.stop | public void stop() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "CommsInboundChain Stop");
//stopchain() first quiesce's(invokes chainQuiesced) depending on the chainQuiesceTimeOut
//Once the chain is quiesced StopChainTask is initiated.Hence we block until the actual stopChain is invoked
try {
ChainData cd = _cfw.getChain(_chainName);
if (cd != null) {
_cfw.stopChain(cd, _cfw.getDefaultChainQuiesceTimeout());
stopWait.waitForStop(_cfw.getDefaultChainQuiesceTimeout()); //BLOCK till stopChain actually completes from StopChainTask
_cfw.destroyChain(cd);
_cfw.removeChain(cd);
}
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Failed in successfully cleaning(i.e stopping/destorying/removing) chain: ", e);
} finally {
_isChainStarted = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "CommsServerServiceFacade JfapChainStop");
} | java | public void stop() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "CommsInboundChain Stop");
//stopchain() first quiesce's(invokes chainQuiesced) depending on the chainQuiesceTimeOut
//Once the chain is quiesced StopChainTask is initiated.Hence we block until the actual stopChain is invoked
try {
ChainData cd = _cfw.getChain(_chainName);
if (cd != null) {
_cfw.stopChain(cd, _cfw.getDefaultChainQuiesceTimeout());
stopWait.waitForStop(_cfw.getDefaultChainQuiesceTimeout()); //BLOCK till stopChain actually completes from StopChainTask
_cfw.destroyChain(cd);
_cfw.removeChain(cd);
}
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Failed in successfully cleaning(i.e stopping/destorying/removing) chain: ", e);
} finally {
_isChainStarted = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "CommsServerServiceFacade JfapChainStop");
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"CommsInboundChain Stop\"",
")",
";",
"//stopchain() first quiesce's(invokes chainQuiesced) depending on the chainQuiesceTimeOut",
"//Once the chain is quiesced StopChainTask is initiated.Hence we block until the actual stopChain is invoked",
"try",
"{",
"ChainData",
"cd",
"=",
"_cfw",
".",
"getChain",
"(",
"_chainName",
")",
";",
"if",
"(",
"cd",
"!=",
"null",
")",
"{",
"_cfw",
".",
"stopChain",
"(",
"cd",
",",
"_cfw",
".",
"getDefaultChainQuiesceTimeout",
"(",
")",
")",
";",
"stopWait",
".",
"waitForStop",
"(",
"_cfw",
".",
"getDefaultChainQuiesceTimeout",
"(",
")",
")",
";",
"//BLOCK till stopChain actually completes from StopChainTask",
"_cfw",
".",
"destroyChain",
"(",
"cd",
")",
";",
"_cfw",
".",
"removeChain",
"(",
"cd",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Failed in successfully cleaning(i.e stopping/destorying/removing) chain: \"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"_isChainStarted",
"=",
"false",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"CommsServerServiceFacade JfapChainStop\"",
")",
";",
"}"
] | stop will get called only from de-activate. | [
"stop",
"will",
"get",
"called",
"only",
"from",
"de",
"-",
"activate",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/jfap/inbound/channel/CommsInboundChain.java#L139-L162 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt/src/com/ibm/ws/security/mp/jwt/tai/TAIRequestHelper.java | TAIRequestHelper.shouldDeferToJwtSso | private boolean shouldDeferToJwtSso(HttpServletRequest req, MicroProfileJwtConfig config, MicroProfileJwtConfig jwtssoConfig) {
if ((!isJwtSsoFeatureActive(config)) && (jwtssoConfig == null)) {
return false;
}
String hdrValue = req.getHeader(Authorization_Header);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Authorization header=", hdrValue);
}
boolean haveValidBearerHeader = (hdrValue != null && hdrValue.startsWith("Bearer "));
return !haveValidBearerHeader;
} | java | private boolean shouldDeferToJwtSso(HttpServletRequest req, MicroProfileJwtConfig config, MicroProfileJwtConfig jwtssoConfig) {
if ((!isJwtSsoFeatureActive(config)) && (jwtssoConfig == null)) {
return false;
}
String hdrValue = req.getHeader(Authorization_Header);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Authorization header=", hdrValue);
}
boolean haveValidBearerHeader = (hdrValue != null && hdrValue.startsWith("Bearer "));
return !haveValidBearerHeader;
} | [
"private",
"boolean",
"shouldDeferToJwtSso",
"(",
"HttpServletRequest",
"req",
",",
"MicroProfileJwtConfig",
"config",
",",
"MicroProfileJwtConfig",
"jwtssoConfig",
")",
"{",
"if",
"(",
"(",
"!",
"isJwtSsoFeatureActive",
"(",
"config",
")",
")",
"&&",
"(",
"jwtssoConfig",
"==",
"null",
")",
")",
"{",
"return",
"false",
";",
"}",
"String",
"hdrValue",
"=",
"req",
".",
"getHeader",
"(",
"Authorization_Header",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Authorization header=\"",
",",
"hdrValue",
")",
";",
"}",
"boolean",
"haveValidBearerHeader",
"=",
"(",
"hdrValue",
"!=",
"null",
"&&",
"hdrValue",
".",
"startsWith",
"(",
"\"Bearer \"",
")",
")",
";",
"return",
"!",
"haveValidBearerHeader",
";",
"}"
] | if we don't have a valid bearer header, and jwtsso is active, we should defer. | [
"if",
"we",
"don",
"t",
"have",
"a",
"valid",
"bearer",
"header",
"and",
"jwtsso",
"is",
"active",
"we",
"should",
"defer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt/src/com/ibm/ws/security/mp/jwt/tai/TAIRequestHelper.java#L106-L118 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.filemonitor/src/com/ibm/ws/kernel/filemonitor/internal/DirectoryUpdateMonitor.java | DirectoryUpdateMonitor.matches | protected boolean matches(File f, boolean isFile) {
if (fileFilter != null) {
if (isFile && directoriesOnly) {
return false;
} else if (!isFile && filesOnly) {
return false;
} else if (fileNameRegex != null) {
Matcher m = fileNameRegex.matcher(f.getName());
if (!m.matches()) {
return false;
}
}
}
return true;
} | java | protected boolean matches(File f, boolean isFile) {
if (fileFilter != null) {
if (isFile && directoriesOnly) {
return false;
} else if (!isFile && filesOnly) {
return false;
} else if (fileNameRegex != null) {
Matcher m = fileNameRegex.matcher(f.getName());
if (!m.matches()) {
return false;
}
}
}
return true;
} | [
"protected",
"boolean",
"matches",
"(",
"File",
"f",
",",
"boolean",
"isFile",
")",
"{",
"if",
"(",
"fileFilter",
"!=",
"null",
")",
"{",
"if",
"(",
"isFile",
"&&",
"directoriesOnly",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"!",
"isFile",
"&&",
"filesOnly",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"fileNameRegex",
"!=",
"null",
")",
"{",
"Matcher",
"m",
"=",
"fileNameRegex",
".",
"matcher",
"(",
"f",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"!",
"m",
".",
"matches",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"return",
"true",
";",
"}"
] | Check to see if this is a resource we're monitoring based
on the filter configuration
@param f File (or directory) to match against configured file filters
@param isFile true if this is a file (instead of a directory). This is looked
up once and passed around.
@return true if no filter is configured, or if the file matches the filter | [
"Check",
"to",
"see",
"if",
"this",
"is",
"a",
"resource",
"we",
"re",
"monitoring",
"based",
"on",
"the",
"filter",
"configuration"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.filemonitor/src/com/ibm/ws/kernel/filemonitor/internal/DirectoryUpdateMonitor.java#L290-L304 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/BiLevelCacheMap.java | BiLevelCacheMap.remove | public Object remove(Object key)
{
synchronized (_cacheL2)
{
if (!_cacheL1.containsKey(key) && !_cacheL2.containsKey(key))
{
// nothing to remove
return null;
}
Object retval;
Map newMap;
synchronized (_cacheL1)
{
// "dummy" synchronization to guarantee _cacheL1 will be assigned after fully initialized
// at least until JVM 1.5 where this should be guaranteed by the volatile keyword
newMap = HashMapUtils.merge(_cacheL1, _cacheL2);
retval = newMap.remove(key);
}
_cacheL1 = newMap;
_cacheL2.clear();
_missCount = 0;
return retval;
}
} | java | public Object remove(Object key)
{
synchronized (_cacheL2)
{
if (!_cacheL1.containsKey(key) && !_cacheL2.containsKey(key))
{
// nothing to remove
return null;
}
Object retval;
Map newMap;
synchronized (_cacheL1)
{
// "dummy" synchronization to guarantee _cacheL1 will be assigned after fully initialized
// at least until JVM 1.5 where this should be guaranteed by the volatile keyword
newMap = HashMapUtils.merge(_cacheL1, _cacheL2);
retval = newMap.remove(key);
}
_cacheL1 = newMap;
_cacheL2.clear();
_missCount = 0;
return retval;
}
} | [
"public",
"Object",
"remove",
"(",
"Object",
"key",
")",
"{",
"synchronized",
"(",
"_cacheL2",
")",
"{",
"if",
"(",
"!",
"_cacheL1",
".",
"containsKey",
"(",
"key",
")",
"&&",
"!",
"_cacheL2",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"// nothing to remove",
"return",
"null",
";",
"}",
"Object",
"retval",
";",
"Map",
"newMap",
";",
"synchronized",
"(",
"_cacheL1",
")",
"{",
"// \"dummy\" synchronization to guarantee _cacheL1 will be assigned after fully initialized",
"// at least until JVM 1.5 where this should be guaranteed by the volatile keyword",
"newMap",
"=",
"HashMapUtils",
".",
"merge",
"(",
"_cacheL1",
",",
"_cacheL2",
")",
";",
"retval",
"=",
"newMap",
".",
"remove",
"(",
"key",
")",
";",
"}",
"_cacheL1",
"=",
"newMap",
";",
"_cacheL2",
".",
"clear",
"(",
")",
";",
"_missCount",
"=",
"0",
";",
"return",
"retval",
";",
"}",
"}"
] | This operation is very expensive. A full copy of the Map is created | [
"This",
"operation",
"is",
"very",
"expensive",
".",
"A",
"full",
"copy",
"of",
"the",
"Map",
"is",
"created"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/BiLevelCacheMap.java#L189-L214 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOSCWriteCallback.java | HttpOSCWriteCallback.complete | public void complete(VirtualConnection vc, TCPWriteRequestContext wsc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "complete() called: vc=" + vc);
}
HttpOutboundServiceContextImpl mySC = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC);
// LI4335 - handle early reads
if (mySC.isEarlyRead()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Notifying app channel of write complete");
}
mySC.getAppWriteCallback().complete(vc);
return;
}
// if only the headers have been sent, then we need to check some
// special case handling scenarios
// 381105 - only start response read after just the headers have been
// sent and no body... eventually need to get the isPartialBody state
// implemented to make this simpler.
if (mySC.isHeadersSentState() && 0 == mySC.getNumBytesWritten()) {
if (mySC.shouldReadResponseImmediately()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Sent headers, reading for response");
}
mySC.startResponseRead();
return;
}
}
// if we're here and we need to, notify the channel above that the
// write has completed, otherwise start the read for the response
// message
if (!mySC.isMessageSent()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling write complete callback of app channel.");
}
mySC.getAppWriteCallback().complete(vc);
} else {
if (mySC.shouldReadResponseImmediately()) {
// we've already done the "read first" call so jump to the
// regular method now
mySC.readAsyncResponse();
} else {
// initial read for a response
mySC.startResponseRead();
}
}
} | java | public void complete(VirtualConnection vc, TCPWriteRequestContext wsc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "complete() called: vc=" + vc);
}
HttpOutboundServiceContextImpl mySC = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC);
// LI4335 - handle early reads
if (mySC.isEarlyRead()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Notifying app channel of write complete");
}
mySC.getAppWriteCallback().complete(vc);
return;
}
// if only the headers have been sent, then we need to check some
// special case handling scenarios
// 381105 - only start response read after just the headers have been
// sent and no body... eventually need to get the isPartialBody state
// implemented to make this simpler.
if (mySC.isHeadersSentState() && 0 == mySC.getNumBytesWritten()) {
if (mySC.shouldReadResponseImmediately()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Sent headers, reading for response");
}
mySC.startResponseRead();
return;
}
}
// if we're here and we need to, notify the channel above that the
// write has completed, otherwise start the read for the response
// message
if (!mySC.isMessageSent()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling write complete callback of app channel.");
}
mySC.getAppWriteCallback().complete(vc);
} else {
if (mySC.shouldReadResponseImmediately()) {
// we've already done the "read first" call so jump to the
// regular method now
mySC.readAsyncResponse();
} else {
// initial read for a response
mySC.startResponseRead();
}
}
} | [
"public",
"void",
"complete",
"(",
"VirtualConnection",
"vc",
",",
"TCPWriteRequestContext",
"wsc",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"complete() called: vc=\"",
"+",
"vc",
")",
";",
"}",
"HttpOutboundServiceContextImpl",
"mySC",
"=",
"(",
"HttpOutboundServiceContextImpl",
")",
"vc",
".",
"getStateMap",
"(",
")",
".",
"get",
"(",
"CallbackIDs",
".",
"CALLBACK_HTTPOSC",
")",
";",
"// LI4335 - handle early reads",
"if",
"(",
"mySC",
".",
"isEarlyRead",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Notifying app channel of write complete\"",
")",
";",
"}",
"mySC",
".",
"getAppWriteCallback",
"(",
")",
".",
"complete",
"(",
"vc",
")",
";",
"return",
";",
"}",
"// if only the headers have been sent, then we need to check some",
"// special case handling scenarios",
"// 381105 - only start response read after just the headers have been",
"// sent and no body... eventually need to get the isPartialBody state",
"// implemented to make this simpler.",
"if",
"(",
"mySC",
".",
"isHeadersSentState",
"(",
")",
"&&",
"0",
"==",
"mySC",
".",
"getNumBytesWritten",
"(",
")",
")",
"{",
"if",
"(",
"mySC",
".",
"shouldReadResponseImmediately",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Sent headers, reading for response\"",
")",
";",
"}",
"mySC",
".",
"startResponseRead",
"(",
")",
";",
"return",
";",
"}",
"}",
"// if we're here and we need to, notify the channel above that the",
"// write has completed, otherwise start the read for the response",
"// message",
"if",
"(",
"!",
"mySC",
".",
"isMessageSent",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Calling write complete callback of app channel.\"",
")",
";",
"}",
"mySC",
".",
"getAppWriteCallback",
"(",
")",
".",
"complete",
"(",
"vc",
")",
";",
"}",
"else",
"{",
"if",
"(",
"mySC",
".",
"shouldReadResponseImmediately",
"(",
")",
")",
"{",
"// we've already done the \"read first\" call so jump to the",
"// regular method now",
"mySC",
".",
"readAsyncResponse",
"(",
")",
";",
"}",
"else",
"{",
"// initial read for a response",
"mySC",
".",
"startResponseRead",
"(",
")",
";",
"}",
"}",
"}"
] | Called by the TCP channel when the write has finished.
@param vc
@param wsc | [
"Called",
"by",
"the",
"TCP",
"channel",
"when",
"the",
"write",
"has",
"finished",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOSCWriteCallback.java#L57-L104 | train |
Subsets and Splits