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.ejbcontainer.timer.persistent/src/com/ibm/ws/ejbcontainer/timer/persistent/osgi/internal/EJBPersistentTimerRuntimeImpl.java | EJBPersistentTimerRuntimeImpl.getAllowCachedTimerData | protected int getAllowCachedTimerData(J2EEName j2eeName) {
Integer allowCachedTimerData = null;
Map<String, Integer> localAllowCachedTimerDataMap = allowCachedTimerDataMap;
if (localAllowCachedTimerDataMap != null) {
allowCachedTimerData = localAllowCachedTimerDataMap.get(j2eeName.toString());
if (allowCachedTimerData == null) {
allowCachedTimerData = localAllowCachedTimerDataMap.get("*");
}
}
return allowCachedTimerData != null ? allowCachedTimerData : 0;
} | java | protected int getAllowCachedTimerData(J2EEName j2eeName) {
Integer allowCachedTimerData = null;
Map<String, Integer> localAllowCachedTimerDataMap = allowCachedTimerDataMap;
if (localAllowCachedTimerDataMap != null) {
allowCachedTimerData = localAllowCachedTimerDataMap.get(j2eeName.toString());
if (allowCachedTimerData == null) {
allowCachedTimerData = localAllowCachedTimerDataMap.get("*");
}
}
return allowCachedTimerData != null ? allowCachedTimerData : 0;
} | [
"protected",
"int",
"getAllowCachedTimerData",
"(",
"J2EEName",
"j2eeName",
")",
"{",
"Integer",
"allowCachedTimerData",
"=",
"null",
";",
"Map",
"<",
"String",
",",
"Integer",
">",
"localAllowCachedTimerDataMap",
"=",
"allowCachedTimerDataMap",
";",
"if",
"(",
"localAllowCachedTimerDataMap",
"!=",
"null",
")",
"{",
"allowCachedTimerData",
"=",
"localAllowCachedTimerDataMap",
".",
"get",
"(",
"j2eeName",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"allowCachedTimerData",
"==",
"null",
")",
"{",
"allowCachedTimerData",
"=",
"localAllowCachedTimerDataMap",
".",
"get",
"(",
"\"*\"",
")",
";",
"}",
"}",
"return",
"allowCachedTimerData",
"!=",
"null",
"?",
"allowCachedTimerData",
":",
"0",
";",
"}"
] | Return the allowed cached timer data setting for the specified bean. | [
"Return",
"the",
"allowed",
"cached",
"timer",
"data",
"setting",
"for",
"the",
"specified",
"bean",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.timer.persistent/src/com/ibm/ws/ejbcontainer/timer/persistent/osgi/internal/EJBPersistentTimerRuntimeImpl.java#L445-L455 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/NullNotificationService.java | NullNotificationService.batchUpdate | public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents, ArrayList aliasEntryEvents, CacheUnit cacheUnit) { //CCC
// nothing to do for NullNotification
} | java | public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents, ArrayList aliasEntryEvents, CacheUnit cacheUnit) { //CCC
// nothing to do for NullNotification
} | [
"public",
"void",
"batchUpdate",
"(",
"HashMap",
"invalidateIdEvents",
",",
"HashMap",
"invalidateTemplateEvents",
",",
"ArrayList",
"pushEntryEvents",
",",
"ArrayList",
"aliasEntryEvents",
",",
"CacheUnit",
"cacheUnit",
")",
"{",
"//CCC",
"// nothing to do for NullNotification",
"}"
] | This applies a set of invalidations and new entries to this CacheUnit,
including the local internal cache and external caches registered
with this CacheUnit.
@param invalidateIdEvents A Vector of invalidate by id events.
@param invalidateTemplateEvents A Vector of invalidate by template events.
@param pushEntryEvents A Vector of cache entries. | [
"This",
"applies",
"a",
"set",
"of",
"invalidations",
"and",
"new",
"entries",
"to",
"this",
"CacheUnit",
"including",
"the",
"local",
"internal",
"cache",
"and",
"external",
"caches",
"registered",
"with",
"this",
"CacheUnit",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/NullNotificationService.java#L35-L37 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxExecutionContextHandler.java | TxExecutionContextHandler.getTxWrapper | public static JCATranWrapper getTxWrapper(Xid xid, boolean addAssociation) throws XAException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getTxWrapper", new Object[] { xid, addAssociation});
final ByteArray key = new ByteArray(xid.getGlobalTransactionId());
final JCATranWrapper txWrapper;
synchronized (txnTable)
{
txWrapper = txnTable.get(key);
if (txWrapper != null)
{
if (addAssociation)
{
if (!txWrapper.hasAssociation())
{
txWrapper.addAssociation();
}
else
{
// Already associated
if (tc.isEntryEnabled()) Tr.exit(tc, "getTxWrapper", "throwing XAER_PROTO");
throw new XAException(XAException.XAER_PROTO);
}
}
}
else
{
if (tc.isEntryEnabled()) Tr.exit(tc, "getTxWrapper", "throwing XAER_NOTA");
throw new XAException(XAException.XAER_NOTA);
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "getTxWrapper", txWrapper);
return txWrapper;
} | java | public static JCATranWrapper getTxWrapper(Xid xid, boolean addAssociation) throws XAException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getTxWrapper", new Object[] { xid, addAssociation});
final ByteArray key = new ByteArray(xid.getGlobalTransactionId());
final JCATranWrapper txWrapper;
synchronized (txnTable)
{
txWrapper = txnTable.get(key);
if (txWrapper != null)
{
if (addAssociation)
{
if (!txWrapper.hasAssociation())
{
txWrapper.addAssociation();
}
else
{
// Already associated
if (tc.isEntryEnabled()) Tr.exit(tc, "getTxWrapper", "throwing XAER_PROTO");
throw new XAException(XAException.XAER_PROTO);
}
}
}
else
{
if (tc.isEntryEnabled()) Tr.exit(tc, "getTxWrapper", "throwing XAER_NOTA");
throw new XAException(XAException.XAER_NOTA);
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "getTxWrapper", txWrapper);
return txWrapper;
} | [
"public",
"static",
"JCATranWrapper",
"getTxWrapper",
"(",
"Xid",
"xid",
",",
"boolean",
"addAssociation",
")",
"throws",
"XAException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getTxWrapper\"",
",",
"new",
"Object",
"[",
"]",
"{",
"xid",
",",
"addAssociation",
"}",
")",
";",
"final",
"ByteArray",
"key",
"=",
"new",
"ByteArray",
"(",
"xid",
".",
"getGlobalTransactionId",
"(",
")",
")",
";",
"final",
"JCATranWrapper",
"txWrapper",
";",
"synchronized",
"(",
"txnTable",
")",
"{",
"txWrapper",
"=",
"txnTable",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"txWrapper",
"!=",
"null",
")",
"{",
"if",
"(",
"addAssociation",
")",
"{",
"if",
"(",
"!",
"txWrapper",
".",
"hasAssociation",
"(",
")",
")",
"{",
"txWrapper",
".",
"addAssociation",
"(",
")",
";",
"}",
"else",
"{",
"// Already associated",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getTxWrapper\"",
",",
"\"throwing XAER_PROTO\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_PROTO",
")",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getTxWrapper\"",
",",
"\"throwing XAER_NOTA\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_NOTA",
")",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getTxWrapper\"",
",",
"txWrapper",
")",
";",
"return",
"txWrapper",
";",
"}"
] | Given an Xid, returns the corresponding JCATranWrapper from the table of
imported transactions, or null if no entry exists.
@param xid
@param addAssociation
@return
@throws XAException | [
"Given",
"an",
"Xid",
"returns",
"the",
"corresponding",
"JCATranWrapper",
"from",
"the",
"table",
"of",
"imported",
"transactions",
"or",
"null",
"if",
"no",
"entry",
"exists",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxExecutionContextHandler.java#L215-L252 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxExecutionContextHandler.java | TxExecutionContextHandler.findTxWrapper | protected JCATranWrapper findTxWrapper(int timeout, Xid xid, String providerId) throws WorkCompletedException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "findTxWrapper", new Object[] { timeout, xid, providerId });
final JCATranWrapper txWrapper;
final ByteArray key = new ByteArray(xid.getGlobalTransactionId());
synchronized (txnTable)
{
if (!txnTable.containsKey(key))
{
// XID has not been encountered - create a new TransactionImpl and add it to the table
// ......unless we're quiescing
if(!((TranManagerSet)TransactionManagerFactory.getTransactionManager()).isQuiesced())
{
final JCARecoveryData jcard = (JCARecoveryData) ((TranManagerSet)TransactionManagerFactory.getTransactionManager()).registerJCAProvider(providerId);
try
{
jcard.logRecoveryEntry();
}
catch(Exception e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "findTxWrapper", e);
throw new WorkCompletedException(e.getLocalizedMessage(), WorkException.TX_RECREATE_FAILED);
}
// Create a new wrapper, suspend any transaction, create the new TransactionImpl and mark associated
txWrapper = createWrapper(timeout, xid, jcard);
txnTable.put(key, txWrapper);
}
else
{
if (tc.isEntryEnabled()) Tr.exit(tc, "findTxWrapper", "quiescing");
throw new WorkCompletedException("In quiesce period", WorkException.TX_RECREATE_FAILED);
}
}
else
{
// XID has already been imported, retrieve JCATranWrapper from table
if (tc.isEventEnabled()) Tr.event(tc, "Already encountered", key);
txWrapper = txnTable.get(key);
// If we already had an association, return null so
// caller knows to throw an exception.
if (!txWrapper.hasAssociation())
{
// If we were already prepared, return null so
// caller knows to throw an exception.
if (!txWrapper.isPrepared())
{
txWrapper.addAssociation();
}
else
{
if (tc.isEntryEnabled()) Tr.exit(tc, "findTxWrapper", "already prepared");
return null;
}
}
else
{
if (tc.isEntryEnabled()) Tr.exit(tc, "findTxWrapper", "already associated");
return null;
}
// d240298 - Suspend any local transaction before we return,
// save it in the wrapper for resuming later
txWrapper.suspend(); // @D240298A
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "findTxWrapper", txWrapper);
return txWrapper;
} | java | protected JCATranWrapper findTxWrapper(int timeout, Xid xid, String providerId) throws WorkCompletedException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "findTxWrapper", new Object[] { timeout, xid, providerId });
final JCATranWrapper txWrapper;
final ByteArray key = new ByteArray(xid.getGlobalTransactionId());
synchronized (txnTable)
{
if (!txnTable.containsKey(key))
{
// XID has not been encountered - create a new TransactionImpl and add it to the table
// ......unless we're quiescing
if(!((TranManagerSet)TransactionManagerFactory.getTransactionManager()).isQuiesced())
{
final JCARecoveryData jcard = (JCARecoveryData) ((TranManagerSet)TransactionManagerFactory.getTransactionManager()).registerJCAProvider(providerId);
try
{
jcard.logRecoveryEntry();
}
catch(Exception e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "findTxWrapper", e);
throw new WorkCompletedException(e.getLocalizedMessage(), WorkException.TX_RECREATE_FAILED);
}
// Create a new wrapper, suspend any transaction, create the new TransactionImpl and mark associated
txWrapper = createWrapper(timeout, xid, jcard);
txnTable.put(key, txWrapper);
}
else
{
if (tc.isEntryEnabled()) Tr.exit(tc, "findTxWrapper", "quiescing");
throw new WorkCompletedException("In quiesce period", WorkException.TX_RECREATE_FAILED);
}
}
else
{
// XID has already been imported, retrieve JCATranWrapper from table
if (tc.isEventEnabled()) Tr.event(tc, "Already encountered", key);
txWrapper = txnTable.get(key);
// If we already had an association, return null so
// caller knows to throw an exception.
if (!txWrapper.hasAssociation())
{
// If we were already prepared, return null so
// caller knows to throw an exception.
if (!txWrapper.isPrepared())
{
txWrapper.addAssociation();
}
else
{
if (tc.isEntryEnabled()) Tr.exit(tc, "findTxWrapper", "already prepared");
return null;
}
}
else
{
if (tc.isEntryEnabled()) Tr.exit(tc, "findTxWrapper", "already associated");
return null;
}
// d240298 - Suspend any local transaction before we return,
// save it in the wrapper for resuming later
txWrapper.suspend(); // @D240298A
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "findTxWrapper", txWrapper);
return txWrapper;
} | [
"protected",
"JCATranWrapper",
"findTxWrapper",
"(",
"int",
"timeout",
",",
"Xid",
"xid",
",",
"String",
"providerId",
")",
"throws",
"WorkCompletedException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"findTxWrapper\"",
",",
"new",
"Object",
"[",
"]",
"{",
"timeout",
",",
"xid",
",",
"providerId",
"}",
")",
";",
"final",
"JCATranWrapper",
"txWrapper",
";",
"final",
"ByteArray",
"key",
"=",
"new",
"ByteArray",
"(",
"xid",
".",
"getGlobalTransactionId",
"(",
")",
")",
";",
"synchronized",
"(",
"txnTable",
")",
"{",
"if",
"(",
"!",
"txnTable",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"// XID has not been encountered - create a new TransactionImpl and add it to the table",
"// ......unless we're quiescing",
"if",
"(",
"!",
"(",
"(",
"TranManagerSet",
")",
"TransactionManagerFactory",
".",
"getTransactionManager",
"(",
")",
")",
".",
"isQuiesced",
"(",
")",
")",
"{",
"final",
"JCARecoveryData",
"jcard",
"=",
"(",
"JCARecoveryData",
")",
"(",
"(",
"TranManagerSet",
")",
"TransactionManagerFactory",
".",
"getTransactionManager",
"(",
")",
")",
".",
"registerJCAProvider",
"(",
"providerId",
")",
";",
"try",
"{",
"jcard",
".",
"logRecoveryEntry",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"findTxWrapper\"",
",",
"e",
")",
";",
"throw",
"new",
"WorkCompletedException",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"WorkException",
".",
"TX_RECREATE_FAILED",
")",
";",
"}",
"// Create a new wrapper, suspend any transaction, create the new TransactionImpl and mark associated",
"txWrapper",
"=",
"createWrapper",
"(",
"timeout",
",",
"xid",
",",
"jcard",
")",
";",
"txnTable",
".",
"put",
"(",
"key",
",",
"txWrapper",
")",
";",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"findTxWrapper\"",
",",
"\"quiescing\"",
")",
";",
"throw",
"new",
"WorkCompletedException",
"(",
"\"In quiesce period\"",
",",
"WorkException",
".",
"TX_RECREATE_FAILED",
")",
";",
"}",
"}",
"else",
"{",
"// XID has already been imported, retrieve JCATranWrapper from table",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Already encountered\"",
",",
"key",
")",
";",
"txWrapper",
"=",
"txnTable",
".",
"get",
"(",
"key",
")",
";",
"// If we already had an association, return null so",
"// caller knows to throw an exception.",
"if",
"(",
"!",
"txWrapper",
".",
"hasAssociation",
"(",
")",
")",
"{",
"// If we were already prepared, return null so",
"// caller knows to throw an exception.",
"if",
"(",
"!",
"txWrapper",
".",
"isPrepared",
"(",
")",
")",
"{",
"txWrapper",
".",
"addAssociation",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"findTxWrapper\"",
",",
"\"already prepared\"",
")",
";",
"return",
"null",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"findTxWrapper\"",
",",
"\"already associated\"",
")",
";",
"return",
"null",
";",
"}",
"// d240298 - Suspend any local transaction before we return,",
"// save it in the wrapper for resuming later",
"txWrapper",
".",
"suspend",
"(",
")",
";",
"// @D240298A",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"findTxWrapper\"",
",",
"txWrapper",
")",
";",
"return",
"txWrapper",
";",
"}"
] | Retrieve a JCATranWrapper from the table.
Insert it first if it wasn't already there.
Returns null if association already existed or if transaction has been prepared.
@param timeout
@param xid
@return | [
"Retrieve",
"a",
"JCATranWrapper",
"from",
"the",
"table",
".",
"Insert",
"it",
"first",
"if",
"it",
"wasn",
"t",
"already",
"there",
".",
"Returns",
"null",
"if",
"association",
"already",
"existed",
"or",
"if",
"transaction",
"has",
"been",
"prepared",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxExecutionContextHandler.java#L262-L338 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxExecutionContextHandler.java | TxExecutionContextHandler.createWrapper | protected JCATranWrapper createWrapper(int timeout, Xid xid, JCARecoveryData jcard) throws WorkCompletedException /* @512190C*/
{
return new JCATranWrapperImpl(timeout, xid, jcard); // @D240298C
} | java | protected JCATranWrapper createWrapper(int timeout, Xid xid, JCARecoveryData jcard) throws WorkCompletedException /* @512190C*/
{
return new JCATranWrapperImpl(timeout, xid, jcard); // @D240298C
} | [
"protected",
"JCATranWrapper",
"createWrapper",
"(",
"int",
"timeout",
",",
"Xid",
"xid",
",",
"JCARecoveryData",
"jcard",
")",
"throws",
"WorkCompletedException",
"/* @512190C*/",
"{",
"return",
"new",
"JCATranWrapperImpl",
"(",
"timeout",
",",
"xid",
",",
"jcard",
")",
";",
"// @D240298C",
"}"
] | Overridden in WAS | [
"Overridden",
"in",
"WAS"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxExecutionContextHandler.java#L341-L344 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxExecutionContextHandler.java | TxExecutionContextHandler.addTxn | public static void addTxn(TransactionImpl txn)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "addTxn", txn);
final ByteArray key = new ByteArray(txn.getXid().getGlobalTransactionId());
synchronized (txnTable)
{
if (!txnTable.containsKey(key))
{
txnTable.put(key, new JCATranWrapperImpl(txn, true, false)); // @LIDB2110C
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "addTxn");
} | java | public static void addTxn(TransactionImpl txn)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "addTxn", txn);
final ByteArray key = new ByteArray(txn.getXid().getGlobalTransactionId());
synchronized (txnTable)
{
if (!txnTable.containsKey(key))
{
txnTable.put(key, new JCATranWrapperImpl(txn, true, false)); // @LIDB2110C
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "addTxn");
} | [
"public",
"static",
"void",
"addTxn",
"(",
"TransactionImpl",
"txn",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"addTxn\"",
",",
"txn",
")",
";",
"final",
"ByteArray",
"key",
"=",
"new",
"ByteArray",
"(",
"txn",
".",
"getXid",
"(",
")",
".",
"getGlobalTransactionId",
"(",
")",
")",
";",
"synchronized",
"(",
"txnTable",
")",
"{",
"if",
"(",
"!",
"txnTable",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"txnTable",
".",
"put",
"(",
"key",
",",
"new",
"JCATranWrapperImpl",
"(",
"txn",
",",
"true",
",",
"false",
")",
")",
";",
"// @LIDB2110C",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"addTxn\"",
")",
";",
"}"
] | To be called by recovery manager
@param txn | [
"To",
"be",
"called",
"by",
"recovery",
"manager"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxExecutionContextHandler.java#L350-L365 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java | _ArrayMap.getKey | @SuppressWarnings("unchecked")
public K getKey(int index)
{
if ((index < 0) || (index >= size()))
{
throw new IndexOutOfBoundsException();
}
return (K) _array[index * 2];
} | java | @SuppressWarnings("unchecked")
public K getKey(int index)
{
if ((index < 0) || (index >= size()))
{
throw new IndexOutOfBoundsException();
}
return (K) _array[index * 2];
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"K",
"getKey",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"(",
"index",
"<",
"0",
")",
"||",
"(",
"index",
">=",
"size",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"}",
"return",
"(",
"K",
")",
"_array",
"[",
"index",
"*",
"2",
"]",
";",
"}"
] | Returns the key at a specific index in the map. | [
"Returns",
"the",
"key",
"at",
"a",
"specific",
"index",
"in",
"the",
"map",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java#L108-L116 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java | _ArrayMap.getValue | @SuppressWarnings("unchecked")
public V getValue(int index)
{
if ((index < 0) || (index >= size()))
{
throw new IndexOutOfBoundsException();
}
return (V) _array[index * 2 + 1];
} | java | @SuppressWarnings("unchecked")
public V getValue(int index)
{
if ((index < 0) || (index >= size()))
{
throw new IndexOutOfBoundsException();
}
return (V) _array[index * 2 + 1];
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"V",
"getValue",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"(",
"index",
"<",
"0",
")",
"||",
"(",
"index",
">=",
"size",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"}",
"return",
"(",
"V",
")",
"_array",
"[",
"index",
"*",
"2",
"+",
"1",
"]",
";",
"}"
] | Returns the value at a specific index in the map. | [
"Returns",
"the",
"value",
"at",
"a",
"specific",
"index",
"in",
"the",
"map",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java#L121-L129 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java | _ArrayMap.get | static public Object get(Object[] array, Object key)
{
Object o = getByIdentity(array, key);
if (o != null)
{
return o;
}
return getByEquality(array, key);
} | java | static public Object get(Object[] array, Object key)
{
Object o = getByIdentity(array, key);
if (o != null)
{
return o;
}
return getByEquality(array, key);
} | [
"static",
"public",
"Object",
"get",
"(",
"Object",
"[",
"]",
"array",
",",
"Object",
"key",
")",
"{",
"Object",
"o",
"=",
"getByIdentity",
"(",
"array",
",",
"key",
")",
";",
"if",
"(",
"o",
"!=",
"null",
")",
"{",
"return",
"o",
";",
"}",
"return",
"getByEquality",
"(",
"array",
",",
"key",
")",
";",
"}"
] | Gets the object stored with the given key. Scans first
by object identity, then by object equality. | [
"Gets",
"the",
"object",
"stored",
"with",
"the",
"given",
"key",
".",
"Scans",
"first",
"by",
"object",
"identity",
"then",
"by",
"object",
"equality",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java#L135-L144 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java | _ArrayMap.getByIdentity | static public Object getByIdentity(Object[] array, Object key)
{
if (array != null)
{
int length = array.length;
for (int i = 0; i < length; i += 2)
{
if (array[i] == key)
{
return array[i + 1];
}
}
}
return null;
} | java | static public Object getByIdentity(Object[] array, Object key)
{
if (array != null)
{
int length = array.length;
for (int i = 0; i < length; i += 2)
{
if (array[i] == key)
{
return array[i + 1];
}
}
}
return null;
} | [
"static",
"public",
"Object",
"getByIdentity",
"(",
"Object",
"[",
"]",
"array",
",",
"Object",
"key",
")",
"{",
"if",
"(",
"array",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"array",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"+=",
"2",
")",
"{",
"if",
"(",
"array",
"[",
"i",
"]",
"==",
"key",
")",
"{",
"return",
"array",
"[",
"i",
"+",
"1",
"]",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | Gets the object stored with the given key, using
only object identity. | [
"Gets",
"the",
"object",
"stored",
"with",
"the",
"given",
"key",
"using",
"only",
"object",
"identity",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java#L150-L165 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java | _ArrayMap.getByEquality | static public Object getByEquality(Object[] array, Object key)
{
if (array != null)
{
int length = array.length;
for (int i = 0; i < length; i += 2)
{
Object targetKey = array[i];
if (targetKey == null)
{
return null;
}
else if (targetKey.equals(key))
{
return array[i + 1];
}
}
}
return null;
} | java | static public Object getByEquality(Object[] array, Object key)
{
if (array != null)
{
int length = array.length;
for (int i = 0; i < length; i += 2)
{
Object targetKey = array[i];
if (targetKey == null)
{
return null;
}
else if (targetKey.equals(key))
{
return array[i + 1];
}
}
}
return null;
} | [
"static",
"public",
"Object",
"getByEquality",
"(",
"Object",
"[",
"]",
"array",
",",
"Object",
"key",
")",
"{",
"if",
"(",
"array",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"array",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"+=",
"2",
")",
"{",
"Object",
"targetKey",
"=",
"array",
"[",
"i",
"]",
";",
"if",
"(",
"targetKey",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"targetKey",
".",
"equals",
"(",
"key",
")",
")",
"{",
"return",
"array",
"[",
"i",
"+",
"1",
"]",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | Gets the object stored with the given key, using
only object equality. | [
"Gets",
"the",
"object",
"stored",
"with",
"the",
"given",
"key",
"using",
"only",
"object",
"equality",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java#L171-L192 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java | _ArrayMap.keys | @SuppressWarnings("unchecked")
public Iterator<K> keys()
{
int size = _size;
if (size == 0)
{
return null;
}
ArrayList<K> keyList = new ArrayList<K>();
int i = (size - 1) * 2;
while (i >= 0)
{
keyList.add((K) _array[i]);
i = i - 2;
}
return keyList.iterator();
} | java | @SuppressWarnings("unchecked")
public Iterator<K> keys()
{
int size = _size;
if (size == 0)
{
return null;
}
ArrayList<K> keyList = new ArrayList<K>();
int i = (size - 1) * 2;
while (i >= 0)
{
keyList.add((K) _array[i]);
i = i - 2;
}
return keyList.iterator();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Iterator",
"<",
"K",
">",
"keys",
"(",
")",
"{",
"int",
"size",
"=",
"_size",
";",
"if",
"(",
"size",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"ArrayList",
"<",
"K",
">",
"keyList",
"=",
"new",
"ArrayList",
"<",
"K",
">",
"(",
")",
";",
"int",
"i",
"=",
"(",
"size",
"-",
"1",
")",
"*",
"2",
";",
"while",
"(",
"i",
">=",
"0",
")",
"{",
"keyList",
".",
"add",
"(",
"(",
"K",
")",
"_array",
"[",
"i",
"]",
")",
";",
"i",
"=",
"i",
"-",
"2",
";",
"}",
"return",
"keyList",
".",
"iterator",
"(",
")",
";",
"}"
] | Returns an enumeration of the keys in this map.
the Iterator methods on the returned object to fetch the elements
sequentially. | [
"Returns",
"an",
"enumeration",
"of",
"the",
"keys",
"in",
"this",
"map",
".",
"the",
"Iterator",
"methods",
"on",
"the",
"returned",
"object",
"to",
"fetch",
"the",
"elements",
"sequentially",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java#L313-L330 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java | _ArrayMap.getKeys | public static Iterator<Object> getKeys(Object[] array)
{
if (array == null)
{
return null;
}
ArrayList<Object> keyList = new ArrayList<Object>();
int i = array.length - 2;
while (i >= 0)
{
keyList.add(array[i]);
i = i - 2;
}
return keyList.iterator();
} | java | public static Iterator<Object> getKeys(Object[] array)
{
if (array == null)
{
return null;
}
ArrayList<Object> keyList = new ArrayList<Object>();
int i = array.length - 2;
while (i >= 0)
{
keyList.add(array[i]);
i = i - 2;
}
return keyList.iterator();
} | [
"public",
"static",
"Iterator",
"<",
"Object",
">",
"getKeys",
"(",
"Object",
"[",
"]",
"array",
")",
"{",
"if",
"(",
"array",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ArrayList",
"<",
"Object",
">",
"keyList",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"int",
"i",
"=",
"array",
".",
"length",
"-",
"2",
";",
"while",
"(",
"i",
">=",
"0",
")",
"{",
"keyList",
".",
"add",
"(",
"array",
"[",
"i",
"]",
")",
";",
"i",
"=",
"i",
"-",
"2",
";",
"}",
"return",
"keyList",
".",
"iterator",
"(",
")",
";",
"}"
] | Returns an Iterator of keys in the array. | [
"Returns",
"an",
"Iterator",
"of",
"keys",
"in",
"the",
"array",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java#L335-L349 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java | _ArrayMap.getValues | public static Iterator<Object> getValues(Object[] array)
{
if (array == null)
{
return null;
}
ArrayList<Object> valueList = new ArrayList<Object>();
int i = array.length - 1;
while (i >= 0)
{
valueList.add(array[i]);
i = i - 2;
}
return valueList.iterator();
} | java | public static Iterator<Object> getValues(Object[] array)
{
if (array == null)
{
return null;
}
ArrayList<Object> valueList = new ArrayList<Object>();
int i = array.length - 1;
while (i >= 0)
{
valueList.add(array[i]);
i = i - 2;
}
return valueList.iterator();
} | [
"public",
"static",
"Iterator",
"<",
"Object",
">",
"getValues",
"(",
"Object",
"[",
"]",
"array",
")",
"{",
"if",
"(",
"array",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ArrayList",
"<",
"Object",
">",
"valueList",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"int",
"i",
"=",
"array",
".",
"length",
"-",
"1",
";",
"while",
"(",
"i",
">=",
"0",
")",
"{",
"valueList",
".",
"add",
"(",
"array",
"[",
"i",
"]",
")",
";",
"i",
"=",
"i",
"-",
"2",
";",
"}",
"return",
"valueList",
".",
"iterator",
"(",
")",
";",
"}"
] | Returns an Iterator of values in the array. | [
"Returns",
"an",
"Iterator",
"of",
"values",
"in",
"the",
"array",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java#L354-L368 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java | _ArrayMap.clear | @Override
public void clear()
{
int size = _size;
if (size > 0)
{
size = size * 2;
for (int i = 0; i < size; i++)
{
_array[i] = null;
}
_size = 0;
}
} | java | @Override
public void clear()
{
int size = _size;
if (size > 0)
{
size = size * 2;
for (int i = 0; i < size; i++)
{
_array[i] = null;
}
_size = 0;
}
} | [
"@",
"Override",
"public",
"void",
"clear",
"(",
")",
"{",
"int",
"size",
"=",
"_size",
";",
"if",
"(",
"size",
">",
"0",
")",
"{",
"size",
"=",
"size",
"*",
"2",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"_array",
"[",
"i",
"]",
"=",
"null",
";",
"}",
"_size",
"=",
"0",
";",
"}",
"}"
] | Removes all elements from the ArrayMap. | [
"Removes",
"all",
"elements",
"from",
"the",
"ArrayMap",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java#L584-L598 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/clients/common/AuthorizationCodeHandler.java | AuthorizationCodeHandler.sendErrorJSON | private void sendErrorJSON(HttpServletResponse response, int statusCode, String errorCode, String errorDescription) {
final String error = "error";
final String error_description = "error_description";
try {
if (errorCode != null) {
response.setStatus(statusCode);
response.setHeader(ClientConstants.REQ_CONTENT_TYPE_NAME,
"application/json;charset=UTF-8");
JSONObject responseJSON = new JSONObject();
responseJSON.put(error, errorCode);
if (errorDescription != null) {
responseJSON.put(error_description, errorDescription);
}
PrintWriter pw;
pw = response.getWriter();
pw.write(responseJSON.toString());
pw.flush();
} else {
response.sendError(statusCode);
}
} catch (IOException e) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Internal error sending error message", e);
try {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} catch (IOException ioe) {
if (tc.isDebugEnabled())
Tr.debug(tc, "yet another internal error, give up", ioe);
}
}
} | java | private void sendErrorJSON(HttpServletResponse response, int statusCode, String errorCode, String errorDescription) {
final String error = "error";
final String error_description = "error_description";
try {
if (errorCode != null) {
response.setStatus(statusCode);
response.setHeader(ClientConstants.REQ_CONTENT_TYPE_NAME,
"application/json;charset=UTF-8");
JSONObject responseJSON = new JSONObject();
responseJSON.put(error, errorCode);
if (errorDescription != null) {
responseJSON.put(error_description, errorDescription);
}
PrintWriter pw;
pw = response.getWriter();
pw.write(responseJSON.toString());
pw.flush();
} else {
response.sendError(statusCode);
}
} catch (IOException e) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Internal error sending error message", e);
try {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} catch (IOException ioe) {
if (tc.isDebugEnabled())
Tr.debug(tc, "yet another internal error, give up", ioe);
}
}
} | [
"private",
"void",
"sendErrorJSON",
"(",
"HttpServletResponse",
"response",
",",
"int",
"statusCode",
",",
"String",
"errorCode",
",",
"String",
"errorDescription",
")",
"{",
"final",
"String",
"error",
"=",
"\"error\"",
";",
"final",
"String",
"error_description",
"=",
"\"error_description\"",
";",
"try",
"{",
"if",
"(",
"errorCode",
"!=",
"null",
")",
"{",
"response",
".",
"setStatus",
"(",
"statusCode",
")",
";",
"response",
".",
"setHeader",
"(",
"ClientConstants",
".",
"REQ_CONTENT_TYPE_NAME",
",",
"\"application/json;charset=UTF-8\"",
")",
";",
"JSONObject",
"responseJSON",
"=",
"new",
"JSONObject",
"(",
")",
";",
"responseJSON",
".",
"put",
"(",
"error",
",",
"errorCode",
")",
";",
"if",
"(",
"errorDescription",
"!=",
"null",
")",
"{",
"responseJSON",
".",
"put",
"(",
"error_description",
",",
"errorDescription",
")",
";",
"}",
"PrintWriter",
"pw",
";",
"pw",
"=",
"response",
".",
"getWriter",
"(",
")",
";",
"pw",
".",
"write",
"(",
"responseJSON",
".",
"toString",
"(",
")",
")",
";",
"pw",
".",
"flush",
"(",
")",
";",
"}",
"else",
"{",
"response",
".",
"sendError",
"(",
"statusCode",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Internal error sending error message\"",
",",
"e",
")",
";",
"try",
"{",
"response",
".",
"sendError",
"(",
"HttpServletResponse",
".",
"SC_INTERNAL_SERVER_ERROR",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"yet another internal error, give up\"",
",",
"ioe",
")",
";",
"}",
"}",
"}"
] | refactored from Oauth SendErrorJson. Only usable for sending an http400. | [
"refactored",
"from",
"Oauth",
"SendErrorJson",
".",
"Only",
"usable",
"for",
"sending",
"an",
"http400",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/clients/common/AuthorizationCodeHandler.java#L175-L207 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.first | public boolean first() throws SQLException {
try {
if (dsConfig.get().beginTranForResultSetScrollingAPIs)
getConnectionWrapper().beginTransactionIfNecessary();
return rsetImpl.first();
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.first", "411", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public boolean first() throws SQLException {
try {
if (dsConfig.get().beginTranForResultSetScrollingAPIs)
getConnectionWrapper().beginTransactionIfNecessary();
return rsetImpl.first();
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.first", "411", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"boolean",
"first",
"(",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"if",
"(",
"dsConfig",
".",
"get",
"(",
")",
".",
"beginTranForResultSetScrollingAPIs",
")",
"getConnectionWrapper",
"(",
")",
".",
"beginTransactionIfNecessary",
"(",
")",
";",
"return",
"rsetImpl",
".",
"first",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.first\"",
",",
"\"411\"",
",",
"this",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"}"
] | Moves the cursor to the first row in the result set.
@return
true if the cursor is on a valid row; false if there are no rows in the result set
@throws SQLException if a database access error occurs or the result set type is TYPE_FORWARD_ONLY | [
"Moves",
"the",
"cursor",
"to",
"the",
"first",
"row",
"in",
"the",
"result",
"set",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L308-L321 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.getArray | public Array getArray(int arg0) throws SQLException {
try {
Array ra = rsetImpl.getArray(arg0);
if (ra != null && freeResourcesOnClose)
arrays.add(ra);
return ra;
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getArray", "438", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public Array getArray(int arg0) throws SQLException {
try {
Array ra = rsetImpl.getArray(arg0);
if (ra != null && freeResourcesOnClose)
arrays.add(ra);
return ra;
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getArray", "438", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"Array",
"getArray",
"(",
"int",
"arg0",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"Array",
"ra",
"=",
"rsetImpl",
".",
"getArray",
"(",
"arg0",
")",
";",
"if",
"(",
"ra",
"!=",
"null",
"&&",
"freeResourcesOnClose",
")",
"arrays",
".",
"add",
"(",
"ra",
")",
";",
"return",
"ra",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getArray\"",
",",
"\"438\"",
",",
"this",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"}"
] | Gets an SQL ARRAY value from the current row of this ResultSet object.
@param i - the first column is 1, the second is 2, ...
@return
an Array object representing the SQL ARRAY value in the specified column. | [
"Gets",
"an",
"SQL",
"ARRAY",
"value",
"from",
"the",
"current",
"row",
"of",
"this",
"ResultSet",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L330-L343 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.getBlob | public Blob getBlob(int arg0) throws SQLException {
try {
Blob blob = rsetImpl.getBlob(arg0);
if (blob != null && freeResourcesOnClose)
blobs.add(blob);
return blob;
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getBlob", "754", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public Blob getBlob(int arg0) throws SQLException {
try {
Blob blob = rsetImpl.getBlob(arg0);
if (blob != null && freeResourcesOnClose)
blobs.add(blob);
return blob;
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getBlob", "754", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"Blob",
"getBlob",
"(",
"int",
"arg0",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"Blob",
"blob",
"=",
"rsetImpl",
".",
"getBlob",
"(",
"arg0",
")",
";",
"if",
"(",
"blob",
"!=",
"null",
"&&",
"freeResourcesOnClose",
")",
"blobs",
".",
"add",
"(",
"blob",
")",
";",
"return",
"blob",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getBlob\"",
",",
"\"754\"",
",",
"this",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"}"
] | Gets a BLOB value in the current row of this ResultSet object.
@param i - the first column is 1, the second is 2, ...
@return
a Blob object representing the SQL BLOB value in the specified column. | [
"Gets",
"a",
"BLOB",
"value",
"in",
"the",
"current",
"row",
"of",
"this",
"ResultSet",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L518-L531 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.getCharacterStream | public Reader getCharacterStream(int arg0) throws SQLException {
try {
Reader reader = rsetImpl.getCharacterStream(arg0);
if (reader != null && freeResourcesOnClose)
resources.add(reader);
return reader;
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getCharacterStream", "983", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public Reader getCharacterStream(int arg0) throws SQLException {
try {
Reader reader = rsetImpl.getCharacterStream(arg0);
if (reader != null && freeResourcesOnClose)
resources.add(reader);
return reader;
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getCharacterStream", "983", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"Reader",
"getCharacterStream",
"(",
"int",
"arg0",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"Reader",
"reader",
"=",
"rsetImpl",
".",
"getCharacterStream",
"(",
"arg0",
")",
";",
"if",
"(",
"reader",
"!=",
"null",
"&&",
"freeResourcesOnClose",
")",
"resources",
".",
"add",
"(",
"reader",
")",
";",
"return",
"reader",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getCharacterStream\"",
",",
"\"983\"",
",",
"this",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"}"
] | Gets the value of a column in the current row as a java.io.Reader.
@param columnIndex - the first column is 1, the second is 2, ... | [
"Gets",
"the",
"value",
"of",
"a",
"column",
"in",
"the",
"current",
"row",
"as",
"a",
"java",
".",
"io",
".",
"Reader",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L682-L695 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.getClob | public Clob getClob(int arg0) throws SQLException {
try {
Clob clob = rsetImpl.getClob(arg0);
if (clob != null && freeResourcesOnClose)
clobs.add(clob);
return clob;
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getClob", "1037", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public Clob getClob(int arg0) throws SQLException {
try {
Clob clob = rsetImpl.getClob(arg0);
if (clob != null && freeResourcesOnClose)
clobs.add(clob);
return clob;
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getClob", "1037", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"Clob",
"getClob",
"(",
"int",
"arg0",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"Clob",
"clob",
"=",
"rsetImpl",
".",
"getClob",
"(",
"arg0",
")",
";",
"if",
"(",
"clob",
"!=",
"null",
"&&",
"freeResourcesOnClose",
")",
"clobs",
".",
"add",
"(",
"clob",
")",
";",
"return",
"clob",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getClob\"",
",",
"\"1037\"",
",",
"this",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"}"
] | Gets a CLOB value in the current row of this ResultSet object.
@param i - the first column is 1, the second is 2, ...
@return
a Clob object representing the SQL CLOB value in the specified column. | [
"Gets",
"a",
"CLOB",
"value",
"in",
"the",
"current",
"row",
"of",
"this",
"ResultSet",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L726-L739 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.getCursorName | public String getCursorName() throws SQLException {
try {
return rsetImpl.getCursorName();
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getCursorName", "1129", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public String getCursorName() throws SQLException {
try {
return rsetImpl.getCursorName();
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getCursorName", "1129", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"String",
"getCursorName",
"(",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"return",
"rsetImpl",
".",
"getCursorName",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getCursorName\"",
",",
"\"1129\"",
",",
"this",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"}"
] | Gets the name of the SQL cursor used by this ResultSet.
In SQL, a result table is retrieved through a cursor that is named. The current row of a result can be updated or
deleted using a positioned update/delete statement that references the cursor name. To insure that the cursor has the
proper isolation level to support update, the cursor's select statement should be of the form 'select for update'. If the
'for update' clause is omitted the positioned updates may fail.
JDBC supports this SQL feature by providing the name of the SQL cursor used by a ResultSet. The current row of a
ResultSet is also the current row of this SQL cursor.
Note: If positioned update is not supported a SQLException is thrown
@return
the ResultSet's SQL cursor name
@throws SQLException if a database access error occurs. | [
"Gets",
"the",
"name",
"of",
"the",
"SQL",
"cursor",
"used",
"by",
"this",
"ResultSet",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L810-L820 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.getFetchDirection | public int getFetchDirection() throws SQLException {
try {
return rsetImpl.getFetchDirection();
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getFetchDirection", "1336", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public int getFetchDirection() throws SQLException {
try {
return rsetImpl.getFetchDirection();
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getFetchDirection", "1336", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"int",
"getFetchDirection",
"(",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"return",
"rsetImpl",
".",
"getFetchDirection",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getFetchDirection\"",
",",
"\"1336\"",
",",
"this",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"}"
] | Returns the fetch direction for this result set.
@return
the current fetch direction for this result set
@throws SQLException if a database access error occurs. | [
"Returns",
"the",
"fetch",
"direction",
"for",
"this",
"result",
"set",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L955-L965 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.getMetaData | public ResultSetMetaData getMetaData() throws SQLException {
if (tc.isEntryEnabled())
Tr.entry(this, tc, "getMetaData");
// First, check if a ResultSetMetaData wrapper for this ResultSet already exists.
ResultSetMetaData rsetMData = null;
try // get a meta data
{
rsetMData = rsetImpl.getMetaData();
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getMetaData", "1579", this);
if (tc.isEntryEnabled())
Tr.exit(this, tc, "getMetaData", "Exception");
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
if (tc.isEntryEnabled())
Tr.exit(this, tc, "getMetaData", "Exception");
throw runtimeXIfNotClosed(nullX);
}
if (tc.isEntryEnabled())
Tr.exit(this, tc, "getMetaData", rsetMData);
return rsetMData;
} | java | public ResultSetMetaData getMetaData() throws SQLException {
if (tc.isEntryEnabled())
Tr.entry(this, tc, "getMetaData");
// First, check if a ResultSetMetaData wrapper for this ResultSet already exists.
ResultSetMetaData rsetMData = null;
try // get a meta data
{
rsetMData = rsetImpl.getMetaData();
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getMetaData", "1579", this);
if (tc.isEntryEnabled())
Tr.exit(this, tc, "getMetaData", "Exception");
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
if (tc.isEntryEnabled())
Tr.exit(this, tc, "getMetaData", "Exception");
throw runtimeXIfNotClosed(nullX);
}
if (tc.isEntryEnabled())
Tr.exit(this, tc, "getMetaData", rsetMData);
return rsetMData;
} | [
"public",
"ResultSetMetaData",
"getMetaData",
"(",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getMetaData\"",
")",
";",
"// First, check if a ResultSetMetaData wrapper for this ResultSet already exists.",
"ResultSetMetaData",
"rsetMData",
"=",
"null",
";",
"try",
"// get a meta data",
"{",
"rsetMData",
"=",
"rsetImpl",
".",
"getMetaData",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getMetaData\"",
",",
"\"1579\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getMetaData\"",
",",
"\"Exception\"",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getMetaData\"",
",",
"\"Exception\"",
")",
";",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getMetaData\"",
",",
"rsetMData",
")",
";",
"return",
"rsetMData",
";",
"}"
] | Retrieves the number, types and properties of a ResultSet's columns.
@return
the description of a ResultSet's columns
@throws SQLException if a database access error occurs. | [
"Retrieves",
"the",
"number",
"types",
"and",
"properties",
"of",
"a",
"ResultSet",
"s",
"columns",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L1154-L1180 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.getObject | public Object getObject(String arg0) throws SQLException {
try {
Object result = rsetImpl.getObject(arg0);
addFreedResources(result);
return result;
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getObject", "1684", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public Object getObject(String arg0) throws SQLException {
try {
Object result = rsetImpl.getObject(arg0);
addFreedResources(result);
return result;
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getObject", "1684", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"Object",
"getObject",
"(",
"String",
"arg0",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"Object",
"result",
"=",
"rsetImpl",
".",
"getObject",
"(",
"arg0",
")",
";",
"addFreedResources",
"(",
"result",
")",
";",
"return",
"result",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getObject\"",
",",
"\"1684\"",
",",
"this",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"}"
] | Gets the value of a column in the current row as a Java object.
This method will return the value of the given column as a Java object. The type of the Java object will be the
default Java object type corresponding to the column's SQL type, following the mapping for built-in types specified
in the JDBC spec.
This method may also be used to read datatabase-specific abstract data types. JDBC 2.0 In the JDBC 2.0 API, the
behavior of method getObject is extended to materialize data of SQL user-defined types. When the a column
contains a structured or distinct value, the behavior of this method is as if it were a call to: getObject(columnIndex,
this.getStatement().getConnection().getTypeMap()).
@param columnName - the SQL name of the column
@return
a java.lang.Object holding the column value.
@throws SQLException if a database access error occurs. | [
"Gets",
"the",
"value",
"of",
"a",
"column",
"in",
"the",
"current",
"row",
"as",
"a",
"Java",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L1460-L1474 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.getStatement | public Statement getStatement() throws SQLException {
// The parent of a ResultSet may be a Statement or a MetaData.
// For ResultSets created by MetaDatas, the getStatement method should return null,
// unless the result set is closed.
if (state == State.CLOSED || parentWrapper == null)
throw createClosedException("ResultSet");
if (parentWrapper instanceof WSJdbcDatabaseMetaData)
return null;
return (Statement) parentWrapper;
} | java | public Statement getStatement() throws SQLException {
// The parent of a ResultSet may be a Statement or a MetaData.
// For ResultSets created by MetaDatas, the getStatement method should return null,
// unless the result set is closed.
if (state == State.CLOSED || parentWrapper == null)
throw createClosedException("ResultSet");
if (parentWrapper instanceof WSJdbcDatabaseMetaData)
return null;
return (Statement) parentWrapper;
} | [
"public",
"Statement",
"getStatement",
"(",
")",
"throws",
"SQLException",
"{",
"// The parent of a ResultSet may be a Statement or a MetaData.",
"// For ResultSets created by MetaDatas, the getStatement method should return null,",
"// unless the result set is closed.",
"if",
"(",
"state",
"==",
"State",
".",
"CLOSED",
"||",
"parentWrapper",
"==",
"null",
")",
"throw",
"createClosedException",
"(",
"\"ResultSet\"",
")",
";",
"if",
"(",
"parentWrapper",
"instanceof",
"WSJdbcDatabaseMetaData",
")",
"return",
"null",
";",
"return",
"(",
"Statement",
")",
"parentWrapper",
";",
"}"
] | Returns the Statement that produced this ResultSet object. If the result set was generated some other
way, such as by a DatabaseMetaData method, this method returns null.
@return
the Statment that produced the result set or null if the result set was produced some other way
@throws SQLException if a database access error occurs. | [
"Returns",
"the",
"Statement",
"that",
"produced",
"this",
"ResultSet",
"object",
".",
"If",
"the",
"result",
"set",
"was",
"generated",
"some",
"other",
"way",
"such",
"as",
"by",
"a",
"DatabaseMetaData",
"method",
"this",
"method",
"returns",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L1741-L1753 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.getWarnings | public SQLWarning getWarnings() throws SQLException {
try {
return rsetImpl.getWarnings();
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getWarnings", "2345", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public SQLWarning getWarnings() throws SQLException {
try {
return rsetImpl.getWarnings();
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getWarnings", "2345", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"SQLWarning",
"getWarnings",
"(",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"return",
"rsetImpl",
".",
"getWarnings",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getWarnings\"",
",",
"\"2345\"",
",",
"this",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"}"
] | The first warning reported by calls on this ResultSet is returned. Subsequent ResultSet warnings will be chained to
this SQLWarning.
The warning chain is automatically cleared each time a new row is read.
Note: This warning chain only covers warnings caused by ResultSet methods. Any warning caused by statement
methods (such as reading OUT parameters) will be chained on the Statement object.
@return
the first SQLWarning or null
@throws SQLException if a database access error occurs. | [
"The",
"first",
"warning",
"reported",
"by",
"calls",
"on",
"this",
"ResultSet",
"is",
"returned",
".",
"Subsequent",
"ResultSet",
"warnings",
"will",
"be",
"chained",
"to",
"this",
"SQLWarning",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L2039-L2049 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.setFetchDirection | public void setFetchDirection(int direction) throws SQLException {
if (tc.isDebugEnabled())
Tr.debug(this, tc, "setFetchDirection", AdapterUtil.getFetchDirectionString(direction));
try {
rsetImpl.setFetchDirection(direction);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.setFetchDirection", "2860", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public void setFetchDirection(int direction) throws SQLException {
if (tc.isDebugEnabled())
Tr.debug(this, tc, "setFetchDirection", AdapterUtil.getFetchDirectionString(direction));
try {
rsetImpl.setFetchDirection(direction);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.setFetchDirection", "2860", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"void",
"setFetchDirection",
"(",
"int",
"direction",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"setFetchDirection\"",
",",
"AdapterUtil",
".",
"getFetchDirectionString",
"(",
"direction",
")",
")",
";",
"try",
"{",
"rsetImpl",
".",
"setFetchDirection",
"(",
"direction",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.setFetchDirection\"",
",",
"\"2860\"",
",",
"this",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"}"
] | Gives a hint as to the direction in which the rows in this result set will be processed. The initial value is
determined by the statement that produced the result set. The fetch direction may be changed at any time.
@param direction fetch direction
@throws SQLException if a database access error occurs or the result set type is TYPE_FORWARD_ONLY and the
fetch direction is not FETCH_FORWARD. | [
"Gives",
"a",
"hint",
"as",
"to",
"the",
"direction",
"in",
"which",
"the",
"rows",
"in",
"this",
"result",
"set",
"will",
"be",
"processed",
".",
"The",
"initial",
"value",
"is",
"determined",
"by",
"the",
"statement",
"that",
"produced",
"the",
"result",
"set",
".",
"The",
"fetch",
"direction",
"may",
"be",
"changed",
"at",
"any",
"time",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L2434-L2447 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.setFetchSize | public void setFetchSize(int rows) throws SQLException {
if (tc.isDebugEnabled())
Tr.debug(this, tc, "setFetchSize", rows);
try {
rsetImpl.setFetchSize(rows);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.setFetchSize", "2891", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public void setFetchSize(int rows) throws SQLException {
if (tc.isDebugEnabled())
Tr.debug(this, tc, "setFetchSize", rows);
try {
rsetImpl.setFetchSize(rows);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.setFetchSize", "2891", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"void",
"setFetchSize",
"(",
"int",
"rows",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"setFetchSize\"",
",",
"rows",
")",
";",
"try",
"{",
"rsetImpl",
".",
"setFetchSize",
"(",
"rows",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.setFetchSize\"",
",",
"\"2891\"",
",",
"this",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"}"
] | Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when
more rows are needed for this result set. If the fetch size specified is zero, the JDBC driver ignores the value and is
free to make its own best guess as to what the fetch size should be. The default value is set by the statement that
created the result set. The fetch size may be changed at any time.
@param rows - the number of rows to fetch
@throws SQLException if a database access error occurs or the condition 0 <= rows <= this.getMaxRows() is not
satisfied. | [
"Gives",
"the",
"JDBC",
"driver",
"a",
"hint",
"as",
"to",
"the",
"number",
"of",
"rows",
"that",
"should",
"be",
"fetched",
"from",
"the",
"database",
"when",
"more",
"rows",
"are",
"needed",
"for",
"this",
"result",
"set",
".",
"If",
"the",
"fetch",
"size",
"specified",
"is",
"zero",
"the",
"JDBC",
"driver",
"ignores",
"the",
"value",
"and",
"is",
"free",
"to",
"make",
"its",
"own",
"best",
"guess",
"as",
"to",
"what",
"the",
"fetch",
"size",
"should",
"be",
".",
"The",
"default",
"value",
"is",
"set",
"by",
"the",
"statement",
"that",
"created",
"the",
"result",
"set",
".",
"The",
"fetch",
"size",
"may",
"be",
"changed",
"at",
"any",
"time",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L2459-L2472 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.updateBinaryStream | public void updateBinaryStream(String arg0, InputStream arg1, int arg2) throws SQLException {
try {
rsetImpl.updateBinaryStream(arg0, arg1, arg2);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateBinaryStream", "3075", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public void updateBinaryStream(String arg0, InputStream arg1, int arg2) throws SQLException {
try {
rsetImpl.updateBinaryStream(arg0, arg1, arg2);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateBinaryStream", "3075", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"void",
"updateBinaryStream",
"(",
"String",
"arg0",
",",
"InputStream",
"arg1",
",",
"int",
"arg2",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"rsetImpl",
".",
"updateBinaryStream",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateBinaryStream\"",
",",
"\"3075\"",
",",
"this",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"}"
] | Updates a column with a binary stream value. The updateXXX methods are used to update column values
in the current row, or the insert row. The updateXXX methods do not update the underlying database; instead the
updateRow or insertRow methods are called to update the database.
@param columnName - the name of the column
x - the new column value
length - of the stream
@throws SQLException if a database access error occurs. | [
"Updates",
"a",
"column",
"with",
"a",
"binary",
"stream",
"value",
".",
"The",
"updateXXX",
"methods",
"are",
"used",
"to",
"update",
"column",
"values",
"in",
"the",
"current",
"row",
"or",
"the",
"insert",
"row",
".",
"The",
"updateXXX",
"methods",
"do",
"not",
"update",
"the",
"underlying",
"database",
";",
"instead",
"the",
"updateRow",
"or",
"insertRow",
"methods",
"are",
"called",
"to",
"update",
"the",
"database",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L2824-L2834 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.updateCharacterStream | public void updateCharacterStream(String arg0, Reader arg1, int arg2) throws SQLException {
try {
rsetImpl.updateCharacterStream(arg0, arg1, arg2);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateCharacterStream", "3317", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public void updateCharacterStream(String arg0, Reader arg1, int arg2) throws SQLException {
try {
rsetImpl.updateCharacterStream(arg0, arg1, arg2);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateCharacterStream", "3317", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"void",
"updateCharacterStream",
"(",
"String",
"arg0",
",",
"Reader",
"arg1",
",",
"int",
"arg2",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"rsetImpl",
".",
"updateCharacterStream",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateCharacterStream\"",
",",
"\"3317\"",
",",
"this",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"}"
] | Updates a column with a character stream value. The updateXXX methods are used to update column
values in the current row, or the insert row. The updateXXX methods do not update the underlying database; instead
the updateRow or insertRow methods are called to update the database.
@param columnName - the name of the column
x - the new column value
length - of the stream
@throws SQLException if a database access error occurs. | [
"Updates",
"a",
"column",
"with",
"a",
"character",
"stream",
"value",
".",
"The",
"updateXXX",
"methods",
"are",
"used",
"to",
"update",
"column",
"values",
"in",
"the",
"current",
"row",
"or",
"the",
"insert",
"row",
".",
"The",
"updateXXX",
"methods",
"do",
"not",
"update",
"the",
"underlying",
"database",
";",
"instead",
"the",
"updateRow",
"or",
"insertRow",
"methods",
"are",
"called",
"to",
"update",
"the",
"database",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L3258-L3268 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.updateObject | public void updateObject(int arg0, Object arg1, int arg2) throws SQLException {
try {
rsetImpl.updateObject(arg0, arg1, arg2);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateObject", "3737", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public void updateObject(int arg0, Object arg1, int arg2) throws SQLException {
try {
rsetImpl.updateObject(arg0, arg1, arg2);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateObject", "3737", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"void",
"updateObject",
"(",
"int",
"arg0",
",",
"Object",
"arg1",
",",
"int",
"arg2",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"rsetImpl",
".",
"updateObject",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateObject\"",
",",
"\"3737\"",
",",
"this",
")",
";",
"throw",
"WSJdbcUtil",
".",
"mapException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"nullX",
")",
"{",
"// No FFDC code needed; we might be closed.",
"throw",
"runtimeXIfNotClosed",
"(",
"nullX",
")",
";",
"}",
"}"
] | Updates a column with an Object value. The updateXXX methods are used to update column values in
the current row, or the insert row. The updateXXX methods do not update the underlying database; instead the
updateRow or insertRow methods are called to update the database.
@param columnIndex - the first column is 1, the second is 2, ...
x - the new column value
scale - For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types this is the number of digits after
the decimal. For all other types this value will be ignored.
@throws SQLException if a database access error occurs. | [
"Updates",
"a",
"column",
"with",
"an",
"Object",
"value",
".",
"The",
"updateXXX",
"methods",
"are",
"used",
"to",
"update",
"column",
"values",
"in",
"the",
"current",
"row",
"or",
"the",
"insert",
"row",
".",
"The",
"updateXXX",
"methods",
"do",
"not",
"update",
"the",
"underlying",
"database",
";",
"instead",
"the",
"updateRow",
"or",
"insertRow",
"methods",
"are",
"called",
"to",
"update",
"the",
"database",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L4113-L4123 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/TranSynchronization.java | TranSynchronization.afterCompletion | @Override
public void afterCompletion(int status) {
logger.log(Level.FINE, "The status of the transaction commit is: " + status);
if (status == Status.STATUS_COMMITTED){
//Save the metrics object after a successful commit
runtimeStepExecution.setCommittedMetrics();
} else{
//status = 4 = STATUS_ROLLEDBACK;
runtimeStepExecution.rollBackMetrics();
}
} | java | @Override
public void afterCompletion(int status) {
logger.log(Level.FINE, "The status of the transaction commit is: " + status);
if (status == Status.STATUS_COMMITTED){
//Save the metrics object after a successful commit
runtimeStepExecution.setCommittedMetrics();
} else{
//status = 4 = STATUS_ROLLEDBACK;
runtimeStepExecution.rollBackMetrics();
}
} | [
"@",
"Override",
"public",
"void",
"afterCompletion",
"(",
"int",
"status",
")",
"{",
"logger",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"The status of the transaction commit is: \"",
"+",
"status",
")",
";",
"if",
"(",
"status",
"==",
"Status",
".",
"STATUS_COMMITTED",
")",
"{",
"//Save the metrics object after a successful commit",
"runtimeStepExecution",
".",
"setCommittedMetrics",
"(",
")",
";",
"}",
"else",
"{",
"//status = 4 = STATUS_ROLLEDBACK;",
"runtimeStepExecution",
".",
"rollBackMetrics",
"(",
")",
";",
"}",
"}"
] | Upon successful transaction commit status, store the value of the committed metrics.
Upon any other status value roll back the metrics to the last committed value.
@see javax.transaction.Synchronization#afterCompletion(int) | [
"Upon",
"successful",
"transaction",
"commit",
"status",
"store",
"the",
"value",
"of",
"the",
"committed",
"metrics",
".",
"Upon",
"any",
"other",
"status",
"value",
"roll",
"back",
"the",
"metrics",
"to",
"the",
"last",
"committed",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/TranSynchronization.java#L43-L56 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InterceptorProxy.java | InterceptorProxy.invokeInterceptor | public final Object invokeInterceptor(Object bean, InvocationContext inv, Object[] interceptors) throws Exception {
// Interceptor instance is the bean instance itself if the
// interceptor index is < 0.
Object interceptorInstance = (ivBeanInterceptor) ? bean : interceptors[ivInterceptorIndex];
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) // d367572.7
{
Tr.debug(tc, "invoking " + this);
Tr.debug(tc, "interceptor instance = " + interceptorInstance);
}
// Does interceptor method require InvocationContext as an argument?
if (ivRequiresInvocationContext) {
try {
// Yes it does, so pass it as an argument.
Object[] args = new Object[] { inv }; // d404122
return ivInterceptorMethod.invoke(interceptorInstance, args); // d404122
} catch (IllegalArgumentException ie) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ivInterceptorMethod: " + ivInterceptorMethod.toString() + " class: " + ivInterceptorMethod.getClass() + " declaring class: "
+ ivInterceptorMethod.getDeclaringClass());
Tr.debug(tc, "interceptorInstance: " + interceptorInstance.toString() + " class: " + interceptorInstance.getClass());
}
throw ie;
}
} else {
// Nope, interceptor method takes no arguments.
return ivInterceptorMethod.invoke(interceptorInstance, NO_ARGS);
}
} | java | public final Object invokeInterceptor(Object bean, InvocationContext inv, Object[] interceptors) throws Exception {
// Interceptor instance is the bean instance itself if the
// interceptor index is < 0.
Object interceptorInstance = (ivBeanInterceptor) ? bean : interceptors[ivInterceptorIndex];
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) // d367572.7
{
Tr.debug(tc, "invoking " + this);
Tr.debug(tc, "interceptor instance = " + interceptorInstance);
}
// Does interceptor method require InvocationContext as an argument?
if (ivRequiresInvocationContext) {
try {
// Yes it does, so pass it as an argument.
Object[] args = new Object[] { inv }; // d404122
return ivInterceptorMethod.invoke(interceptorInstance, args); // d404122
} catch (IllegalArgumentException ie) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ivInterceptorMethod: " + ivInterceptorMethod.toString() + " class: " + ivInterceptorMethod.getClass() + " declaring class: "
+ ivInterceptorMethod.getDeclaringClass());
Tr.debug(tc, "interceptorInstance: " + interceptorInstance.toString() + " class: " + interceptorInstance.getClass());
}
throw ie;
}
} else {
// Nope, interceptor method takes no arguments.
return ivInterceptorMethod.invoke(interceptorInstance, NO_ARGS);
}
} | [
"public",
"final",
"Object",
"invokeInterceptor",
"(",
"Object",
"bean",
",",
"InvocationContext",
"inv",
",",
"Object",
"[",
"]",
"interceptors",
")",
"throws",
"Exception",
"{",
"// Interceptor instance is the bean instance itself if the",
"// interceptor index is < 0.",
"Object",
"interceptorInstance",
"=",
"(",
"ivBeanInterceptor",
")",
"?",
"bean",
":",
"interceptors",
"[",
"ivInterceptorIndex",
"]",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"// d367572.7",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"invoking \"",
"+",
"this",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"interceptor instance = \"",
"+",
"interceptorInstance",
")",
";",
"}",
"// Does interceptor method require InvocationContext as an argument?",
"if",
"(",
"ivRequiresInvocationContext",
")",
"{",
"try",
"{",
"// Yes it does, so pass it as an argument.",
"Object",
"[",
"]",
"args",
"=",
"new",
"Object",
"[",
"]",
"{",
"inv",
"}",
";",
"// d404122",
"return",
"ivInterceptorMethod",
".",
"invoke",
"(",
"interceptorInstance",
",",
"args",
")",
";",
"// d404122",
"}",
"catch",
"(",
"IllegalArgumentException",
"ie",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"ivInterceptorMethod: \"",
"+",
"ivInterceptorMethod",
".",
"toString",
"(",
")",
"+",
"\" class: \"",
"+",
"ivInterceptorMethod",
".",
"getClass",
"(",
")",
"+",
"\" declaring class: \"",
"+",
"ivInterceptorMethod",
".",
"getDeclaringClass",
"(",
")",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"interceptorInstance: \"",
"+",
"interceptorInstance",
".",
"toString",
"(",
")",
"+",
"\" class: \"",
"+",
"interceptorInstance",
".",
"getClass",
"(",
")",
")",
";",
"}",
"throw",
"ie",
";",
"}",
"}",
"else",
"{",
"// Nope, interceptor method takes no arguments.",
"return",
"ivInterceptorMethod",
".",
"invoke",
"(",
"interceptorInstance",
",",
"NO_ARGS",
")",
";",
"}",
"}"
] | Invoke the interceptor method associated with the interceptor index
that was passed as the "interceptorIndex" parameter of the
constructor method of this class.
@param bean is the EJB instance that is the target of this invocation.
@param inv is the InvocationContext to pass as an argument to the
interceptor method if the interceptor method requires it.
@param interceptors is the array of interceptor instances created for a
particular EJB instance. The array must be ordered so that the
"interceptorIndex" parameter passed to the constructor method
of this class can be used as an index into this array to
select the correct interceptor instance to invoke.
@return Object returned by interceptor instance.
@throws Exception | [
"Invoke",
"the",
"interceptor",
"method",
"associated",
"with",
"the",
"interceptor",
"index",
"that",
"was",
"passed",
"as",
"the",
"interceptorIndex",
"parameter",
"of",
"the",
"constructor",
"method",
"of",
"this",
"class",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InterceptorProxy.java#L173-L202 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/hibernate/LibertyJtaPlatform.java | LibertyJtaPlatform.invoke | @Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
String methodName = method.getName();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(this, tc, methodName, args);
Object r = null;
try {
if (args == null || args.length == 0) {
if ("canRegisterSynchronization".equals(methodName))
r = canRegisterSynchronization();
else if ("getCurrentStatus".equals(methodName))
r = getCurrentStatus();
else if ("hashCode".equals(methodName))
r = System.identityHashCode(this);
else if ("retrieveTransactionManager".equals(methodName))
r = retrieveTransactionManager();
else if ("retrieveUserTransaction".equals(methodName))
r = retrieveUserTransaction();
else if ("toString".equals(methodName))
r = new StringBuilder(getClass().getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).toString();
} else {
if ("equals".equals(methodName))
r = proxy == args[0]; // assumes one proxy per invocation handler
else if ("getTransactionIdentifier".equals(methodName))
r = getTransactionIdentifier((Transaction) args[0]);
else if ("registerSynchronization".equals(methodName))
registerSynchronization((Synchronization) args[0]);
}
} catch (Throwable x) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(this, tc, methodName, x);
throw x;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(this, tc, methodName, r);
return r;
} | java | @Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
String methodName = method.getName();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(this, tc, methodName, args);
Object r = null;
try {
if (args == null || args.length == 0) {
if ("canRegisterSynchronization".equals(methodName))
r = canRegisterSynchronization();
else if ("getCurrentStatus".equals(methodName))
r = getCurrentStatus();
else if ("hashCode".equals(methodName))
r = System.identityHashCode(this);
else if ("retrieveTransactionManager".equals(methodName))
r = retrieveTransactionManager();
else if ("retrieveUserTransaction".equals(methodName))
r = retrieveUserTransaction();
else if ("toString".equals(methodName))
r = new StringBuilder(getClass().getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).toString();
} else {
if ("equals".equals(methodName))
r = proxy == args[0]; // assumes one proxy per invocation handler
else if ("getTransactionIdentifier".equals(methodName))
r = getTransactionIdentifier((Transaction) args[0]);
else if ("registerSynchronization".equals(methodName))
registerSynchronization((Synchronization) args[0]);
}
} catch (Throwable x) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(this, tc, methodName, x);
throw x;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(this, tc, methodName, r);
return r;
} | [
"@",
"Override",
"public",
"Object",
"invoke",
"(",
"Object",
"proxy",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"Throwable",
"{",
"String",
"methodName",
"=",
"method",
".",
"getName",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"methodName",
",",
"args",
")",
";",
"Object",
"r",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"args",
"==",
"null",
"||",
"args",
".",
"length",
"==",
"0",
")",
"{",
"if",
"(",
"\"canRegisterSynchronization\"",
".",
"equals",
"(",
"methodName",
")",
")",
"r",
"=",
"canRegisterSynchronization",
"(",
")",
";",
"else",
"if",
"(",
"\"getCurrentStatus\"",
".",
"equals",
"(",
"methodName",
")",
")",
"r",
"=",
"getCurrentStatus",
"(",
")",
";",
"else",
"if",
"(",
"\"hashCode\"",
".",
"equals",
"(",
"methodName",
")",
")",
"r",
"=",
"System",
".",
"identityHashCode",
"(",
"this",
")",
";",
"else",
"if",
"(",
"\"retrieveTransactionManager\"",
".",
"equals",
"(",
"methodName",
")",
")",
"r",
"=",
"retrieveTransactionManager",
"(",
")",
";",
"else",
"if",
"(",
"\"retrieveUserTransaction\"",
".",
"equals",
"(",
"methodName",
")",
")",
"r",
"=",
"retrieveUserTransaction",
"(",
")",
";",
"else",
"if",
"(",
"\"toString\"",
".",
"equals",
"(",
"methodName",
")",
")",
"r",
"=",
"new",
"StringBuilder",
"(",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"Integer",
".",
"toHexString",
"(",
"System",
".",
"identityHashCode",
"(",
"this",
")",
")",
")",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"\"equals\"",
".",
"equals",
"(",
"methodName",
")",
")",
"r",
"=",
"proxy",
"==",
"args",
"[",
"0",
"]",
";",
"// assumes one proxy per invocation handler",
"else",
"if",
"(",
"\"getTransactionIdentifier\"",
".",
"equals",
"(",
"methodName",
")",
")",
"r",
"=",
"getTransactionIdentifier",
"(",
"(",
"Transaction",
")",
"args",
"[",
"0",
"]",
")",
";",
"else",
"if",
"(",
"\"registerSynchronization\"",
".",
"equals",
"(",
"methodName",
")",
")",
"registerSynchronization",
"(",
"(",
"Synchronization",
")",
"args",
"[",
"0",
"]",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"x",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"methodName",
",",
"x",
")",
";",
"throw",
"x",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"methodName",
",",
"r",
")",
";",
"return",
"r",
";",
"}"
] | Invokes our implementation for methods of org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform | [
"Invokes",
"our",
"implementation",
"for",
"methods",
"of",
"org",
".",
"hibernate",
".",
"engine",
".",
"transaction",
".",
"jta",
".",
"platform",
".",
"spi",
".",
"JtaPlatform"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/hibernate/LibertyJtaPlatform.java#L51-L88 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.app.manager.war/src/com/ibm/ws/app/manager/ear/internal/EARDeployedAppInfo.java | EARDeployedAppInfo.getMFMainClass | protected String getMFMainClass(Container appEntryContainer, String entryPath, boolean required) {
String mfMainClass = null;
try {
String entry = "/META-INF/MANIFEST.MF";
Entry manifestEntry = appEntryContainer.getEntry(entry);
if (manifestEntry != null) {
InputStream is = null;
try {
is = manifestEntry.adapt(InputStream.class);
// "is" is null when MANIFEST.MF is a directory
if (is == null) {
throw new FileNotFoundException(entry);
}
Manifest manifest = new Manifest(is);
mfMainClass = manifest.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS);
if ("".equals(mfMainClass)) {
mfMainClass = null;
}
} finally {
if (is != null) {
try {
is.close();
} catch (IOException io) {
/* do nothing */
}
}
}
}
if (mfMainClass == null && required) {
Tr.error(_tc, "error.module.manifest.read.no.mainclass", getName(), entryPath);
}
} catch (IOException ioe) {
Tr.error(_tc, "error.module.manifest.read.failed", getName(), entryPath, ioe);
} catch (UnableToAdaptException uae) {
Tr.error(_tc, "error.module.manifest.read.failed", getName(), entryPath, uae);
}
return mfMainClass;
} | java | protected String getMFMainClass(Container appEntryContainer, String entryPath, boolean required) {
String mfMainClass = null;
try {
String entry = "/META-INF/MANIFEST.MF";
Entry manifestEntry = appEntryContainer.getEntry(entry);
if (manifestEntry != null) {
InputStream is = null;
try {
is = manifestEntry.adapt(InputStream.class);
// "is" is null when MANIFEST.MF is a directory
if (is == null) {
throw new FileNotFoundException(entry);
}
Manifest manifest = new Manifest(is);
mfMainClass = manifest.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS);
if ("".equals(mfMainClass)) {
mfMainClass = null;
}
} finally {
if (is != null) {
try {
is.close();
} catch (IOException io) {
/* do nothing */
}
}
}
}
if (mfMainClass == null && required) {
Tr.error(_tc, "error.module.manifest.read.no.mainclass", getName(), entryPath);
}
} catch (IOException ioe) {
Tr.error(_tc, "error.module.manifest.read.failed", getName(), entryPath, ioe);
} catch (UnableToAdaptException uae) {
Tr.error(_tc, "error.module.manifest.read.failed", getName(), entryPath, uae);
}
return mfMainClass;
} | [
"protected",
"String",
"getMFMainClass",
"(",
"Container",
"appEntryContainer",
",",
"String",
"entryPath",
",",
"boolean",
"required",
")",
"{",
"String",
"mfMainClass",
"=",
"null",
";",
"try",
"{",
"String",
"entry",
"=",
"\"/META-INF/MANIFEST.MF\"",
";",
"Entry",
"manifestEntry",
"=",
"appEntryContainer",
".",
"getEntry",
"(",
"entry",
")",
";",
"if",
"(",
"manifestEntry",
"!=",
"null",
")",
"{",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"manifestEntry",
".",
"adapt",
"(",
"InputStream",
".",
"class",
")",
";",
"// \"is\" is null when MANIFEST.MF is a directory",
"if",
"(",
"is",
"==",
"null",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"entry",
")",
";",
"}",
"Manifest",
"manifest",
"=",
"new",
"Manifest",
"(",
"is",
")",
";",
"mfMainClass",
"=",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"getValue",
"(",
"Attributes",
".",
"Name",
".",
"MAIN_CLASS",
")",
";",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"mfMainClass",
")",
")",
"{",
"mfMainClass",
"=",
"null",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"is",
"!=",
"null",
")",
"{",
"try",
"{",
"is",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"io",
")",
"{",
"/* do nothing */",
"}",
"}",
"}",
"}",
"if",
"(",
"mfMainClass",
"==",
"null",
"&&",
"required",
")",
"{",
"Tr",
".",
"error",
"(",
"_tc",
",",
"\"error.module.manifest.read.no.mainclass\"",
",",
"getName",
"(",
")",
",",
"entryPath",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"Tr",
".",
"error",
"(",
"_tc",
",",
"\"error.module.manifest.read.failed\"",
",",
"getName",
"(",
")",
",",
"entryPath",
",",
"ioe",
")",
";",
"}",
"catch",
"(",
"UnableToAdaptException",
"uae",
")",
"{",
"Tr",
".",
"error",
"(",
"_tc",
",",
"\"error.module.manifest.read.failed\"",
",",
"getName",
"(",
")",
",",
"entryPath",
",",
"uae",
")",
";",
"}",
"return",
"mfMainClass",
";",
"}"
] | Return the Main-Class from the MANIFEST.MF.
@param appEntryContainer The root container.
@param entryPath The path of the mainfest file.
@param required true if current module is known to be a client module, and false otherwise
@return The main class or null depending on the boolean value 'required'. | [
"Return",
"the",
"Main",
"-",
"Class",
"from",
"the",
"MANIFEST",
".",
"MF",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.war/src/com/ibm/ws/app/manager/ear/internal/EARDeployedAppInfo.java#L693-L730 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/data/SpdGroupBase.java | SpdGroupBase.insert | protected int insert(SpdData elt) {
if (members.isEmpty()) {
members.add(elt);
return 0;
}
int first = 0;
SpdData firstElt = (SpdData) members.get(first);
int last = members.size() - 1;
SpdData lastElt = (SpdData) members.get(last);
if (elt.compareTo(firstElt) < 0) {
members.add(first, elt);
return first;
} else if (elt.compareTo(lastElt) > 0) {
members.add(last + 1, elt);
return last + 1;
}
while (last > (first + 1)) {
int middle = (first + last) / 2;
SpdData midElt = (SpdData) members.get(middle);
if (midElt.compareTo(elt) > 0) {
last = middle;
lastElt = midElt;
} else {
first = middle;
firstElt = midElt;
}
}
if ((elt.compareTo(firstElt) == 0) ||
(elt.compareTo(lastElt) == 0)) {
return -1;
} else {
members.add(last, elt);
return last;
}
} | java | protected int insert(SpdData elt) {
if (members.isEmpty()) {
members.add(elt);
return 0;
}
int first = 0;
SpdData firstElt = (SpdData) members.get(first);
int last = members.size() - 1;
SpdData lastElt = (SpdData) members.get(last);
if (elt.compareTo(firstElt) < 0) {
members.add(first, elt);
return first;
} else if (elt.compareTo(lastElt) > 0) {
members.add(last + 1, elt);
return last + 1;
}
while (last > (first + 1)) {
int middle = (first + last) / 2;
SpdData midElt = (SpdData) members.get(middle);
if (midElt.compareTo(elt) > 0) {
last = middle;
lastElt = midElt;
} else {
first = middle;
firstElt = midElt;
}
}
if ((elt.compareTo(firstElt) == 0) ||
(elt.compareTo(lastElt) == 0)) {
return -1;
} else {
members.add(last, elt);
return last;
}
} | [
"protected",
"int",
"insert",
"(",
"SpdData",
"elt",
")",
"{",
"if",
"(",
"members",
".",
"isEmpty",
"(",
")",
")",
"{",
"members",
".",
"add",
"(",
"elt",
")",
";",
"return",
"0",
";",
"}",
"int",
"first",
"=",
"0",
";",
"SpdData",
"firstElt",
"=",
"(",
"SpdData",
")",
"members",
".",
"get",
"(",
"first",
")",
";",
"int",
"last",
"=",
"members",
".",
"size",
"(",
")",
"-",
"1",
";",
"SpdData",
"lastElt",
"=",
"(",
"SpdData",
")",
"members",
".",
"get",
"(",
"last",
")",
";",
"if",
"(",
"elt",
".",
"compareTo",
"(",
"firstElt",
")",
"<",
"0",
")",
"{",
"members",
".",
"add",
"(",
"first",
",",
"elt",
")",
";",
"return",
"first",
";",
"}",
"else",
"if",
"(",
"elt",
".",
"compareTo",
"(",
"lastElt",
")",
">",
"0",
")",
"{",
"members",
".",
"add",
"(",
"last",
"+",
"1",
",",
"elt",
")",
";",
"return",
"last",
"+",
"1",
";",
"}",
"while",
"(",
"last",
">",
"(",
"first",
"+",
"1",
")",
")",
"{",
"int",
"middle",
"=",
"(",
"first",
"+",
"last",
")",
"/",
"2",
";",
"SpdData",
"midElt",
"=",
"(",
"SpdData",
")",
"members",
".",
"get",
"(",
"middle",
")",
";",
"if",
"(",
"midElt",
".",
"compareTo",
"(",
"elt",
")",
">",
"0",
")",
"{",
"last",
"=",
"middle",
";",
"lastElt",
"=",
"midElt",
";",
"}",
"else",
"{",
"first",
"=",
"middle",
";",
"firstElt",
"=",
"midElt",
";",
"}",
"}",
"if",
"(",
"(",
"elt",
".",
"compareTo",
"(",
"firstElt",
")",
"==",
"0",
")",
"||",
"(",
"elt",
".",
"compareTo",
"(",
"lastElt",
")",
"==",
"0",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"else",
"{",
"members",
".",
"add",
"(",
"last",
",",
"elt",
")",
";",
"return",
"last",
";",
"}",
"}"
] | Insert the element into the members vector in sorted
lexicographical order | [
"Insert",
"the",
"element",
"into",
"the",
"members",
"vector",
"in",
"sorted",
"lexicographical",
"order"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/data/SpdGroupBase.java#L35-L72 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/data/SpdGroupBase.java | SpdGroupBase.addSorted | public synchronized boolean addSorted(SpdData data) {
if (data == null) {
return false;
} else if (members.contains(data)) {
return false;
} else {
return (insert(data) != -1);
}
} | java | public synchronized boolean addSorted(SpdData data) {
if (data == null) {
return false;
} else if (members.contains(data)) {
return false;
} else {
return (insert(data) != -1);
}
} | [
"public",
"synchronized",
"boolean",
"addSorted",
"(",
"SpdData",
"data",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"members",
".",
"contains",
"(",
"data",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"(",
"insert",
"(",
"data",
")",
"!=",
"-",
"1",
")",
";",
"}",
"}"
] | add a data in a sorted order | [
"add",
"a",
"data",
"in",
"a",
"sorted",
"order"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/data/SpdGroupBase.java#L77-L85 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/data/SpdGroupBase.java | SpdGroupBase.add | public synchronized boolean add(SpdData data) {
if (data == null) {
return false;
} else if (members.contains(data)) {
return false;
} else {
return members.add(data);
}
} | java | public synchronized boolean add(SpdData data) {
if (data == null) {
return false;
} else if (members.contains(data)) {
return false;
} else {
return members.add(data);
}
} | [
"public",
"synchronized",
"boolean",
"add",
"(",
"SpdData",
"data",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"members",
".",
"contains",
"(",
"data",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"members",
".",
"add",
"(",
"data",
")",
";",
"}",
"}"
] | append a data to the members list - not sorted | [
"append",
"a",
"data",
"to",
"the",
"members",
"list",
"-",
"not",
"sorted"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/data/SpdGroupBase.java#L90-L98 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/cmdline/ClasspathAction.java | ClasspathAction.collectFeatureInfos | private void collectFeatureInfos(Map<String, ProductInfo> productInfos,
Map<String, FeatureInfo> featuresBySymbolicName) {
ManifestFileProcessor manifestFileProcessor = new ManifestFileProcessor();
for (Map.Entry<String, Map<String, ProvisioningFeatureDefinition>> productEntry : manifestFileProcessor.getFeatureDefinitionsByProduct().entrySet()) {
String productName = productEntry.getKey();
Map<String, ProvisioningFeatureDefinition> features = productEntry.getValue();
ContentBasedLocalBundleRepository repository;
if (productName.equals(ManifestFileProcessor.CORE_PRODUCT_NAME)) {
repository = BundleRepositoryRegistry.getInstallBundleRepository();
} else if (productName.equals(ManifestFileProcessor.USR_PRODUCT_EXT_NAME)) {
repository = BundleRepositoryRegistry.getUsrInstallBundleRepository();
} else {
repository = manifestFileProcessor.getBundleRepository(productName, null);
}
ProductInfo productInfo = new ProductInfo(repository);
productInfos.put(productName, productInfo);
for (Map.Entry<String, ProvisioningFeatureDefinition> featureEntry : features.entrySet()) {
String featureSymbolicName = featureEntry.getKey();
ProvisioningFeatureDefinition feature = featureEntry.getValue();
FeatureInfo featureInfo = new FeatureInfo(productInfo, feature);
featuresBySymbolicName.put(featureSymbolicName, featureInfo);
String shortName = feature.getIbmShortName();
if (shortName != null) {
productInfo.featuresByShortName.put(shortName, featureInfo);
}
}
}
} | java | private void collectFeatureInfos(Map<String, ProductInfo> productInfos,
Map<String, FeatureInfo> featuresBySymbolicName) {
ManifestFileProcessor manifestFileProcessor = new ManifestFileProcessor();
for (Map.Entry<String, Map<String, ProvisioningFeatureDefinition>> productEntry : manifestFileProcessor.getFeatureDefinitionsByProduct().entrySet()) {
String productName = productEntry.getKey();
Map<String, ProvisioningFeatureDefinition> features = productEntry.getValue();
ContentBasedLocalBundleRepository repository;
if (productName.equals(ManifestFileProcessor.CORE_PRODUCT_NAME)) {
repository = BundleRepositoryRegistry.getInstallBundleRepository();
} else if (productName.equals(ManifestFileProcessor.USR_PRODUCT_EXT_NAME)) {
repository = BundleRepositoryRegistry.getUsrInstallBundleRepository();
} else {
repository = manifestFileProcessor.getBundleRepository(productName, null);
}
ProductInfo productInfo = new ProductInfo(repository);
productInfos.put(productName, productInfo);
for (Map.Entry<String, ProvisioningFeatureDefinition> featureEntry : features.entrySet()) {
String featureSymbolicName = featureEntry.getKey();
ProvisioningFeatureDefinition feature = featureEntry.getValue();
FeatureInfo featureInfo = new FeatureInfo(productInfo, feature);
featuresBySymbolicName.put(featureSymbolicName, featureInfo);
String shortName = feature.getIbmShortName();
if (shortName != null) {
productInfo.featuresByShortName.put(shortName, featureInfo);
}
}
}
} | [
"private",
"void",
"collectFeatureInfos",
"(",
"Map",
"<",
"String",
",",
"ProductInfo",
">",
"productInfos",
",",
"Map",
"<",
"String",
",",
"FeatureInfo",
">",
"featuresBySymbolicName",
")",
"{",
"ManifestFileProcessor",
"manifestFileProcessor",
"=",
"new",
"ManifestFileProcessor",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"ProvisioningFeatureDefinition",
">",
">",
"productEntry",
":",
"manifestFileProcessor",
".",
"getFeatureDefinitionsByProduct",
"(",
")",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"productName",
"=",
"productEntry",
".",
"getKey",
"(",
")",
";",
"Map",
"<",
"String",
",",
"ProvisioningFeatureDefinition",
">",
"features",
"=",
"productEntry",
".",
"getValue",
"(",
")",
";",
"ContentBasedLocalBundleRepository",
"repository",
";",
"if",
"(",
"productName",
".",
"equals",
"(",
"ManifestFileProcessor",
".",
"CORE_PRODUCT_NAME",
")",
")",
"{",
"repository",
"=",
"BundleRepositoryRegistry",
".",
"getInstallBundleRepository",
"(",
")",
";",
"}",
"else",
"if",
"(",
"productName",
".",
"equals",
"(",
"ManifestFileProcessor",
".",
"USR_PRODUCT_EXT_NAME",
")",
")",
"{",
"repository",
"=",
"BundleRepositoryRegistry",
".",
"getUsrInstallBundleRepository",
"(",
")",
";",
"}",
"else",
"{",
"repository",
"=",
"manifestFileProcessor",
".",
"getBundleRepository",
"(",
"productName",
",",
"null",
")",
";",
"}",
"ProductInfo",
"productInfo",
"=",
"new",
"ProductInfo",
"(",
"repository",
")",
";",
"productInfos",
".",
"put",
"(",
"productName",
",",
"productInfo",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"ProvisioningFeatureDefinition",
">",
"featureEntry",
":",
"features",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"featureSymbolicName",
"=",
"featureEntry",
".",
"getKey",
"(",
")",
";",
"ProvisioningFeatureDefinition",
"feature",
"=",
"featureEntry",
".",
"getValue",
"(",
")",
";",
"FeatureInfo",
"featureInfo",
"=",
"new",
"FeatureInfo",
"(",
"productInfo",
",",
"feature",
")",
";",
"featuresBySymbolicName",
".",
"put",
"(",
"featureSymbolicName",
",",
"featureInfo",
")",
";",
"String",
"shortName",
"=",
"feature",
".",
"getIbmShortName",
"(",
")",
";",
"if",
"(",
"shortName",
"!=",
"null",
")",
"{",
"productInfo",
".",
"featuresByShortName",
".",
"put",
"(",
"shortName",
",",
"featureInfo",
")",
";",
"}",
"}",
"}",
"}"
] | Collect information about all installed products and their features.
@param productInfos result parameter of product name (prefix) to info
@param featuresBySymbolicName result parameter of symbolic name to info | [
"Collect",
"information",
"about",
"all",
"installed",
"products",
"and",
"their",
"features",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/cmdline/ClasspathAction.java#L163-L195 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/cmdline/ClasspathAction.java | ClasspathAction.getFeatureInfo | private FeatureInfo getFeatureInfo(String name,
Map<String, ProductInfo> productInfos,
Map<String, FeatureInfo> featuresBySymbolicName) {
String productName, featureName;
int index = name.indexOf(':');
if (index == -1) {
FeatureInfo featureInfo = featuresBySymbolicName.get(name);
if (featureInfo != null) {
return featureInfo;
}
productName = ManifestFileProcessor.CORE_PRODUCT_NAME;
featureName = name;
} else {
productName = name.substring(0, index);
featureName = name.substring(index + 1);
}
ProductInfo product = productInfos.get(productName);
return product == null ? null : product.featuresByShortName.get(featureName);
} | java | private FeatureInfo getFeatureInfo(String name,
Map<String, ProductInfo> productInfos,
Map<String, FeatureInfo> featuresBySymbolicName) {
String productName, featureName;
int index = name.indexOf(':');
if (index == -1) {
FeatureInfo featureInfo = featuresBySymbolicName.get(name);
if (featureInfo != null) {
return featureInfo;
}
productName = ManifestFileProcessor.CORE_PRODUCT_NAME;
featureName = name;
} else {
productName = name.substring(0, index);
featureName = name.substring(index + 1);
}
ProductInfo product = productInfos.get(productName);
return product == null ? null : product.featuresByShortName.get(featureName);
} | [
"private",
"FeatureInfo",
"getFeatureInfo",
"(",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"ProductInfo",
">",
"productInfos",
",",
"Map",
"<",
"String",
",",
"FeatureInfo",
">",
"featuresBySymbolicName",
")",
"{",
"String",
"productName",
",",
"featureName",
";",
"int",
"index",
"=",
"name",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"FeatureInfo",
"featureInfo",
"=",
"featuresBySymbolicName",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"featureInfo",
"!=",
"null",
")",
"{",
"return",
"featureInfo",
";",
"}",
"productName",
"=",
"ManifestFileProcessor",
".",
"CORE_PRODUCT_NAME",
";",
"featureName",
"=",
"name",
";",
"}",
"else",
"{",
"productName",
"=",
"name",
".",
"substring",
"(",
"0",
",",
"index",
")",
";",
"featureName",
"=",
"name",
".",
"substring",
"(",
"index",
"+",
"1",
")",
";",
"}",
"ProductInfo",
"product",
"=",
"productInfos",
".",
"get",
"(",
"productName",
")",
";",
"return",
"product",
"==",
"null",
"?",
"null",
":",
"product",
".",
"featuresByShortName",
".",
"get",
"(",
"featureName",
")",
";",
"}"
] | Gets a feature by its name using the server.xml featureManager algorithm.
@param name the user-specified feature name
@param productInfos product name (prefix) to info
@param featuresBySymbolicName symbolic name to info
@return | [
"Gets",
"a",
"feature",
"by",
"its",
"name",
"using",
"the",
"server",
".",
"xml",
"featureManager",
"algorithm",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/cmdline/ClasspathAction.java#L205-L225 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/cmdline/ClasspathAction.java | ClasspathAction.collectAPIJars | private void collectAPIJars(FeatureInfo featureInfo,
Map<String, FeatureInfo> allowedFeatures,
Set<File> apiJars) {
for (SubsystemContentType contentType : JAR_CONTENT_TYPES) {
for (FeatureResource resource : featureInfo.feature.getConstituents(contentType)) {
if (APIType.getAPIType(resource) == APIType.API) {
File file = featureInfo.productInfo.repository.selectBundle(resource.getLocation(), resource.getSymbolicName(), resource.getVersionRange());
if (file != null) {
apiJars.add(file);
}
}
}
}
for (FeatureResource resource : featureInfo.feature.getConstituents(SubsystemContentType.FEATURE_TYPE)) {
String name = resource.getSymbolicName();
FeatureInfo childFeatureInfo = allowedFeatures.get(name);
if (childFeatureInfo != null && APIType.API.matches(resource)) {
allowedFeatures.remove(name);
collectAPIJars(childFeatureInfo, allowedFeatures, apiJars);
}
}
} | java | private void collectAPIJars(FeatureInfo featureInfo,
Map<String, FeatureInfo> allowedFeatures,
Set<File> apiJars) {
for (SubsystemContentType contentType : JAR_CONTENT_TYPES) {
for (FeatureResource resource : featureInfo.feature.getConstituents(contentType)) {
if (APIType.getAPIType(resource) == APIType.API) {
File file = featureInfo.productInfo.repository.selectBundle(resource.getLocation(), resource.getSymbolicName(), resource.getVersionRange());
if (file != null) {
apiJars.add(file);
}
}
}
}
for (FeatureResource resource : featureInfo.feature.getConstituents(SubsystemContentType.FEATURE_TYPE)) {
String name = resource.getSymbolicName();
FeatureInfo childFeatureInfo = allowedFeatures.get(name);
if (childFeatureInfo != null && APIType.API.matches(resource)) {
allowedFeatures.remove(name);
collectAPIJars(childFeatureInfo, allowedFeatures, apiJars);
}
}
} | [
"private",
"void",
"collectAPIJars",
"(",
"FeatureInfo",
"featureInfo",
",",
"Map",
"<",
"String",
",",
"FeatureInfo",
">",
"allowedFeatures",
",",
"Set",
"<",
"File",
">",
"apiJars",
")",
"{",
"for",
"(",
"SubsystemContentType",
"contentType",
":",
"JAR_CONTENT_TYPES",
")",
"{",
"for",
"(",
"FeatureResource",
"resource",
":",
"featureInfo",
".",
"feature",
".",
"getConstituents",
"(",
"contentType",
")",
")",
"{",
"if",
"(",
"APIType",
".",
"getAPIType",
"(",
"resource",
")",
"==",
"APIType",
".",
"API",
")",
"{",
"File",
"file",
"=",
"featureInfo",
".",
"productInfo",
".",
"repository",
".",
"selectBundle",
"(",
"resource",
".",
"getLocation",
"(",
")",
",",
"resource",
".",
"getSymbolicName",
"(",
")",
",",
"resource",
".",
"getVersionRange",
"(",
")",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"apiJars",
".",
"add",
"(",
"file",
")",
";",
"}",
"}",
"}",
"}",
"for",
"(",
"FeatureResource",
"resource",
":",
"featureInfo",
".",
"feature",
".",
"getConstituents",
"(",
"SubsystemContentType",
".",
"FEATURE_TYPE",
")",
")",
"{",
"String",
"name",
"=",
"resource",
".",
"getSymbolicName",
"(",
")",
";",
"FeatureInfo",
"childFeatureInfo",
"=",
"allowedFeatures",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"childFeatureInfo",
"!=",
"null",
"&&",
"APIType",
".",
"API",
".",
"matches",
"(",
"resource",
")",
")",
"{",
"allowedFeatures",
".",
"remove",
"(",
"name",
")",
";",
"collectAPIJars",
"(",
"childFeatureInfo",
",",
"allowedFeatures",
",",
"apiJars",
")",
";",
"}",
"}",
"}"
] | Collect API JARs from a feature and its recursive dependencies.
@param featureInfo the feature to process
@param visitedFeaturesBySymbolicName result set of visited features
@param apiJars result set of API JAR files
@param featuresBySymbolicName symbolic name to info | [
"Collect",
"API",
"JARs",
"from",
"a",
"feature",
"and",
"its",
"recursive",
"dependencies",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/cmdline/ClasspathAction.java#L240-L262 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/cmdline/ClasspathAction.java | ClasspathAction.createClasspathJar | private void createClasspathJar(File outputFile, String classpath) throws IOException {
FileOutputStream out = new FileOutputStream(outputFile);
try {
Manifest manifest = new Manifest();
Attributes attrs = manifest.getMainAttributes();
attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0");
attrs.put(Attributes.Name.CLASS_PATH, classpath);
new JarOutputStream(out, manifest).close();
} finally {
out.close();
}
} | java | private void createClasspathJar(File outputFile, String classpath) throws IOException {
FileOutputStream out = new FileOutputStream(outputFile);
try {
Manifest manifest = new Manifest();
Attributes attrs = manifest.getMainAttributes();
attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0");
attrs.put(Attributes.Name.CLASS_PATH, classpath);
new JarOutputStream(out, manifest).close();
} finally {
out.close();
}
} | [
"private",
"void",
"createClasspathJar",
"(",
"File",
"outputFile",
",",
"String",
"classpath",
")",
"throws",
"IOException",
"{",
"FileOutputStream",
"out",
"=",
"new",
"FileOutputStream",
"(",
"outputFile",
")",
";",
"try",
"{",
"Manifest",
"manifest",
"=",
"new",
"Manifest",
"(",
")",
";",
"Attributes",
"attrs",
"=",
"manifest",
".",
"getMainAttributes",
"(",
")",
";",
"attrs",
".",
"put",
"(",
"Attributes",
".",
"Name",
".",
"MANIFEST_VERSION",
",",
"\"1.0\"",
")",
";",
"attrs",
".",
"put",
"(",
"Attributes",
".",
"Name",
".",
"CLASS_PATH",
",",
"classpath",
")",
";",
"new",
"JarOutputStream",
"(",
"out",
",",
"manifest",
")",
".",
"close",
"(",
")",
";",
"}",
"finally",
"{",
"out",
".",
"close",
"(",
")",
";",
"}",
"}"
] | Writes a JAR with a MANIFEST.MF containing the Class-Path string.
@param outputFile the output file to create
@param classpath the Class-Path string
@throws IOException if an error occurs creating the file | [
"Writes",
"a",
"JAR",
"with",
"a",
"MANIFEST",
".",
"MF",
"containing",
"the",
"Class",
"-",
"Path",
"string",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/cmdline/ClasspathAction.java#L322-L333 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/InboundChain.java | InboundChain.setupDiscProcess | public void setupDiscProcess() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "setupDiscProcess");
}
ChannelData list[] = chainData.getChannelList();
Class<?> discriminatoryType = null;
DiscriminationProcessImpl dp = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Get the channels started");
}
// Set up discrimination process for framework and start the channels.
for (int i = 0; i < list.length; i++) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Set up disc process for channel, " + list[i].getName());
}
// Don't set up a disc process for the last channel in the chain.
if (list.length != i + 1) {
dp = (DiscriminationProcessImpl) ((InboundChannel) channels[i]).getDiscriminationProcess();
if (dp == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Create a discrimination process for channel, "
+ channels[i].getName());
}
// Create a discrimination process for the framework
discriminatoryType = ((InboundChannel) channels[i]).getDiscriminatoryType();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Discriminatory type: " + discriminatoryType);
}
dp = new DiscriminationProcessImpl(discriminatoryType, list[i].getName());
((InboundChannel) channels[i]).setDiscriminationProcess(dp);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found DP: " + dp);
}
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Last channel in chain, " + list[i].getName());
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "setupDiscProcess");
}
} | java | public void setupDiscProcess() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "setupDiscProcess");
}
ChannelData list[] = chainData.getChannelList();
Class<?> discriminatoryType = null;
DiscriminationProcessImpl dp = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Get the channels started");
}
// Set up discrimination process for framework and start the channels.
for (int i = 0; i < list.length; i++) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Set up disc process for channel, " + list[i].getName());
}
// Don't set up a disc process for the last channel in the chain.
if (list.length != i + 1) {
dp = (DiscriminationProcessImpl) ((InboundChannel) channels[i]).getDiscriminationProcess();
if (dp == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Create a discrimination process for channel, "
+ channels[i].getName());
}
// Create a discrimination process for the framework
discriminatoryType = ((InboundChannel) channels[i]).getDiscriminatoryType();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Discriminatory type: " + discriminatoryType);
}
dp = new DiscriminationProcessImpl(discriminatoryType, list[i].getName());
((InboundChannel) channels[i]).setDiscriminationProcess(dp);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found DP: " + dp);
}
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Last channel in chain, " + list[i].getName());
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "setupDiscProcess");
}
} | [
"public",
"void",
"setupDiscProcess",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"setupDiscProcess\"",
")",
";",
"}",
"ChannelData",
"list",
"[",
"]",
"=",
"chainData",
".",
"getChannelList",
"(",
")",
";",
"Class",
"<",
"?",
">",
"discriminatoryType",
"=",
"null",
";",
"DiscriminationProcessImpl",
"dp",
"=",
"null",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Get the channels started\"",
")",
";",
"}",
"// Set up discrimination process for framework and start the channels.",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Set up disc process for channel, \"",
"+",
"list",
"[",
"i",
"]",
".",
"getName",
"(",
")",
")",
";",
"}",
"// Don't set up a disc process for the last channel in the chain.",
"if",
"(",
"list",
".",
"length",
"!=",
"i",
"+",
"1",
")",
"{",
"dp",
"=",
"(",
"DiscriminationProcessImpl",
")",
"(",
"(",
"InboundChannel",
")",
"channels",
"[",
"i",
"]",
")",
".",
"getDiscriminationProcess",
"(",
")",
";",
"if",
"(",
"dp",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Create a discrimination process for channel, \"",
"+",
"channels",
"[",
"i",
"]",
".",
"getName",
"(",
")",
")",
";",
"}",
"// Create a discrimination process for the framework",
"discriminatoryType",
"=",
"(",
"(",
"InboundChannel",
")",
"channels",
"[",
"i",
"]",
")",
".",
"getDiscriminatoryType",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Discriminatory type: \"",
"+",
"discriminatoryType",
")",
";",
"}",
"dp",
"=",
"new",
"DiscriminationProcessImpl",
"(",
"discriminatoryType",
",",
"list",
"[",
"i",
"]",
".",
"getName",
"(",
")",
")",
";",
"(",
"(",
"InboundChannel",
")",
"channels",
"[",
"i",
"]",
")",
".",
"setDiscriminationProcess",
"(",
"dp",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Found DP: \"",
"+",
"dp",
")",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Last channel in chain, \"",
"+",
"list",
"[",
"i",
"]",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"setupDiscProcess\"",
")",
";",
"}",
"}"
] | This method is called from the channel framework right before the start method is called.
In between, it starts up the channels in the chain. | [
"This",
"method",
"is",
"called",
"from",
"the",
"channel",
"framework",
"right",
"before",
"the",
"start",
"method",
"is",
"called",
".",
"In",
"between",
"it",
"starts",
"up",
"the",
"channels",
"in",
"the",
"chain",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/InboundChain.java#L157-L201 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/InboundChain.java | InboundChain.startDiscProcessBetweenChannels | public void startDiscProcessBetweenChannels(InboundChannel appChannel, InboundChannel devChannel,
int discWeight) throws ChainException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "startDiscProcessBetweenChannels");
}
// Get the discriminator for the app channel. Protect from misc exceptions being thrown.
Discriminator d = null;
Exception discException = null;
try {
d = appChannel.getDiscriminator();
if (d == null) {
discException = new Exception("Null discriminator extracted from channel " + appChannel.getName());
}
} catch (Exception e) {
// No FFDC needed. Done a couple lines down.
discException = e;
}
if (null != discException) {
// Even though rethrowing exception, must FFDC now to capture stack trace.
FFDCFilter.processException(discException,
getClass().getName() + ".startDiscProcessBetweenChannels",
"234", this, new Object[] { appChannel, devChannel, Integer.valueOf(discWeight) });
throw new ChainException(
"Unable to get discriminator from " + appChannel.getName(),
discException);
}
// Get the discrimination group from the former channel in the chain.
DiscriminationGroup prevDg = (DiscriminationGroup) devChannel.getDiscriminationProcess();
// Check to see if the disc group already includes the discriminator.
if (!((DiscriminationProcessImpl) prevDg).containsDiscriminator(d)) {
// Add this discriminator or create a new one?
if (!(prevDg.getDiscriminators().isEmpty())) {
// Add a new DiscriminationProcess to a started channel
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Create new dp for channel, " + devChannel.getName());
}
DiscriminationGroup newDg =
new DiscriminationProcessImpl(devChannel.getDiscriminatoryType(), prevDg);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Add in discriminator from channel, " + appChannel.getName());
}
newDg.addDiscriminator(d, discWeight);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Set dp into channel, " + devChannel.getName());
}
newDg.start();
devChannel.setDiscriminationProcess(newDg);
} else {
// Enable the previous channel in the chain to communication with this one.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc,
"Add in disc from channel, "
+ appChannel.getName()
+ " into dp of channel, "
+ devChannel.getName());
}
prevDg.addDiscriminator(d, discWeight);
prevDg.start();
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found discriminator in dp, " + appChannel.getName());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "startDiscProcessBetweenChannels");
}
} | java | public void startDiscProcessBetweenChannels(InboundChannel appChannel, InboundChannel devChannel,
int discWeight) throws ChainException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "startDiscProcessBetweenChannels");
}
// Get the discriminator for the app channel. Protect from misc exceptions being thrown.
Discriminator d = null;
Exception discException = null;
try {
d = appChannel.getDiscriminator();
if (d == null) {
discException = new Exception("Null discriminator extracted from channel " + appChannel.getName());
}
} catch (Exception e) {
// No FFDC needed. Done a couple lines down.
discException = e;
}
if (null != discException) {
// Even though rethrowing exception, must FFDC now to capture stack trace.
FFDCFilter.processException(discException,
getClass().getName() + ".startDiscProcessBetweenChannels",
"234", this, new Object[] { appChannel, devChannel, Integer.valueOf(discWeight) });
throw new ChainException(
"Unable to get discriminator from " + appChannel.getName(),
discException);
}
// Get the discrimination group from the former channel in the chain.
DiscriminationGroup prevDg = (DiscriminationGroup) devChannel.getDiscriminationProcess();
// Check to see if the disc group already includes the discriminator.
if (!((DiscriminationProcessImpl) prevDg).containsDiscriminator(d)) {
// Add this discriminator or create a new one?
if (!(prevDg.getDiscriminators().isEmpty())) {
// Add a new DiscriminationProcess to a started channel
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Create new dp for channel, " + devChannel.getName());
}
DiscriminationGroup newDg =
new DiscriminationProcessImpl(devChannel.getDiscriminatoryType(), prevDg);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Add in discriminator from channel, " + appChannel.getName());
}
newDg.addDiscriminator(d, discWeight);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Set dp into channel, " + devChannel.getName());
}
newDg.start();
devChannel.setDiscriminationProcess(newDg);
} else {
// Enable the previous channel in the chain to communication with this one.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc,
"Add in disc from channel, "
+ appChannel.getName()
+ " into dp of channel, "
+ devChannel.getName());
}
prevDg.addDiscriminator(d, discWeight);
prevDg.start();
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found discriminator in dp, " + appChannel.getName());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "startDiscProcessBetweenChannels");
}
} | [
"public",
"void",
"startDiscProcessBetweenChannels",
"(",
"InboundChannel",
"appChannel",
",",
"InboundChannel",
"devChannel",
",",
"int",
"discWeight",
")",
"throws",
"ChainException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"startDiscProcessBetweenChannels\"",
")",
";",
"}",
"// Get the discriminator for the app channel. Protect from misc exceptions being thrown.",
"Discriminator",
"d",
"=",
"null",
";",
"Exception",
"discException",
"=",
"null",
";",
"try",
"{",
"d",
"=",
"appChannel",
".",
"getDiscriminator",
"(",
")",
";",
"if",
"(",
"d",
"==",
"null",
")",
"{",
"discException",
"=",
"new",
"Exception",
"(",
"\"Null discriminator extracted from channel \"",
"+",
"appChannel",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// No FFDC needed. Done a couple lines down.",
"discException",
"=",
"e",
";",
"}",
"if",
"(",
"null",
"!=",
"discException",
")",
"{",
"// Even though rethrowing exception, must FFDC now to capture stack trace.",
"FFDCFilter",
".",
"processException",
"(",
"discException",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\".startDiscProcessBetweenChannels\"",
",",
"\"234\"",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"appChannel",
",",
"devChannel",
",",
"Integer",
".",
"valueOf",
"(",
"discWeight",
")",
"}",
")",
";",
"throw",
"new",
"ChainException",
"(",
"\"Unable to get discriminator from \"",
"+",
"appChannel",
".",
"getName",
"(",
")",
",",
"discException",
")",
";",
"}",
"// Get the discrimination group from the former channel in the chain.",
"DiscriminationGroup",
"prevDg",
"=",
"(",
"DiscriminationGroup",
")",
"devChannel",
".",
"getDiscriminationProcess",
"(",
")",
";",
"// Check to see if the disc group already includes the discriminator.",
"if",
"(",
"!",
"(",
"(",
"DiscriminationProcessImpl",
")",
"prevDg",
")",
".",
"containsDiscriminator",
"(",
"d",
")",
")",
"{",
"// Add this discriminator or create a new one?",
"if",
"(",
"!",
"(",
"prevDg",
".",
"getDiscriminators",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
")",
"{",
"// Add a new DiscriminationProcess to a started channel",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Create new dp for channel, \"",
"+",
"devChannel",
".",
"getName",
"(",
")",
")",
";",
"}",
"DiscriminationGroup",
"newDg",
"=",
"new",
"DiscriminationProcessImpl",
"(",
"devChannel",
".",
"getDiscriminatoryType",
"(",
")",
",",
"prevDg",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Add in discriminator from channel, \"",
"+",
"appChannel",
".",
"getName",
"(",
")",
")",
";",
"}",
"newDg",
".",
"addDiscriminator",
"(",
"d",
",",
"discWeight",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Set dp into channel, \"",
"+",
"devChannel",
".",
"getName",
"(",
")",
")",
";",
"}",
"newDg",
".",
"start",
"(",
")",
";",
"devChannel",
".",
"setDiscriminationProcess",
"(",
"newDg",
")",
";",
"}",
"else",
"{",
"// Enable the previous channel in the chain to communication with this one.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Add in disc from channel, \"",
"+",
"appChannel",
".",
"getName",
"(",
")",
"+",
"\" into dp of channel, \"",
"+",
"devChannel",
".",
"getName",
"(",
")",
")",
";",
"}",
"prevDg",
".",
"addDiscriminator",
"(",
"d",
",",
"discWeight",
")",
";",
"prevDg",
".",
"start",
"(",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Found discriminator in dp, \"",
"+",
"appChannel",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"startDiscProcessBetweenChannels\"",
")",
";",
"}",
"}"
] | This method is called from ChannelFrameworkImpl during chain startup to start up the discrimination
process between each set of adjacent channels in the chain.
@param appChannel the channel on the application side of the two provided
@param devChannel the channel on the device side of the two provided
@param discWeight
@throws ChainException in case an error occurs, potentially related to setting up discrimination. | [
"This",
"method",
"is",
"called",
"from",
"ChannelFrameworkImpl",
"during",
"chain",
"startup",
"to",
"start",
"up",
"the",
"discrimination",
"process",
"between",
"each",
"set",
"of",
"adjacent",
"channels",
"in",
"the",
"chain",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/InboundChain.java#L212-L280 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/InboundChain.java | InboundChain.disableChannel | public void disableChannel(Channel inputChannel)
throws InvalidChannelNameException, DiscriminationProcessException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "disableChannel: " + inputChannel.getName());
}
synchronized (state) {
if (RuntimeState.STARTED.equals(state) || RuntimeState.QUIESCED.equals(state)) {
String targetName = inputChannel.getName();
int index = 0;
InboundChannel prevChannel = null;
// Find the index of the input channel in this chain.
for (; index < channels.length; index++) {
if (channels[index].getName().equals(targetName)) {
break;
}
prevChannel = (InboundChannel) channels[index];
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Index of channel, " + index);
}
if (channels.length == index) {
// Never found the channel. Log an error.
InvalidChannelNameException e =
new InvalidChannelNameException(
"ERROR: can't unlink unknown channel, " + targetName);
FFDCFilter.processException(e, getClass().getName() + ".disableChannel",
"319", this, new Object[] { inputChannel });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "disableChannel");
}
throw e;
} else if (null != prevChannel) {
// Note: do nothing if the index was zero, meaning input channel is a connector.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Previous channel, " + prevChannel.getName());
}
// Discriminator was only added after the chain was started.
Class<?> discriminatoryType = prevChannel.getDiscriminatoryType();
DiscriminationProcessImpl newDp = new DiscriminationProcessImpl(
discriminatoryType,
(DiscriminationGroup) prevChannel.getDiscriminationProcess());
newDp.removeDiscriminator(((InboundChannel) inputChannel).getDiscriminator());
prevChannel.setDiscriminationProcess(newDp);
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "RuntimeState invalid to disable channel: "
+ inputChannel.getName() + ", chain state: " + state.ordinal);
}
}
} // End synchronize
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "disableChannel");
}
} | java | public void disableChannel(Channel inputChannel)
throws InvalidChannelNameException, DiscriminationProcessException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "disableChannel: " + inputChannel.getName());
}
synchronized (state) {
if (RuntimeState.STARTED.equals(state) || RuntimeState.QUIESCED.equals(state)) {
String targetName = inputChannel.getName();
int index = 0;
InboundChannel prevChannel = null;
// Find the index of the input channel in this chain.
for (; index < channels.length; index++) {
if (channels[index].getName().equals(targetName)) {
break;
}
prevChannel = (InboundChannel) channels[index];
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Index of channel, " + index);
}
if (channels.length == index) {
// Never found the channel. Log an error.
InvalidChannelNameException e =
new InvalidChannelNameException(
"ERROR: can't unlink unknown channel, " + targetName);
FFDCFilter.processException(e, getClass().getName() + ".disableChannel",
"319", this, new Object[] { inputChannel });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "disableChannel");
}
throw e;
} else if (null != prevChannel) {
// Note: do nothing if the index was zero, meaning input channel is a connector.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Previous channel, " + prevChannel.getName());
}
// Discriminator was only added after the chain was started.
Class<?> discriminatoryType = prevChannel.getDiscriminatoryType();
DiscriminationProcessImpl newDp = new DiscriminationProcessImpl(
discriminatoryType,
(DiscriminationGroup) prevChannel.getDiscriminationProcess());
newDp.removeDiscriminator(((InboundChannel) inputChannel).getDiscriminator());
prevChannel.setDiscriminationProcess(newDp);
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "RuntimeState invalid to disable channel: "
+ inputChannel.getName() + ", chain state: " + state.ordinal);
}
}
} // End synchronize
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "disableChannel");
}
} | [
"public",
"void",
"disableChannel",
"(",
"Channel",
"inputChannel",
")",
"throws",
"InvalidChannelNameException",
",",
"DiscriminationProcessException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"disableChannel: \"",
"+",
"inputChannel",
".",
"getName",
"(",
")",
")",
";",
"}",
"synchronized",
"(",
"state",
")",
"{",
"if",
"(",
"RuntimeState",
".",
"STARTED",
".",
"equals",
"(",
"state",
")",
"||",
"RuntimeState",
".",
"QUIESCED",
".",
"equals",
"(",
"state",
")",
")",
"{",
"String",
"targetName",
"=",
"inputChannel",
".",
"getName",
"(",
")",
";",
"int",
"index",
"=",
"0",
";",
"InboundChannel",
"prevChannel",
"=",
"null",
";",
"// Find the index of the input channel in this chain.",
"for",
"(",
";",
"index",
"<",
"channels",
".",
"length",
";",
"index",
"++",
")",
"{",
"if",
"(",
"channels",
"[",
"index",
"]",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"targetName",
")",
")",
"{",
"break",
";",
"}",
"prevChannel",
"=",
"(",
"InboundChannel",
")",
"channels",
"[",
"index",
"]",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Index of channel, \"",
"+",
"index",
")",
";",
"}",
"if",
"(",
"channels",
".",
"length",
"==",
"index",
")",
"{",
"// Never found the channel. Log an error.",
"InvalidChannelNameException",
"e",
"=",
"new",
"InvalidChannelNameException",
"(",
"\"ERROR: can't unlink unknown channel, \"",
"+",
"targetName",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\".disableChannel\"",
",",
"\"319\"",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"inputChannel",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"disableChannel\"",
")",
";",
"}",
"throw",
"e",
";",
"}",
"else",
"if",
"(",
"null",
"!=",
"prevChannel",
")",
"{",
"// Note: do nothing if the index was zero, meaning input channel is a connector.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Previous channel, \"",
"+",
"prevChannel",
".",
"getName",
"(",
")",
")",
";",
"}",
"// Discriminator was only added after the chain was started.",
"Class",
"<",
"?",
">",
"discriminatoryType",
"=",
"prevChannel",
".",
"getDiscriminatoryType",
"(",
")",
";",
"DiscriminationProcessImpl",
"newDp",
"=",
"new",
"DiscriminationProcessImpl",
"(",
"discriminatoryType",
",",
"(",
"DiscriminationGroup",
")",
"prevChannel",
".",
"getDiscriminationProcess",
"(",
")",
")",
";",
"newDp",
".",
"removeDiscriminator",
"(",
"(",
"(",
"InboundChannel",
")",
"inputChannel",
")",
".",
"getDiscriminator",
"(",
")",
")",
";",
"prevChannel",
".",
"setDiscriminationProcess",
"(",
"newDp",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"RuntimeState invalid to disable channel: \"",
"+",
"inputChannel",
".",
"getName",
"(",
")",
"+",
"\", chain state: \"",
"+",
"state",
".",
"ordinal",
")",
";",
"}",
"}",
"}",
"// End synchronize",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"disableChannel\"",
")",
";",
"}",
"}"
] | Disable the input channel.
@param inputChannel
@throws InvalidChannelNameException
@throws DiscriminationProcessException | [
"Disable",
"the",
"input",
"channel",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/InboundChain.java#L289-L344 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java | GuaranteedTargetStream.writeSilence | @Override
public void writeSilence(MessageItem m)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeSilence", new Object[] { m });
JsMessage jsMsg = m.getMessage();
// There may be Completed ticks after the Value, if so then
// write these into the stream too
long stamp = jsMsg.getGuaranteedValueValueTick();
long ends = jsMsg.getGuaranteedValueEndTick();
if (ends < stamp)
ends = stamp;
TickRange tr =
new TickRange(
TickRange.Completed,
jsMsg.getGuaranteedValueStartTick(),
ends);
// Update the stream
writeSilenceInternal(tr, false);
/*
* PM71430.DEV : We have to send the ACK control message for the messages which are to be silenced.
* Otherwise, if for some reason, source side ME stops sending the ACKEXPECTED control messages,
* target ME will never send ACK for these messages. This will result into messages getting piled
* on the source ME and never get removed.
*
* ACK message is not sent for silence message. Instead, it is sent only after a gap of 50 (default)
* messages from the last ACKED message.
*
* If any consumers come up in between, this method is not
* called to write silence. In this case, ACK is always sent during batch commit call back.
*
* Please note this piece of code has been written to handle specific scenario when there are no
* local consumers on the target side for a long time which results in never acknowledging any of
* the ticks and the local completed prefix keeps moving ahead.
*/
long gapFromPreviousAck = ends - this._lastAckedTick;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "gap from the previous ack: " + gapFromPreviousAck + " lastAckedTick: " + this._lastAckedTick);
if (gapFromPreviousAck >= this.ACK_GAP_FOR_SILENCE_TICKS) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "sending the ACK message for the batch of silence message ", new Object[] { m });
sendAck();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeSilence");
} | java | @Override
public void writeSilence(MessageItem m)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeSilence", new Object[] { m });
JsMessage jsMsg = m.getMessage();
// There may be Completed ticks after the Value, if so then
// write these into the stream too
long stamp = jsMsg.getGuaranteedValueValueTick();
long ends = jsMsg.getGuaranteedValueEndTick();
if (ends < stamp)
ends = stamp;
TickRange tr =
new TickRange(
TickRange.Completed,
jsMsg.getGuaranteedValueStartTick(),
ends);
// Update the stream
writeSilenceInternal(tr, false);
/*
* PM71430.DEV : We have to send the ACK control message for the messages which are to be silenced.
* Otherwise, if for some reason, source side ME stops sending the ACKEXPECTED control messages,
* target ME will never send ACK for these messages. This will result into messages getting piled
* on the source ME and never get removed.
*
* ACK message is not sent for silence message. Instead, it is sent only after a gap of 50 (default)
* messages from the last ACKED message.
*
* If any consumers come up in between, this method is not
* called to write silence. In this case, ACK is always sent during batch commit call back.
*
* Please note this piece of code has been written to handle specific scenario when there are no
* local consumers on the target side for a long time which results in never acknowledging any of
* the ticks and the local completed prefix keeps moving ahead.
*/
long gapFromPreviousAck = ends - this._lastAckedTick;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "gap from the previous ack: " + gapFromPreviousAck + " lastAckedTick: " + this._lastAckedTick);
if (gapFromPreviousAck >= this.ACK_GAP_FOR_SILENCE_TICKS) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "sending the ACK message for the batch of silence message ", new Object[] { m });
sendAck();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeSilence");
} | [
"@",
"Override",
"public",
"void",
"writeSilence",
"(",
"MessageItem",
"m",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"writeSilence\"",
",",
"new",
"Object",
"[",
"]",
"{",
"m",
"}",
")",
";",
"JsMessage",
"jsMsg",
"=",
"m",
".",
"getMessage",
"(",
")",
";",
"// There may be Completed ticks after the Value, if so then",
"// write these into the stream too",
"long",
"stamp",
"=",
"jsMsg",
".",
"getGuaranteedValueValueTick",
"(",
")",
";",
"long",
"ends",
"=",
"jsMsg",
".",
"getGuaranteedValueEndTick",
"(",
")",
";",
"if",
"(",
"ends",
"<",
"stamp",
")",
"ends",
"=",
"stamp",
";",
"TickRange",
"tr",
"=",
"new",
"TickRange",
"(",
"TickRange",
".",
"Completed",
",",
"jsMsg",
".",
"getGuaranteedValueStartTick",
"(",
")",
",",
"ends",
")",
";",
"// Update the stream ",
"writeSilenceInternal",
"(",
"tr",
",",
"false",
")",
";",
"/*\n * PM71430.DEV : We have to send the ACK control message for the messages which are to be silenced.\n * Otherwise, if for some reason, source side ME stops sending the ACKEXPECTED control messages,\n * target ME will never send ACK for these messages. This will result into messages getting piled\n * on the source ME and never get removed.\n * \n * ACK message is not sent for silence message. Instead, it is sent only after a gap of 50 (default)\n * messages from the last ACKED message.\n * \n * If any consumers come up in between, this method is not\n * called to write silence. In this case, ACK is always sent during batch commit call back.\n * \n * Please note this piece of code has been written to handle specific scenario when there are no\n * local consumers on the target side for a long time which results in never acknowledging any of\n * the ticks and the local completed prefix keeps moving ahead.\n */",
"long",
"gapFromPreviousAck",
"=",
"ends",
"-",
"this",
".",
"_lastAckedTick",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"gap from the previous ack: \"",
"+",
"gapFromPreviousAck",
"+",
"\" lastAckedTick: \"",
"+",
"this",
".",
"_lastAckedTick",
")",
";",
"if",
"(",
"gapFromPreviousAck",
">=",
"this",
".",
"ACK_GAP_FOR_SILENCE_TICKS",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"sending the ACK message for the batch of silence message \"",
",",
"new",
"Object",
"[",
"]",
"{",
"m",
"}",
")",
";",
"sendAck",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"writeSilence\"",
")",
";",
"}"
] | This method uses a Value message to write Silence into the stream
because a message has been filtered out
@param m The value message
@exception Thrown from writeRange, handleNewGap
and checkForWindowAdvanceGaps | [
"This",
"method",
"uses",
"a",
"Value",
"message",
"to",
"write",
"Silence",
"into",
"the",
"stream",
"because",
"a",
"message",
"has",
"been",
"filtered",
"out"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java#L714-L772 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java | GuaranteedTargetStream.handleNewGap | private void handleNewGap(long startstamp, long endstamp)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"handleNewGap",
new Object[] { Long.valueOf(startstamp), Long.valueOf(endstamp) });
TickRange tr = new TickRange(TickRange.Requested, startstamp, endstamp);
oststream.writeRange(tr);
// SIB0115
// Update Health State due to detected gap
getControlAdapter().getHealthState().updateHealth(HealthStateListener.GAP_DETECTED_STATE,
HealthState.AMBER);
NRTExpiryHandle nexphandle = new NRTExpiryHandle(tr, this);
nexphandle.timer =
am.create(mp.getCustomProperties().getGapCuriosityThreshold(), nexphandle);
addAlarm(this, nexphandle);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "handleNewGap");
} | java | private void handleNewGap(long startstamp, long endstamp)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"handleNewGap",
new Object[] { Long.valueOf(startstamp), Long.valueOf(endstamp) });
TickRange tr = new TickRange(TickRange.Requested, startstamp, endstamp);
oststream.writeRange(tr);
// SIB0115
// Update Health State due to detected gap
getControlAdapter().getHealthState().updateHealth(HealthStateListener.GAP_DETECTED_STATE,
HealthState.AMBER);
NRTExpiryHandle nexphandle = new NRTExpiryHandle(tr, this);
nexphandle.timer =
am.create(mp.getCustomProperties().getGapCuriosityThreshold(), nexphandle);
addAlarm(this, nexphandle);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "handleNewGap");
} | [
"private",
"void",
"handleNewGap",
"(",
"long",
"startstamp",
",",
"long",
"endstamp",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"handleNewGap\"",
",",
"new",
"Object",
"[",
"]",
"{",
"Long",
".",
"valueOf",
"(",
"startstamp",
")",
",",
"Long",
".",
"valueOf",
"(",
"endstamp",
")",
"}",
")",
";",
"TickRange",
"tr",
"=",
"new",
"TickRange",
"(",
"TickRange",
".",
"Requested",
",",
"startstamp",
",",
"endstamp",
")",
";",
"oststream",
".",
"writeRange",
"(",
"tr",
")",
";",
"// SIB0115 ",
"// Update Health State due to detected gap",
"getControlAdapter",
"(",
")",
".",
"getHealthState",
"(",
")",
".",
"updateHealth",
"(",
"HealthStateListener",
".",
"GAP_DETECTED_STATE",
",",
"HealthState",
".",
"AMBER",
")",
";",
"NRTExpiryHandle",
"nexphandle",
"=",
"new",
"NRTExpiryHandle",
"(",
"tr",
",",
"this",
")",
";",
"nexphandle",
".",
"timer",
"=",
"am",
".",
"create",
"(",
"mp",
".",
"getCustomProperties",
"(",
")",
".",
"getGapCuriosityThreshold",
"(",
")",
",",
"nexphandle",
")",
";",
"addAlarm",
"(",
"this",
",",
"nexphandle",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"handleNewGap\"",
")",
";",
"}"
] | all methods calling this are already synchronized
@exception GDException thrown from the writeRange method | [
"all",
"methods",
"calling",
"this",
"are",
"already",
"synchronized"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java#L1285-L1309 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java | GuaranteedTargetStream.addAlarm | protected static void addAlarm(Object key, Object alarmObject)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addAlarm", new Object[] { key, alarmObject });
synchronized (pendingAlarms)
{
Set alarms = null;
if (pendingAlarms.containsKey(key))
alarms = (Set) pendingAlarms.get(key);
else
{
alarms = new HashSet();
pendingAlarms.put(key, alarms);
}
alarms.add(alarmObject);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addAlarm");
} | java | protected static void addAlarm(Object key, Object alarmObject)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addAlarm", new Object[] { key, alarmObject });
synchronized (pendingAlarms)
{
Set alarms = null;
if (pendingAlarms.containsKey(key))
alarms = (Set) pendingAlarms.get(key);
else
{
alarms = new HashSet();
pendingAlarms.put(key, alarms);
}
alarms.add(alarmObject);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addAlarm");
} | [
"protected",
"static",
"void",
"addAlarm",
"(",
"Object",
"key",
",",
"Object",
"alarmObject",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"addAlarm\"",
",",
"new",
"Object",
"[",
"]",
"{",
"key",
",",
"alarmObject",
"}",
")",
";",
"synchronized",
"(",
"pendingAlarms",
")",
"{",
"Set",
"alarms",
"=",
"null",
";",
"if",
"(",
"pendingAlarms",
".",
"containsKey",
"(",
"key",
")",
")",
"alarms",
"=",
"(",
"Set",
")",
"pendingAlarms",
".",
"get",
"(",
"key",
")",
";",
"else",
"{",
"alarms",
"=",
"new",
"HashSet",
"(",
")",
";",
"pendingAlarms",
".",
"put",
"(",
"key",
",",
"alarms",
")",
";",
"}",
"alarms",
".",
"add",
"(",
"alarmObject",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"addAlarm\"",
")",
";",
"}"
] | Utility method for adding an alarm which needs to be expired if a
flush occurs.
@param key The key for the set of alarms to which this alarm
should be added. Normally this is a stream instance.
@param alarmObject The alarm object to add to the set. | [
"Utility",
"method",
"for",
"adding",
"an",
"alarm",
"which",
"needs",
"to",
"be",
"expired",
"if",
"a",
"flush",
"occurs",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java#L1811-L1831 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java | GuaranteedTargetStream.removeAlarm | protected static void removeAlarm(Object key, Object alarmObject)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeAlarm", new Object[] { key, alarmObject });
synchronized (pendingAlarms)
{
if (pendingAlarms.containsKey(key))
((Set) pendingAlarms.get(key)).remove(alarmObject);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeAlarm");
} | java | protected static void removeAlarm(Object key, Object alarmObject)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeAlarm", new Object[] { key, alarmObject });
synchronized (pendingAlarms)
{
if (pendingAlarms.containsKey(key))
((Set) pendingAlarms.get(key)).remove(alarmObject);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeAlarm");
} | [
"protected",
"static",
"void",
"removeAlarm",
"(",
"Object",
"key",
",",
"Object",
"alarmObject",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"removeAlarm\"",
",",
"new",
"Object",
"[",
"]",
"{",
"key",
",",
"alarmObject",
"}",
")",
";",
"synchronized",
"(",
"pendingAlarms",
")",
"{",
"if",
"(",
"pendingAlarms",
".",
"containsKey",
"(",
"key",
")",
")",
"(",
"(",
"Set",
")",
"pendingAlarms",
".",
"get",
"(",
"key",
")",
")",
".",
"remove",
"(",
"alarmObject",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"removeAlarm\"",
")",
";",
"}"
] | Utility method for removing an alarm from the alarm set. Has no
effect if either no alarms are associated with the given key, or
the given alarm object does not exist.
@param key The key for the set of alarms from which an alarm will
be removed. Normally this is a stream instance.
@param alarmObject The alarm object to remove. | [
"Utility",
"method",
"for",
"removing",
"an",
"alarm",
"from",
"the",
"alarm",
"set",
".",
"Has",
"no",
"effect",
"if",
"either",
"no",
"alarms",
"are",
"associated",
"with",
"the",
"given",
"key",
"or",
"the",
"given",
"alarm",
"object",
"does",
"not",
"exist",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java#L1842-L1855 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java | GuaranteedTargetStream.getAlarms | protected static Iterator getAlarms(Object key)
{
synchronized (pendingAlarms)
{
if (pendingAlarms.containsKey(key))
return ((Set) pendingAlarms.get(key)).iterator();
return new GTSIterator();
}
} | java | protected static Iterator getAlarms(Object key)
{
synchronized (pendingAlarms)
{
if (pendingAlarms.containsKey(key))
return ((Set) pendingAlarms.get(key)).iterator();
return new GTSIterator();
}
} | [
"protected",
"static",
"Iterator",
"getAlarms",
"(",
"Object",
"key",
")",
"{",
"synchronized",
"(",
"pendingAlarms",
")",
"{",
"if",
"(",
"pendingAlarms",
".",
"containsKey",
"(",
"key",
")",
")",
"return",
"(",
"(",
"Set",
")",
"pendingAlarms",
".",
"get",
"(",
"key",
")",
")",
".",
"iterator",
"(",
")",
";",
"return",
"new",
"GTSIterator",
"(",
")",
";",
"}",
"}"
] | Utility method for getting the list of all alarms associated with
a particular key. Returns an empty Iterator if the given key
has no alarms.
@param key The key for the set of alarms to return.
@return An enumeration of all alarms associated with the given
key (may be empty). | [
"Utility",
"method",
"for",
"getting",
"the",
"list",
"of",
"all",
"alarms",
"associated",
"with",
"a",
"particular",
"key",
".",
"Returns",
"an",
"empty",
"Iterator",
"if",
"the",
"given",
"key",
"has",
"no",
"alarms",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java#L1866-L1875 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java | GuaranteedTargetStream.isStreamBlocked | private boolean isStreamBlocked()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(this, tc, "isStreamBlocked");
SibTr.exit(tc, "isStreamBlocked", new Object[] { Boolean.valueOf(isStreamBlocked),
Long.valueOf(linkBlockingTick) });
}
return this.isStreamBlocked;
} | java | private boolean isStreamBlocked()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(this, tc, "isStreamBlocked");
SibTr.exit(tc, "isStreamBlocked", new Object[] { Boolean.valueOf(isStreamBlocked),
Long.valueOf(linkBlockingTick) });
}
return this.isStreamBlocked;
} | [
"private",
"boolean",
"isStreamBlocked",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"isStreamBlocked\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"isStreamBlocked\"",
",",
"new",
"Object",
"[",
"]",
"{",
"Boolean",
".",
"valueOf",
"(",
"isStreamBlocked",
")",
",",
"Long",
".",
"valueOf",
"(",
"linkBlockingTick",
")",
"}",
")",
";",
"}",
"return",
"this",
".",
"isStreamBlocked",
";",
"}"
] | Is the stream marked as blocked.
@return true if the stream is blocked. | [
"Is",
"the",
"stream",
"marked",
"as",
"blocked",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java#L2229-L2239 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java | GuaranteedTargetStream.isStreamBlockedUnexpectedly | private boolean isStreamBlockedUnexpectedly()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(this, tc, "isStreamBlockedUnexpectedly");
SibTr.exit(tc, "isStreamBlockedUnexpectedly", Boolean.valueOf(unexpectedBlock));
}
return unexpectedBlock;
} | java | private boolean isStreamBlockedUnexpectedly()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(this, tc, "isStreamBlockedUnexpectedly");
SibTr.exit(tc, "isStreamBlockedUnexpectedly", Boolean.valueOf(unexpectedBlock));
}
return unexpectedBlock;
} | [
"private",
"boolean",
"isStreamBlockedUnexpectedly",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"isStreamBlockedUnexpectedly\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"isStreamBlockedUnexpectedly\"",
",",
"Boolean",
".",
"valueOf",
"(",
"unexpectedBlock",
")",
")",
";",
"}",
"return",
"unexpectedBlock",
";",
"}"
] | Is the stream marked as blocked unexpectedly
@return true if the stream is blocked. | [
"Is",
"the",
"stream",
"marked",
"as",
"blocked",
"unexpectedly"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java#L2246-L2255 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java | GuaranteedTargetStream.streamCanAcceptNewMessage | private boolean streamCanAcceptNewMessage(MessageItem msgItem, long valueTick) throws SIException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "streamCanAcceptNewMessage", new Object[] { msgItem, Long.valueOf(valueTick) });
boolean allowSend = false;
if (isStreamBlocked())
{
//once the stream is blocked, only an AckExpected message or a Silence on the blocking tick
//can unset it - therefore we do not re-check and we only allow this message through if it fills a gap.
if (valueTick <= valueHorizon)
{
//the message might fill in a gap so we allow it through
allowSend = true;
}
}
else
{
//the stream is not currently blocked.
//However, the destination might no longer be able to accept messages, in which case
//we should update the flag and only allow the send if the message fills a gap.
JsMessage msg = msgItem.getMessage();
int blockingReason = deliverer.checkAbleToAcceptMessage(msg.getRoutingDestination());
if (blockingReason != DestinationHandler.OUTPUT_HANDLER_FOUND)
{
//We might still be able to let this message through if it
//fills in a gap
if (valueTick <= valueHorizon)
{
//the message might fill in a gap so we allow it through
allowSend = true;
}
else
{
// The stream is now blocked
setStreamIsBlocked(true, blockingReason, null, msg.getRoutingDestination());
// Keep track of the value tick. We may subsequently get a SILENCE for the
// tick signalling that the associated message has been deleted from the
// source and that the stream may be marked as unblocked.
linkBlockingTick = valueTick;
}
}
else
{
allowSend = true;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "streamCanAcceptNewMessage", Boolean.valueOf(allowSend));
return allowSend;
} | java | private boolean streamCanAcceptNewMessage(MessageItem msgItem, long valueTick) throws SIException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "streamCanAcceptNewMessage", new Object[] { msgItem, Long.valueOf(valueTick) });
boolean allowSend = false;
if (isStreamBlocked())
{
//once the stream is blocked, only an AckExpected message or a Silence on the blocking tick
//can unset it - therefore we do not re-check and we only allow this message through if it fills a gap.
if (valueTick <= valueHorizon)
{
//the message might fill in a gap so we allow it through
allowSend = true;
}
}
else
{
//the stream is not currently blocked.
//However, the destination might no longer be able to accept messages, in which case
//we should update the flag and only allow the send if the message fills a gap.
JsMessage msg = msgItem.getMessage();
int blockingReason = deliverer.checkAbleToAcceptMessage(msg.getRoutingDestination());
if (blockingReason != DestinationHandler.OUTPUT_HANDLER_FOUND)
{
//We might still be able to let this message through if it
//fills in a gap
if (valueTick <= valueHorizon)
{
//the message might fill in a gap so we allow it through
allowSend = true;
}
else
{
// The stream is now blocked
setStreamIsBlocked(true, blockingReason, null, msg.getRoutingDestination());
// Keep track of the value tick. We may subsequently get a SILENCE for the
// tick signalling that the associated message has been deleted from the
// source and that the stream may be marked as unblocked.
linkBlockingTick = valueTick;
}
}
else
{
allowSend = true;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "streamCanAcceptNewMessage", Boolean.valueOf(allowSend));
return allowSend;
} | [
"private",
"boolean",
"streamCanAcceptNewMessage",
"(",
"MessageItem",
"msgItem",
",",
"long",
"valueTick",
")",
"throws",
"SIException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"streamCanAcceptNewMessage\"",
",",
"new",
"Object",
"[",
"]",
"{",
"msgItem",
",",
"Long",
".",
"valueOf",
"(",
"valueTick",
")",
"}",
")",
";",
"boolean",
"allowSend",
"=",
"false",
";",
"if",
"(",
"isStreamBlocked",
"(",
")",
")",
"{",
"//once the stream is blocked, only an AckExpected message or a Silence on the blocking tick",
"//can unset it - therefore we do not re-check and we only allow this message through if it fills a gap.",
"if",
"(",
"valueTick",
"<=",
"valueHorizon",
")",
"{",
"//the message might fill in a gap so we allow it through",
"allowSend",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"//the stream is not currently blocked.",
"//However, the destination might no longer be able to accept messages, in which case",
"//we should update the flag and only allow the send if the message fills a gap.",
"JsMessage",
"msg",
"=",
"msgItem",
".",
"getMessage",
"(",
")",
";",
"int",
"blockingReason",
"=",
"deliverer",
".",
"checkAbleToAcceptMessage",
"(",
"msg",
".",
"getRoutingDestination",
"(",
")",
")",
";",
"if",
"(",
"blockingReason",
"!=",
"DestinationHandler",
".",
"OUTPUT_HANDLER_FOUND",
")",
"{",
"//We might still be able to let this message through if it",
"//fills in a gap",
"if",
"(",
"valueTick",
"<=",
"valueHorizon",
")",
"{",
"//the message might fill in a gap so we allow it through",
"allowSend",
"=",
"true",
";",
"}",
"else",
"{",
"// The stream is now blocked",
"setStreamIsBlocked",
"(",
"true",
",",
"blockingReason",
",",
"null",
",",
"msg",
".",
"getRoutingDestination",
"(",
")",
")",
";",
"// Keep track of the value tick. We may subsequently get a SILENCE for the",
"// tick signalling that the associated message has been deleted from the ",
"// source and that the stream may be marked as unblocked.",
"linkBlockingTick",
"=",
"valueTick",
";",
"}",
"}",
"else",
"{",
"allowSend",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"streamCanAcceptNewMessage\"",
",",
"Boolean",
".",
"valueOf",
"(",
"allowSend",
")",
")",
";",
"return",
"allowSend",
";",
"}"
] | Check to see if the stream is able to accept a new message. If it cannot, then the message
is only allowed through if it has the possibility of filling in a gap. See defects 244425 and
464463.
@param msgItem The msg to be let through.
@param valueTick GD Value Tick
@return true if the message should be written as value to the stream
@throws SIException | [
"Check",
"to",
"see",
"if",
"the",
"stream",
"is",
"able",
"to",
"accept",
"a",
"new",
"message",
".",
"If",
"it",
"cannot",
"then",
"the",
"message",
"is",
"only",
"allowed",
"through",
"if",
"it",
"has",
"the",
"possibility",
"of",
"filling",
"in",
"a",
"gap",
".",
"See",
"defects",
"244425",
"and",
"464463",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/GuaranteedTargetStream.java#L2284-L2335 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.tx.embeddable/src/com/ibm/wsspi/uow/UOWManagerFactory.java | UOWManagerFactory.getUOWManager | public static UOWManager getUOWManager()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "getUOWManager");
final UOWManager uowm = com.ibm.ws.uow.embeddable.UOWManagerFactory.getUOWManager();
if (tc.isEntryEnabled())
Tr.exit(tc, "getUOWManager", uowm);
return uowm;
} | java | public static UOWManager getUOWManager()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "getUOWManager");
final UOWManager uowm = com.ibm.ws.uow.embeddable.UOWManagerFactory.getUOWManager();
if (tc.isEntryEnabled())
Tr.exit(tc, "getUOWManager", uowm);
return uowm;
} | [
"public",
"static",
"UOWManager",
"getUOWManager",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getUOWManager\"",
")",
";",
"final",
"UOWManager",
"uowm",
"=",
"com",
".",
"ibm",
".",
"ws",
".",
"uow",
".",
"embeddable",
".",
"UOWManagerFactory",
".",
"getUOWManager",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getUOWManager\"",
",",
"uowm",
")",
";",
"return",
"uowm",
";",
"}"
] | Returns a stateless thread-safe UOWManager instance.
@return UOWManager instance | [
"Returns",
"a",
"stateless",
"thread",
"-",
"safe",
"UOWManager",
"instance",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.tx.embeddable/src/com/ibm/wsspi/uow/UOWManagerFactory.java#L33-L43 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.crypto.certificateutil/src/com/ibm/ws/crypto/certificateutil/keytool/KeytoolCommand.java | KeytoolCommand.getProcErrorOutput | String getProcErrorOutput(Process proc) throws IOException {
StringBuffer output = new StringBuffer();
InputStream procIn = proc.getInputStream();
int read;
// Dump the data printed by the process
do {
byte[] buffer = new byte[BUFFER_SIZE];
read = procIn.read(buffer);
String s = new String(buffer);
output.append(s);
} while (read == BUFFER_SIZE);
return output.toString();
} | java | String getProcErrorOutput(Process proc) throws IOException {
StringBuffer output = new StringBuffer();
InputStream procIn = proc.getInputStream();
int read;
// Dump the data printed by the process
do {
byte[] buffer = new byte[BUFFER_SIZE];
read = procIn.read(buffer);
String s = new String(buffer);
output.append(s);
} while (read == BUFFER_SIZE);
return output.toString();
} | [
"String",
"getProcErrorOutput",
"(",
"Process",
"proc",
")",
"throws",
"IOException",
"{",
"StringBuffer",
"output",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"InputStream",
"procIn",
"=",
"proc",
".",
"getInputStream",
"(",
")",
";",
"int",
"read",
";",
"// Dump the data printed by the process",
"do",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"BUFFER_SIZE",
"]",
";",
"read",
"=",
"procIn",
".",
"read",
"(",
"buffer",
")",
";",
"String",
"s",
"=",
"new",
"String",
"(",
"buffer",
")",
";",
"output",
".",
"append",
"(",
"s",
")",
";",
"}",
"while",
"(",
"read",
"==",
"BUFFER_SIZE",
")",
";",
"return",
"output",
".",
"toString",
"(",
")",
";",
"}"
] | Grabs the error message generated by executing the process.
@param proc
@throws IOException | [
"Grabs",
"the",
"error",
"message",
"generated",
"by",
"executing",
"the",
"process",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.certificateutil/src/com/ibm/ws/crypto/certificateutil/keytool/KeytoolCommand.java#L164-L178 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpTrailersImpl.java | HttpTrailersImpl.init | public void init(boolean useDirect, int outSize, int inSize, int cacheSize) {
super.init(useDirect, outSize, inSize, cacheSize);
} | java | public void init(boolean useDirect, int outSize, int inSize, int cacheSize) {
super.init(useDirect, outSize, inSize, cacheSize);
} | [
"public",
"void",
"init",
"(",
"boolean",
"useDirect",
",",
"int",
"outSize",
",",
"int",
"inSize",
",",
"int",
"cacheSize",
")",
"{",
"super",
".",
"init",
"(",
"useDirect",
",",
"outSize",
",",
"inSize",
",",
"cacheSize",
")",
";",
"}"
] | Initialize this trailer header storage object with certain
configuration information.
@param useDirect
@param outSize
@param inSize
@param cacheSize | [
"Initialize",
"this",
"trailer",
"header",
"storage",
"object",
"with",
"certain",
"configuration",
"information",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpTrailersImpl.java#L69-L71 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpTrailersImpl.java | HttpTrailersImpl.setDeferredTrailer | public void setDeferredTrailer(HeaderKeys hdr, HttpTrailerGenerator htg) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "setDeferredTrailer(HeaderKeys): " + hdr);
}
if (null == hdr) {
throw new IllegalArgumentException("Null header name");
}
if (null == htg) {
throw new IllegalArgumentException("Null value generator");
}
this.knownTGs.put(hdr, htg);
} | java | public void setDeferredTrailer(HeaderKeys hdr, HttpTrailerGenerator htg) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "setDeferredTrailer(HeaderKeys): " + hdr);
}
if (null == hdr) {
throw new IllegalArgumentException("Null header name");
}
if (null == htg) {
throw new IllegalArgumentException("Null value generator");
}
this.knownTGs.put(hdr, htg);
} | [
"public",
"void",
"setDeferredTrailer",
"(",
"HeaderKeys",
"hdr",
",",
"HttpTrailerGenerator",
"htg",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setDeferredTrailer(HeaderKeys): \"",
"+",
"hdr",
")",
";",
"}",
"if",
"(",
"null",
"==",
"hdr",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null header name\"",
")",
";",
"}",
"if",
"(",
"null",
"==",
"htg",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null value generator\"",
")",
";",
"}",
"this",
".",
"knownTGs",
".",
"put",
"(",
"hdr",
",",
"htg",
")",
";",
"}"
] | Set a trailer based upon a not-yet established value.
When the deferred trailer is set, it is the users responsibility to
synchronize the deferred trailer list with the Trailer header field
up front. For instance if one sets the deferred trailer
HDR_CONTENT_LANGUAGE, then the trailer header in the head of the HTTP
request/response should contain "Trailer:Content-Language"
@param hdr
the header to use.
@param htg
the object which will generate the value for this trailer
dynamically. An <code>HttpTrailerGenerator</code> is called
immediately after the 0-size chunk is sent, but before closing
or recycling the connection.
@throws IllegalArgumentException
if any parameter is NULL or if the
header represented is unsupported. | [
"Set",
"a",
"trailer",
"based",
"upon",
"a",
"not",
"-",
"yet",
"established",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpTrailersImpl.java#L129-L141 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpTrailersImpl.java | HttpTrailersImpl.computeRemainingTrailers | public void computeRemainingTrailers() {
if (tc.isEntryEnabled()) {
Tr.entry(tc, "computeRemainingTrailers");
}
Iterator<HeaderKeys> knowns = this.knownTGs.keySet().iterator();
while (knowns.hasNext()) {
HeaderKeys key = knowns.next();
setHeader(key, this.knownTGs.get(key).generateTrailerValue(key, this));
}
if (tc.isEntryEnabled()) {
Tr.exit(tc, "computeRemainingTrailers");
}
} | java | public void computeRemainingTrailers() {
if (tc.isEntryEnabled()) {
Tr.entry(tc, "computeRemainingTrailers");
}
Iterator<HeaderKeys> knowns = this.knownTGs.keySet().iterator();
while (knowns.hasNext()) {
HeaderKeys key = knowns.next();
setHeader(key, this.knownTGs.get(key).generateTrailerValue(key, this));
}
if (tc.isEntryEnabled()) {
Tr.exit(tc, "computeRemainingTrailers");
}
} | [
"public",
"void",
"computeRemainingTrailers",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"computeRemainingTrailers\"",
")",
";",
"}",
"Iterator",
"<",
"HeaderKeys",
">",
"knowns",
"=",
"this",
".",
"knownTGs",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"knowns",
".",
"hasNext",
"(",
")",
")",
"{",
"HeaderKeys",
"key",
"=",
"knowns",
".",
"next",
"(",
")",
";",
"setHeader",
"(",
"key",
",",
"this",
".",
"knownTGs",
".",
"get",
"(",
"key",
")",
".",
"generateTrailerValue",
"(",
"key",
",",
"this",
")",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"computeRemainingTrailers\"",
")",
";",
"}",
"}"
] | Compute all deferred headers.
<p>
All <code>HttpTrailerGenerator</code> will be called upon to create the value for their respective header. The values they create will automatically be added to the
Trailer-based <code>BNFHeaders</code> object for immediate serialization.
</p> | [
"Compute",
"all",
"deferred",
"headers",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpTrailersImpl.java#L234-L246 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpTrailersImpl.java | HttpTrailersImpl.destroy | public void destroy() {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Destroy trailers: " + this);
}
super.destroy();
if (null != this.myFactory) {
this.myFactory.releaseTrailers(this);
this.myFactory = null;
}
} | java | public void destroy() {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Destroy trailers: " + this);
}
super.destroy();
if (null != this.myFactory) {
this.myFactory.releaseTrailers(this);
this.myFactory = null;
}
} | [
"public",
"void",
"destroy",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Destroy trailers: \"",
"+",
"this",
")",
";",
"}",
"super",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"this",
".",
"myFactory",
")",
"{",
"this",
".",
"myFactory",
".",
"releaseTrailers",
"(",
"this",
")",
";",
"this",
".",
"myFactory",
"=",
"null",
";",
"}",
"}"
] | Destroy this object. | [
"Destroy",
"this",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpTrailersImpl.java#L255-L264 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpTrailersImpl.java | HttpTrailersImpl.duplicate | public HttpTrailersImpl duplicate() {
if (null == this.myFactory) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Null factory, unable to duplicate: " + this);
}
return null;
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Duplicating the trailer headers: " + this);
}
computeRemainingTrailers();
HttpTrailersImpl msg = this.myFactory.getTrailers();
super.duplicate(msg);
return msg;
} | java | public HttpTrailersImpl duplicate() {
if (null == this.myFactory) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Null factory, unable to duplicate: " + this);
}
return null;
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Duplicating the trailer headers: " + this);
}
computeRemainingTrailers();
HttpTrailersImpl msg = this.myFactory.getTrailers();
super.duplicate(msg);
return msg;
} | [
"public",
"HttpTrailersImpl",
"duplicate",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"this",
".",
"myFactory",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Null factory, unable to duplicate: \"",
"+",
"this",
")",
";",
"}",
"return",
"null",
";",
"}",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Duplicating the trailer headers: \"",
"+",
"this",
")",
";",
"}",
"computeRemainingTrailers",
"(",
")",
";",
"HttpTrailersImpl",
"msg",
"=",
"this",
".",
"myFactory",
".",
"getTrailers",
"(",
")",
";",
"super",
".",
"duplicate",
"(",
"msg",
")",
";",
"return",
"msg",
";",
"}"
] | Create a duplicate version of these trailer headers.
@return HttpTrailersImpl | [
"Create",
"a",
"duplicate",
"version",
"of",
"these",
"trailer",
"headers",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpTrailersImpl.java#L271-L286 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.filetransfer/src/com/ibm/ws/filetransfer/util/FileServiceUtil.java | FileServiceUtil.isPathContained | public static boolean isPathContained(List<String> allowedPaths, String targetPath) {
if (allowedPaths == null || allowedPaths.isEmpty() || targetPath == null) {
return false;
}
//Remove trailing slashes, if applicable
if (!targetPath.isEmpty() &&
targetPath.charAt(targetPath.length() - 1) == '/' &&
targetPath.length() > 1 &&
!isWindowsRootDirectory(targetPath)) {
targetPath = targetPath.substring(0, targetPath.length() - 1);
}
while (targetPath != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Target path: " + targetPath);
}
for (int i = 0; i < allowedPaths.size(); i++) {
//String allowedPath = it.next();
String allowedPath = allowedPaths.get(i);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Checking path: " + allowedPath);
}
//When we have a configuration that explicitly sets an empty read or write list, then we get a non-empty set
//with a single empty string. So we must catch empty cases here, otherwise the comparisons below might be incorrect.
if ("".equals(allowedPath)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Skipping an empty path");
}
continue;
}
//We are always doing case-insensitive comparisons because we can't reliably find out
//if the windows machine has changed its registry key to allow sensitivity, nor do we
//know if the remote host is a certain OS. For the purposes of this method (checking for access
//to a directory) it is safe to assume case insensitivity.
if (allowedPath.equalsIgnoreCase(targetPath)) {
return true;
}
}
// We'll check 'up' the target path's parent chain to see if that's
// covered by the allowed paths.
targetPath = getNormalizedParent(targetPath);
}
return false;
} | java | public static boolean isPathContained(List<String> allowedPaths, String targetPath) {
if (allowedPaths == null || allowedPaths.isEmpty() || targetPath == null) {
return false;
}
//Remove trailing slashes, if applicable
if (!targetPath.isEmpty() &&
targetPath.charAt(targetPath.length() - 1) == '/' &&
targetPath.length() > 1 &&
!isWindowsRootDirectory(targetPath)) {
targetPath = targetPath.substring(0, targetPath.length() - 1);
}
while (targetPath != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Target path: " + targetPath);
}
for (int i = 0; i < allowedPaths.size(); i++) {
//String allowedPath = it.next();
String allowedPath = allowedPaths.get(i);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Checking path: " + allowedPath);
}
//When we have a configuration that explicitly sets an empty read or write list, then we get a non-empty set
//with a single empty string. So we must catch empty cases here, otherwise the comparisons below might be incorrect.
if ("".equals(allowedPath)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Skipping an empty path");
}
continue;
}
//We are always doing case-insensitive comparisons because we can't reliably find out
//if the windows machine has changed its registry key to allow sensitivity, nor do we
//know if the remote host is a certain OS. For the purposes of this method (checking for access
//to a directory) it is safe to assume case insensitivity.
if (allowedPath.equalsIgnoreCase(targetPath)) {
return true;
}
}
// We'll check 'up' the target path's parent chain to see if that's
// covered by the allowed paths.
targetPath = getNormalizedParent(targetPath);
}
return false;
} | [
"public",
"static",
"boolean",
"isPathContained",
"(",
"List",
"<",
"String",
">",
"allowedPaths",
",",
"String",
"targetPath",
")",
"{",
"if",
"(",
"allowedPaths",
"==",
"null",
"||",
"allowedPaths",
".",
"isEmpty",
"(",
")",
"||",
"targetPath",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"//Remove trailing slashes, if applicable",
"if",
"(",
"!",
"targetPath",
".",
"isEmpty",
"(",
")",
"&&",
"targetPath",
".",
"charAt",
"(",
"targetPath",
".",
"length",
"(",
")",
"-",
"1",
")",
"==",
"'",
"'",
"&&",
"targetPath",
".",
"length",
"(",
")",
">",
"1",
"&&",
"!",
"isWindowsRootDirectory",
"(",
"targetPath",
")",
")",
"{",
"targetPath",
"=",
"targetPath",
".",
"substring",
"(",
"0",
",",
"targetPath",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"while",
"(",
"targetPath",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Target path: \"",
"+",
"targetPath",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"allowedPaths",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"//String allowedPath = it.next();",
"String",
"allowedPath",
"=",
"allowedPaths",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Checking path: \"",
"+",
"allowedPath",
")",
";",
"}",
"//When we have a configuration that explicitly sets an empty read or write list, then we get a non-empty set",
"//with a single empty string. So we must catch empty cases here, otherwise the comparisons below might be incorrect.",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"allowedPath",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Skipping an empty path\"",
")",
";",
"}",
"continue",
";",
"}",
"//We are always doing case-insensitive comparisons because we can't reliably find out",
"//if the windows machine has changed its registry key to allow sensitivity, nor do we",
"//know if the remote host is a certain OS. For the purposes of this method (checking for access",
"//to a directory) it is safe to assume case insensitivity.",
"if",
"(",
"allowedPath",
".",
"equalsIgnoreCase",
"(",
"targetPath",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"// We'll check 'up' the target path's parent chain to see if that's",
"// covered by the allowed paths.",
"targetPath",
"=",
"getNormalizedParent",
"(",
"targetPath",
")",
";",
"}",
"return",
"false",
";",
"}"
] | Returns true if the targetPath is contained within one of the allowedPaths.
Assumption: the "allowedPaths" point to directories, and the "targetPath" is already normalized. | [
"Returns",
"true",
"if",
"the",
"targetPath",
"is",
"contained",
"within",
"one",
"of",
"the",
"allowedPaths",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.filetransfer/src/com/ibm/ws/filetransfer/util/FileServiceUtil.java#L239-L294 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/data/SpdLoadImpl.java | SpdLoadImpl.getStatistic | public StatisticImpl getStatistic() {
if (enabled) {
long curTime = stat.updateIntegral();
stat.setLastSampleTime(curTime);
return stat;
} else {
return stat;
}
} | java | public StatisticImpl getStatistic() {
if (enabled) {
long curTime = stat.updateIntegral();
stat.setLastSampleTime(curTime);
return stat;
} else {
return stat;
}
} | [
"public",
"StatisticImpl",
"getStatistic",
"(",
")",
"{",
"if",
"(",
"enabled",
")",
"{",
"long",
"curTime",
"=",
"stat",
".",
"updateIntegral",
"(",
")",
";",
"stat",
".",
"setLastSampleTime",
"(",
"curTime",
")",
";",
"return",
"stat",
";",
"}",
"else",
"{",
"return",
"stat",
";",
"}",
"}"
] | to time. | [
"to",
"time",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/data/SpdLoadImpl.java#L88-L98 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/data/SpdLoadImpl.java | SpdLoadImpl.combine | public void combine(SpdLoad other) {
if (other == null)
return;
if (stat.isEnabled() && other.isEnabled())
//stat.combine((BoundedRangeStatisticImpl)other.getStatistic());
stat.combine(other.getStatistic());
} | java | public void combine(SpdLoad other) {
if (other == null)
return;
if (stat.isEnabled() && other.isEnabled())
//stat.combine((BoundedRangeStatisticImpl)other.getStatistic());
stat.combine(other.getStatistic());
} | [
"public",
"void",
"combine",
"(",
"SpdLoad",
"other",
")",
"{",
"if",
"(",
"other",
"==",
"null",
")",
"return",
";",
"if",
"(",
"stat",
".",
"isEnabled",
"(",
")",
"&&",
"other",
".",
"isEnabled",
"(",
")",
")",
"//stat.combine((BoundedRangeStatisticImpl)other.getStatistic());",
"stat",
".",
"combine",
"(",
"other",
".",
"getStatistic",
"(",
")",
")",
";",
"}"
] | Combine this data and other SpdLoad data | [
"Combine",
"this",
"data",
"and",
"other",
"SpdLoad",
"data"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/data/SpdLoadImpl.java#L105-L111 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/VariableEvaluator.java | VariableEvaluator.getProperty | private String getProperty(String variable, EvaluationContext context, boolean ignoreWarnings, boolean useEnvironment) throws ConfigEvaluatorException {
return stringUtils.convertToString(getPropertyObject(variable, context, ignoreWarnings, useEnvironment));
} | java | private String getProperty(String variable, EvaluationContext context, boolean ignoreWarnings, boolean useEnvironment) throws ConfigEvaluatorException {
return stringUtils.convertToString(getPropertyObject(variable, context, ignoreWarnings, useEnvironment));
} | [
"private",
"String",
"getProperty",
"(",
"String",
"variable",
",",
"EvaluationContext",
"context",
",",
"boolean",
"ignoreWarnings",
",",
"boolean",
"useEnvironment",
")",
"throws",
"ConfigEvaluatorException",
"{",
"return",
"stringUtils",
".",
"convertToString",
"(",
"getPropertyObject",
"(",
"variable",
",",
"context",
",",
"ignoreWarnings",
",",
"useEnvironment",
")",
")",
";",
"}"
] | Returns the value of the variable as a string, or null if the property
does not exist.
@param variable the variable name | [
"Returns",
"the",
"value",
"of",
"the",
"variable",
"as",
"a",
"string",
"or",
"null",
"if",
"the",
"property",
"does",
"not",
"exist",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/VariableEvaluator.java#L81-L83 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/VariableEvaluator.java | VariableEvaluator.processVariableLists | Object processVariableLists(Object rawValue, ExtendedAttributeDefinition attributeDef,
EvaluationContext context, boolean ignoreWarnings) throws ConfigEvaluatorException {
if (attributeDef != null && !attributeDef.resolveVariables())
return rawValue;
if (rawValue instanceof List) {
List<Object> returnList = new ArrayList<Object>();
List<Object> values = (List<Object>) rawValue;
for (Object o : values) {
Object processed = processVariableLists(o, attributeDef, context, ignoreWarnings);
if (processed instanceof List)
returnList.addAll((List<Object>) processed);
else
returnList.add(processed);
}
return returnList;
} else if (rawValue instanceof String) {
// Look for functions of the form ${list(variableName)} first
Matcher matcher = XMLConfigConstants.VAR_LIST_PATTERN.matcher((String) rawValue);
if (matcher.find()) {
String var = matcher.group(1);
String rep = getProperty(var, context, ignoreWarnings, true);
return rep == null ? rawValue : MetaTypeHelper.parseValue(rep);
} else {
return rawValue;
}
} else {
return rawValue;
}
} | java | Object processVariableLists(Object rawValue, ExtendedAttributeDefinition attributeDef,
EvaluationContext context, boolean ignoreWarnings) throws ConfigEvaluatorException {
if (attributeDef != null && !attributeDef.resolveVariables())
return rawValue;
if (rawValue instanceof List) {
List<Object> returnList = new ArrayList<Object>();
List<Object> values = (List<Object>) rawValue;
for (Object o : values) {
Object processed = processVariableLists(o, attributeDef, context, ignoreWarnings);
if (processed instanceof List)
returnList.addAll((List<Object>) processed);
else
returnList.add(processed);
}
return returnList;
} else if (rawValue instanceof String) {
// Look for functions of the form ${list(variableName)} first
Matcher matcher = XMLConfigConstants.VAR_LIST_PATTERN.matcher((String) rawValue);
if (matcher.find()) {
String var = matcher.group(1);
String rep = getProperty(var, context, ignoreWarnings, true);
return rep == null ? rawValue : MetaTypeHelper.parseValue(rep);
} else {
return rawValue;
}
} else {
return rawValue;
}
} | [
"Object",
"processVariableLists",
"(",
"Object",
"rawValue",
",",
"ExtendedAttributeDefinition",
"attributeDef",
",",
"EvaluationContext",
"context",
",",
"boolean",
"ignoreWarnings",
")",
"throws",
"ConfigEvaluatorException",
"{",
"if",
"(",
"attributeDef",
"!=",
"null",
"&&",
"!",
"attributeDef",
".",
"resolveVariables",
"(",
")",
")",
"return",
"rawValue",
";",
"if",
"(",
"rawValue",
"instanceof",
"List",
")",
"{",
"List",
"<",
"Object",
">",
"returnList",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"List",
"<",
"Object",
">",
"values",
"=",
"(",
"List",
"<",
"Object",
">",
")",
"rawValue",
";",
"for",
"(",
"Object",
"o",
":",
"values",
")",
"{",
"Object",
"processed",
"=",
"processVariableLists",
"(",
"o",
",",
"attributeDef",
",",
"context",
",",
"ignoreWarnings",
")",
";",
"if",
"(",
"processed",
"instanceof",
"List",
")",
"returnList",
".",
"addAll",
"(",
"(",
"List",
"<",
"Object",
">",
")",
"processed",
")",
";",
"else",
"returnList",
".",
"add",
"(",
"processed",
")",
";",
"}",
"return",
"returnList",
";",
"}",
"else",
"if",
"(",
"rawValue",
"instanceof",
"String",
")",
"{",
"// Look for functions of the form ${list(variableName)} first",
"Matcher",
"matcher",
"=",
"XMLConfigConstants",
".",
"VAR_LIST_PATTERN",
".",
"matcher",
"(",
"(",
"String",
")",
"rawValue",
")",
";",
"if",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"String",
"var",
"=",
"matcher",
".",
"group",
"(",
"1",
")",
";",
"String",
"rep",
"=",
"getProperty",
"(",
"var",
",",
"context",
",",
"ignoreWarnings",
",",
"true",
")",
";",
"return",
"rep",
"==",
"null",
"?",
"rawValue",
":",
"MetaTypeHelper",
".",
"parseValue",
"(",
"rep",
")",
";",
"}",
"else",
"{",
"return",
"rawValue",
";",
"}",
"}",
"else",
"{",
"return",
"rawValue",
";",
"}",
"}"
] | Replaces list variable expressions in raw string values | [
"Replaces",
"list",
"variable",
"expressions",
"in",
"raw",
"string",
"values"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/VariableEvaluator.java#L237-L267 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/ContentMatcher.java | ContentMatcher.nextMatcher | ContentMatcher nextMatcher(Conjunction selector, ContentMatcher oldMatcher) {
return Factory.createMatcher(ordinalPosition, selector, oldMatcher);
} | java | ContentMatcher nextMatcher(Conjunction selector, ContentMatcher oldMatcher) {
return Factory.createMatcher(ordinalPosition, selector, oldMatcher);
} | [
"ContentMatcher",
"nextMatcher",
"(",
"Conjunction",
"selector",
",",
"ContentMatcher",
"oldMatcher",
")",
"{",
"return",
"Factory",
".",
"createMatcher",
"(",
"ordinalPosition",
",",
"selector",
",",
"oldMatcher",
")",
";",
"}"
] | Determine the next matcher to which a put operation should be delegated.
Except when cacheing is active, this method delegates to Factory.createMatcher.
It is overridden in EqualityMatcher to wrap newly created Matchers in a
CacheingMatcher when appropriate
@param selector
@param oldMatcher | [
"Determine",
"the",
"next",
"matcher",
"to",
"which",
"a",
"put",
"operation",
"should",
"be",
"delegated",
".",
"Except",
"when",
"cacheing",
"is",
"active",
"this",
"method",
"delegates",
"to",
"Factory",
".",
"createMatcher",
".",
"It",
"is",
"overridden",
"in",
"EqualityMatcher",
"to",
"wrap",
"newly",
"created",
"Matchers",
"in",
"a",
"CacheingMatcher",
"when",
"appropriate"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/ContentMatcher.java#L106-L108 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.syncToOSThread | private void syncToOSThread(WebSecurityContext webSecurityContext) throws SecurityViolationException {
try {
Object token = ThreadIdentityManager.setAppThreadIdentity(subjectManager.getInvocationSubject());
webSecurityContext.setSyncToOSThreadToken(token);
} catch (ThreadIdentityException tie) {
SecurityViolationException secVE = convertWebSecurityException(new WebSecurityCollaboratorException(tie.getMessage(), DENY_AUTHZ_FAILED, webSecurityContext));
throw secVE;
}
} | java | private void syncToOSThread(WebSecurityContext webSecurityContext) throws SecurityViolationException {
try {
Object token = ThreadIdentityManager.setAppThreadIdentity(subjectManager.getInvocationSubject());
webSecurityContext.setSyncToOSThreadToken(token);
} catch (ThreadIdentityException tie) {
SecurityViolationException secVE = convertWebSecurityException(new WebSecurityCollaboratorException(tie.getMessage(), DENY_AUTHZ_FAILED, webSecurityContext));
throw secVE;
}
} | [
"private",
"void",
"syncToOSThread",
"(",
"WebSecurityContext",
"webSecurityContext",
")",
"throws",
"SecurityViolationException",
"{",
"try",
"{",
"Object",
"token",
"=",
"ThreadIdentityManager",
".",
"setAppThreadIdentity",
"(",
"subjectManager",
".",
"getInvocationSubject",
"(",
")",
")",
";",
"webSecurityContext",
".",
"setSyncToOSThreadToken",
"(",
"token",
")",
";",
"}",
"catch",
"(",
"ThreadIdentityException",
"tie",
")",
"{",
"SecurityViolationException",
"secVE",
"=",
"convertWebSecurityException",
"(",
"new",
"WebSecurityCollaboratorException",
"(",
"tie",
".",
"getMessage",
"(",
")",
",",
"DENY_AUTHZ_FAILED",
",",
"webSecurityContext",
")",
")",
";",
"throw",
"secVE",
";",
"}",
"}"
] | Sync the invocation Subject's identity to the thread, if request by the application.
@param WebSecurityContext The security context object for this application invocation.
MUST NOT BE NULL.
@throws SecurityViolationException | [
"Sync",
"the",
"invocation",
"Subject",
"s",
"identity",
"to",
"the",
"thread",
"if",
"request",
"by",
"the",
"application",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L595-L603 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.resetSyncToOSThread | private void resetSyncToOSThread(WebSecurityContext webSecurityContext) throws ThreadIdentityException {
Object token = webSecurityContext.getSyncToOSThreadToken();
if (token != null) {
ThreadIdentityManager.resetChecked(token);
}
} | java | private void resetSyncToOSThread(WebSecurityContext webSecurityContext) throws ThreadIdentityException {
Object token = webSecurityContext.getSyncToOSThreadToken();
if (token != null) {
ThreadIdentityManager.resetChecked(token);
}
} | [
"private",
"void",
"resetSyncToOSThread",
"(",
"WebSecurityContext",
"webSecurityContext",
")",
"throws",
"ThreadIdentityException",
"{",
"Object",
"token",
"=",
"webSecurityContext",
".",
"getSyncToOSThreadToken",
"(",
")",
";",
"if",
"(",
"token",
"!=",
"null",
")",
"{",
"ThreadIdentityManager",
".",
"resetChecked",
"(",
"token",
")",
";",
"}",
"}"
] | Remove the invocation Subject's identity from the thread, if it was previously sync'ed.
@param WebSecurityContext The security context object for this application invocation.
MUST NOT BE NULL.
@throws ThreadIdentityException | [
"Remove",
"the",
"invocation",
"Subject",
"s",
"identity",
"from",
"the",
"thread",
"if",
"it",
"was",
"previously",
"sync",
"ed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L612-L617 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.authenticateRequest | public AuthenticationResult authenticateRequest(WebRequest webRequest) {
WebAuthenticator authenticator = getWebAuthenticatorProxy();
return authenticator.authenticate(webRequest);
} | java | public AuthenticationResult authenticateRequest(WebRequest webRequest) {
WebAuthenticator authenticator = getWebAuthenticatorProxy();
return authenticator.authenticate(webRequest);
} | [
"public",
"AuthenticationResult",
"authenticateRequest",
"(",
"WebRequest",
"webRequest",
")",
"{",
"WebAuthenticator",
"authenticator",
"=",
"getWebAuthenticatorProxy",
"(",
")",
";",
"return",
"authenticator",
".",
"authenticate",
"(",
"webRequest",
")",
";",
"}"
] | The main method called by the preInvoke. The return value of this method tells
us if access to the requested resource is allowed or not.
Delegates to the authenticator proxy to handle the authentication.
@param webRequest
@return AuthenticationResult | [
"The",
"main",
"method",
"called",
"by",
"the",
"preInvoke",
".",
"The",
"return",
"value",
"of",
"this",
"method",
"tells",
"us",
"if",
"access",
"to",
"the",
"requested",
"resource",
"is",
"allowed",
"or",
"not",
".",
"Delegates",
"to",
"the",
"authenticator",
"proxy",
"to",
"handle",
"the",
"authentication",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L1203-L1206 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.authorize | public boolean authorize(AuthenticationResult authResult, String appName, String uriName, Subject previousCaller, List<String> requiredRoles) {
// Set the authorized subject on the thread
subjectManager.setCallerSubject(authResult.getSubject());
boolean isAuthorized = authorize(authResult, appName, uriName, requiredRoles);
if (isAuthorized) {
// at this point set invocation subject = caller subject.
// delegation may change the invocation subject later
subjectManager.setInvocationSubject(authResult.getSubject());
} else {
subjectManager.setCallerSubject(previousCaller);
}
return isAuthorized;
} | java | public boolean authorize(AuthenticationResult authResult, String appName, String uriName, Subject previousCaller, List<String> requiredRoles) {
// Set the authorized subject on the thread
subjectManager.setCallerSubject(authResult.getSubject());
boolean isAuthorized = authorize(authResult, appName, uriName, requiredRoles);
if (isAuthorized) {
// at this point set invocation subject = caller subject.
// delegation may change the invocation subject later
subjectManager.setInvocationSubject(authResult.getSubject());
} else {
subjectManager.setCallerSubject(previousCaller);
}
return isAuthorized;
} | [
"public",
"boolean",
"authorize",
"(",
"AuthenticationResult",
"authResult",
",",
"String",
"appName",
",",
"String",
"uriName",
",",
"Subject",
"previousCaller",
",",
"List",
"<",
"String",
">",
"requiredRoles",
")",
"{",
"// Set the authorized subject on the thread",
"subjectManager",
".",
"setCallerSubject",
"(",
"authResult",
".",
"getSubject",
"(",
")",
")",
";",
"boolean",
"isAuthorized",
"=",
"authorize",
"(",
"authResult",
",",
"appName",
",",
"uriName",
",",
"requiredRoles",
")",
";",
"if",
"(",
"isAuthorized",
")",
"{",
"// at this point set invocation subject = caller subject.",
"// delegation may change the invocation subject later",
"subjectManager",
".",
"setInvocationSubject",
"(",
"authResult",
".",
"getSubject",
"(",
")",
")",
";",
"}",
"else",
"{",
"subjectManager",
".",
"setCallerSubject",
"(",
"previousCaller",
")",
";",
"}",
"return",
"isAuthorized",
";",
"}"
] | Call the authorization service to determine if the subject is authorized to the given roles
@param authResult the authentication result, containing the subject, user name and realm
@param appName the name of the application, used to look up the correct authorization table
@param uriName the uri being accessed
@param previousCaller the previous caller, used to restore the previous state if authorization fails
@param requiredRoles the roles required to access the resource
@return true if the subject is authorized, otherwise false | [
"Call",
"the",
"authorization",
"service",
"to",
"determine",
"if",
"the",
"subject",
"is",
"authorized",
"to",
"the",
"given",
"roles"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L1236-L1248 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.performInitialChecks | public WebReply performInitialChecks(WebRequest webRequest, String uriName) {
WebReply webReply = null;
HttpServletRequest req = webRequest.getHttpServletRequest();
String methodName = req.getMethod();
if (uriName == null || uriName.length() == 0) {
return new DenyReply("Invalid URI passed to Security Collaborator.");
}
if (unsupportedAuthMech() == true) {
return new DenyReply("Authentication Failed : DIGEST not supported");
}
if (wasch.isSSLRequired(webRequest, uriName)) {
return httpsRedirectHandler.getHTTPSRedirectWebReply(req);
}
webReply = unprotectedSpecialURI(webRequest, uriName, methodName);
if (webReply != null) {
return webReply;
}
webReply = unprotectedResource(webRequest);
if (webReply == PERMIT_REPLY) {
if (shouldWePerformTAIForUnProtectedURI(webRequest))
return null;
else
return webReply;
}
return null;
} | java | public WebReply performInitialChecks(WebRequest webRequest, String uriName) {
WebReply webReply = null;
HttpServletRequest req = webRequest.getHttpServletRequest();
String methodName = req.getMethod();
if (uriName == null || uriName.length() == 0) {
return new DenyReply("Invalid URI passed to Security Collaborator.");
}
if (unsupportedAuthMech() == true) {
return new DenyReply("Authentication Failed : DIGEST not supported");
}
if (wasch.isSSLRequired(webRequest, uriName)) {
return httpsRedirectHandler.getHTTPSRedirectWebReply(req);
}
webReply = unprotectedSpecialURI(webRequest, uriName, methodName);
if (webReply != null) {
return webReply;
}
webReply = unprotectedResource(webRequest);
if (webReply == PERMIT_REPLY) {
if (shouldWePerformTAIForUnProtectedURI(webRequest))
return null;
else
return webReply;
}
return null;
} | [
"public",
"WebReply",
"performInitialChecks",
"(",
"WebRequest",
"webRequest",
",",
"String",
"uriName",
")",
"{",
"WebReply",
"webReply",
"=",
"null",
";",
"HttpServletRequest",
"req",
"=",
"webRequest",
".",
"getHttpServletRequest",
"(",
")",
";",
"String",
"methodName",
"=",
"req",
".",
"getMethod",
"(",
")",
";",
"if",
"(",
"uriName",
"==",
"null",
"||",
"uriName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"new",
"DenyReply",
"(",
"\"Invalid URI passed to Security Collaborator.\"",
")",
";",
"}",
"if",
"(",
"unsupportedAuthMech",
"(",
")",
"==",
"true",
")",
"{",
"return",
"new",
"DenyReply",
"(",
"\"Authentication Failed : DIGEST not supported\"",
")",
";",
"}",
"if",
"(",
"wasch",
".",
"isSSLRequired",
"(",
"webRequest",
",",
"uriName",
")",
")",
"{",
"return",
"httpsRedirectHandler",
".",
"getHTTPSRedirectWebReply",
"(",
"req",
")",
";",
"}",
"webReply",
"=",
"unprotectedSpecialURI",
"(",
"webRequest",
",",
"uriName",
",",
"methodName",
")",
";",
"if",
"(",
"webReply",
"!=",
"null",
")",
"{",
"return",
"webReply",
";",
"}",
"webReply",
"=",
"unprotectedResource",
"(",
"webRequest",
")",
";",
"if",
"(",
"webReply",
"==",
"PERMIT_REPLY",
")",
"{",
"if",
"(",
"shouldWePerformTAIForUnProtectedURI",
"(",
"webRequest",
")",
")",
"return",
"null",
";",
"else",
"return",
"webReply",
";",
"}",
"return",
"null",
";",
"}"
] | Perform the preliminary checks to see if we should proceed to authentication
and authorization.
TODO: add authn/autz auditing for each of these cases
These checks are, in order:
<ol>
<li>when uriName is null or empty, then return Deny</li>
<li>if the challenge typs is DIGEST, then return Deny</li>
<li>if the required roles is specified but empty, then return Deny</li>
<li>if SSL is required but the request is not HTTPS, then return Redirect</li>
<li>if the method is TRACE and there are no required roles, then return Deny</li>
<li>if the security constraints in the dd are invalid, then return Deny</li>
<li>if there are no required roles, then return Permit</li>
<li>if Everyone is allowed, then return Permit</li>
</ol>
@param req the servlet request
@param uriName the uri name of the request
@return a WebReply if the request should be returned without authenticating/authorizing, otherwise null | [
"Perform",
"the",
"preliminary",
"checks",
"to",
"see",
"if",
"we",
"should",
"proceed",
"to",
"authentication",
"and",
"authorization",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L1302-L1333 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.unprotectedSpecialURI | private WebReply unprotectedSpecialURI(WebRequest webRequest, String uriName, String methodName) {
LoginConfiguration loginConfig = webRequest.getLoginConfig();
if (loginConfig == null)
return null;
String authenticationMethod = loginConfig.getAuthenticationMethod();
FormLoginConfiguration formLoginConfig = loginConfig.getFormLoginConfiguration();
if (formLoginConfig == null || authenticationMethod == null)
return null;
String loginPage = formLoginConfig.getLoginPage();
String errorPage = formLoginConfig.getErrorPage();
// We check to see if we are either a FORM or CLIENT_CERT auth method.
// These are the only valid auth methods supported (CLIENT_CERT can
// fail over to FORM).
if (isValidAuthMethodForFormLogin(authenticationMethod) && loginPage != null && errorPage != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, " We have a custom login or error page request, web app login URL:[" + loginPage
+ "], errorPage URL:[" + errorPage + "], and the requested URI:[" + uriName + "]");
}
if (loginPage.equals(uriName) || errorPage.equals(uriName)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "authorize, login or error page[" + uriName + "] requested, permit: ", PERMIT_REPLY);
return PERMIT_REPLY;
} else if ((uriName != null && uriName.equals("/j_security_check")) &&
(methodName != null && methodName.equals("POST"))) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "authorize, login or error page[" + uriName + "] requested, permit: ", PERMIT_REPLY);
return PERMIT_REPLY;
}
} else {
if (webRequest.getHttpServletRequest().getDispatcherType().equals(DispatcherType.ERROR)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "authorize, error page[" + uriName + "] requested, permit: ", PERMIT_REPLY);
return PERMIT_REPLY;
}
}
return null;
} | java | private WebReply unprotectedSpecialURI(WebRequest webRequest, String uriName, String methodName) {
LoginConfiguration loginConfig = webRequest.getLoginConfig();
if (loginConfig == null)
return null;
String authenticationMethod = loginConfig.getAuthenticationMethod();
FormLoginConfiguration formLoginConfig = loginConfig.getFormLoginConfiguration();
if (formLoginConfig == null || authenticationMethod == null)
return null;
String loginPage = formLoginConfig.getLoginPage();
String errorPage = formLoginConfig.getErrorPage();
// We check to see if we are either a FORM or CLIENT_CERT auth method.
// These are the only valid auth methods supported (CLIENT_CERT can
// fail over to FORM).
if (isValidAuthMethodForFormLogin(authenticationMethod) && loginPage != null && errorPage != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, " We have a custom login or error page request, web app login URL:[" + loginPage
+ "], errorPage URL:[" + errorPage + "], and the requested URI:[" + uriName + "]");
}
if (loginPage.equals(uriName) || errorPage.equals(uriName)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "authorize, login or error page[" + uriName + "] requested, permit: ", PERMIT_REPLY);
return PERMIT_REPLY;
} else if ((uriName != null && uriName.equals("/j_security_check")) &&
(methodName != null && methodName.equals("POST"))) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "authorize, login or error page[" + uriName + "] requested, permit: ", PERMIT_REPLY);
return PERMIT_REPLY;
}
} else {
if (webRequest.getHttpServletRequest().getDispatcherType().equals(DispatcherType.ERROR)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "authorize, error page[" + uriName + "] requested, permit: ", PERMIT_REPLY);
return PERMIT_REPLY;
}
}
return null;
} | [
"private",
"WebReply",
"unprotectedSpecialURI",
"(",
"WebRequest",
"webRequest",
",",
"String",
"uriName",
",",
"String",
"methodName",
")",
"{",
"LoginConfiguration",
"loginConfig",
"=",
"webRequest",
".",
"getLoginConfig",
"(",
")",
";",
"if",
"(",
"loginConfig",
"==",
"null",
")",
"return",
"null",
";",
"String",
"authenticationMethod",
"=",
"loginConfig",
".",
"getAuthenticationMethod",
"(",
")",
";",
"FormLoginConfiguration",
"formLoginConfig",
"=",
"loginConfig",
".",
"getFormLoginConfiguration",
"(",
")",
";",
"if",
"(",
"formLoginConfig",
"==",
"null",
"||",
"authenticationMethod",
"==",
"null",
")",
"return",
"null",
";",
"String",
"loginPage",
"=",
"formLoginConfig",
".",
"getLoginPage",
"(",
")",
";",
"String",
"errorPage",
"=",
"formLoginConfig",
".",
"getErrorPage",
"(",
")",
";",
"// We check to see if we are either a FORM or CLIENT_CERT auth method.",
"// These are the only valid auth methods supported (CLIENT_CERT can",
"// fail over to FORM).",
"if",
"(",
"isValidAuthMethodForFormLogin",
"(",
"authenticationMethod",
")",
"&&",
"loginPage",
"!=",
"null",
"&&",
"errorPage",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\" We have a custom login or error page request, web app login URL:[\"",
"+",
"loginPage",
"+",
"\"], errorPage URL:[\"",
"+",
"errorPage",
"+",
"\"], and the requested URI:[\"",
"+",
"uriName",
"+",
"\"]\"",
")",
";",
"}",
"if",
"(",
"loginPage",
".",
"equals",
"(",
"uriName",
")",
"||",
"errorPage",
".",
"equals",
"(",
"uriName",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"authorize, login or error page[\"",
"+",
"uriName",
"+",
"\"] requested, permit: \"",
",",
"PERMIT_REPLY",
")",
";",
"return",
"PERMIT_REPLY",
";",
"}",
"else",
"if",
"(",
"(",
"uriName",
"!=",
"null",
"&&",
"uriName",
".",
"equals",
"(",
"\"/j_security_check\"",
")",
")",
"&&",
"(",
"methodName",
"!=",
"null",
"&&",
"methodName",
".",
"equals",
"(",
"\"POST\"",
")",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"authorize, login or error page[\"",
"+",
"uriName",
"+",
"\"] requested, permit: \"",
",",
"PERMIT_REPLY",
")",
";",
"return",
"PERMIT_REPLY",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"webRequest",
".",
"getHttpServletRequest",
"(",
")",
".",
"getDispatcherType",
"(",
")",
".",
"equals",
"(",
"DispatcherType",
".",
"ERROR",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"authorize, error page[\"",
"+",
"uriName",
"+",
"\"] requested, permit: \"",
",",
"PERMIT_REPLY",
")",
";",
"return",
"PERMIT_REPLY",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Determines if the URI requested is "special" and should always be treated
as unprotected, such as the form login page.
@param webRequest
@param uriName
@param methodName
@return Non-null WebReply if the URI is not special, or a PERMIT_REPLY if it is. | [
"Determines",
"if",
"the",
"URI",
"requested",
"is",
"special",
"and",
"should",
"always",
"be",
"treated",
"as",
"unprotected",
"such",
"as",
"the",
"form",
"login",
"page",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L1429-L1468 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.isServletSpec31 | private boolean isServletSpec31() {
if (com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerSpecLevel() >= 31)
return true;
return false;
} | java | private boolean isServletSpec31() {
if (com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerSpecLevel() >= 31)
return true;
return false;
} | [
"private",
"boolean",
"isServletSpec31",
"(",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ws",
".",
"webcontainer",
".",
"osgi",
".",
"WebContainer",
".",
"getServletContainerSpecLevel",
"(",
")",
">=",
"31",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] | Check to see if running under servlet spec 3.1
@return true if using servlet spec 3.1 and false otherwise | [
"Check",
"to",
"see",
"if",
"running",
"under",
"servlet",
"spec",
"3",
".",
"1"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L1505-L1510 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.notifyWebAppSecurityConfigChangeListeners | private void notifyWebAppSecurityConfigChangeListeners(List<String> delta) {
WebAppSecurityConfigChangeEvent event = new WebAppSecurityConfigChangeEventImpl(delta);
for (WebAppSecurityConfigChangeListener listener : webAppSecurityConfigchangeListenerRef.services()) {
listener.notifyWebAppSecurityConfigChanged(event);
}
} | java | private void notifyWebAppSecurityConfigChangeListeners(List<String> delta) {
WebAppSecurityConfigChangeEvent event = new WebAppSecurityConfigChangeEventImpl(delta);
for (WebAppSecurityConfigChangeListener listener : webAppSecurityConfigchangeListenerRef.services()) {
listener.notifyWebAppSecurityConfigChanged(event);
}
} | [
"private",
"void",
"notifyWebAppSecurityConfigChangeListeners",
"(",
"List",
"<",
"String",
">",
"delta",
")",
"{",
"WebAppSecurityConfigChangeEvent",
"event",
"=",
"new",
"WebAppSecurityConfigChangeEventImpl",
"(",
"delta",
")",
";",
"for",
"(",
"WebAppSecurityConfigChangeListener",
"listener",
":",
"webAppSecurityConfigchangeListenerRef",
".",
"services",
"(",
")",
")",
"{",
"listener",
".",
"notifyWebAppSecurityConfigChanged",
"(",
"event",
")",
";",
"}",
"}"
] | Notify the registered listeners of the change to the UserRegistry
configuration. | [
"Notify",
"the",
"registered",
"listeners",
"of",
"the",
"change",
"to",
"the",
"UserRegistry",
"configuration",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L1659-L1664 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.toStringFormChangedPropertiesMap | private String toStringFormChangedPropertiesMap(Map<String, String> delta) {
if (delta == null || delta.isEmpty()) {
return "";
}
StringBuffer sb = new StringBuffer();
for (Map.Entry<String, String> entry : delta.entrySet()) {
if (sb.length() > 0) {
sb.append(",");
}
sb.append(entry.getKey()).append("=").append(entry.getValue());
}
return sb.toString();
} | java | private String toStringFormChangedPropertiesMap(Map<String, String> delta) {
if (delta == null || delta.isEmpty()) {
return "";
}
StringBuffer sb = new StringBuffer();
for (Map.Entry<String, String> entry : delta.entrySet()) {
if (sb.length() > 0) {
sb.append(",");
}
sb.append(entry.getKey()).append("=").append(entry.getValue());
}
return sb.toString();
} | [
"private",
"String",
"toStringFormChangedPropertiesMap",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"delta",
")",
"{",
"if",
"(",
"delta",
"==",
"null",
"||",
"delta",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"delta",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"sb",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"\",\"",
")",
";",
"}",
"sb",
".",
"append",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
".",
"append",
"(",
"\"=\"",
")",
".",
"append",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | Format the map of config change attributes for the audit function. The output format would be the
same as original WebAppSecurityConfig.getChangedProperties method.
@return String in the format of "name=value, name=value, ..." encapsulating the
properties that are different between this WebAppSecurityConfig and the specified one | [
"Format",
"the",
"map",
"of",
"config",
"change",
"attributes",
"for",
"the",
"audit",
"function",
".",
"The",
"output",
"format",
"would",
"be",
"the",
"same",
"as",
"original",
"WebAppSecurityConfig",
".",
"getChangedProperties",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L1673-L1685 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.logAuditEntriesBeforeAuthn | private void logAuditEntriesBeforeAuthn(WebReply webReply, Subject receivedSubject, String uriName, WebRequest webRequest) {
AuthenticationResult authResult;
if (webReply instanceof PermitReply) {
authResult = new AuthenticationResult(AuthResult.SUCCESS, receivedSubject, null, null, AuditEvent.OUTCOME_SUCCESS);
} else {
authResult = new AuthenticationResult(AuthResult.FAILURE, receivedSubject, null, null, AuditEvent.OUTCOME_FAILURE);
}
int statusCode = Integer.valueOf(webReply.getStatusCode());
Audit.audit(Audit.EventID.SECURITY_AUTHN_01, webRequest, authResult, statusCode);
Audit.audit(Audit.EventID.SECURITY_AUTHZ_01, webRequest, authResult, uriName, statusCode);
} | java | private void logAuditEntriesBeforeAuthn(WebReply webReply, Subject receivedSubject, String uriName, WebRequest webRequest) {
AuthenticationResult authResult;
if (webReply instanceof PermitReply) {
authResult = new AuthenticationResult(AuthResult.SUCCESS, receivedSubject, null, null, AuditEvent.OUTCOME_SUCCESS);
} else {
authResult = new AuthenticationResult(AuthResult.FAILURE, receivedSubject, null, null, AuditEvent.OUTCOME_FAILURE);
}
int statusCode = Integer.valueOf(webReply.getStatusCode());
Audit.audit(Audit.EventID.SECURITY_AUTHN_01, webRequest, authResult, statusCode);
Audit.audit(Audit.EventID.SECURITY_AUTHZ_01, webRequest, authResult, uriName, statusCode);
} | [
"private",
"void",
"logAuditEntriesBeforeAuthn",
"(",
"WebReply",
"webReply",
",",
"Subject",
"receivedSubject",
",",
"String",
"uriName",
",",
"WebRequest",
"webRequest",
")",
"{",
"AuthenticationResult",
"authResult",
";",
"if",
"(",
"webReply",
"instanceof",
"PermitReply",
")",
"{",
"authResult",
"=",
"new",
"AuthenticationResult",
"(",
"AuthResult",
".",
"SUCCESS",
",",
"receivedSubject",
",",
"null",
",",
"null",
",",
"AuditEvent",
".",
"OUTCOME_SUCCESS",
")",
";",
"}",
"else",
"{",
"authResult",
"=",
"new",
"AuthenticationResult",
"(",
"AuthResult",
".",
"FAILURE",
",",
"receivedSubject",
",",
"null",
",",
"null",
",",
"AuditEvent",
".",
"OUTCOME_FAILURE",
")",
";",
"}",
"int",
"statusCode",
"=",
"Integer",
".",
"valueOf",
"(",
"webReply",
".",
"getStatusCode",
"(",
")",
")",
";",
"Audit",
".",
"audit",
"(",
"Audit",
".",
"EventID",
".",
"SECURITY_AUTHN_01",
",",
"webRequest",
",",
"authResult",
",",
"statusCode",
")",
";",
"Audit",
".",
"audit",
"(",
"Audit",
".",
"EventID",
".",
"SECURITY_AUTHZ_01",
",",
"webRequest",
",",
"authResult",
",",
"uriName",
",",
"statusCode",
")",
";",
"}"
] | no null check for webReply object, so make sure it is not null upon calling this method. | [
"no",
"null",
"check",
"for",
"webReply",
"object",
"so",
"make",
"sure",
"it",
"is",
"not",
"null",
"upon",
"calling",
"this",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L1696-L1706 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/helpers/MBeanRoutedNotificationHelper.java | MBeanRoutedNotificationHelper.postRoutedNotificationListenerRegistrationEvent | private void postRoutedNotificationListenerRegistrationEvent(String operation, NotificationTargetInformation nti) {
Map<String, Object> props = createListenerRegistrationEvent(operation, nti);
safePostEvent(new Event(REGISTER_JMX_NOTIFICATION_LISTENER_TOPIC, props));
} | java | private void postRoutedNotificationListenerRegistrationEvent(String operation, NotificationTargetInformation nti) {
Map<String, Object> props = createListenerRegistrationEvent(operation, nti);
safePostEvent(new Event(REGISTER_JMX_NOTIFICATION_LISTENER_TOPIC, props));
} | [
"private",
"void",
"postRoutedNotificationListenerRegistrationEvent",
"(",
"String",
"operation",
",",
"NotificationTargetInformation",
"nti",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
"=",
"createListenerRegistrationEvent",
"(",
"operation",
",",
"nti",
")",
";",
"safePostEvent",
"(",
"new",
"Event",
"(",
"REGISTER_JMX_NOTIFICATION_LISTENER_TOPIC",
",",
"props",
")",
")",
";",
"}"
] | Post an event to EventAdmin, instructing the Target-Client Manager to register or unregister a listener for a given target. | [
"Post",
"an",
"event",
"to",
"EventAdmin",
"instructing",
"the",
"Target",
"-",
"Client",
"Manager",
"to",
"register",
"or",
"unregister",
"a",
"listener",
"for",
"a",
"given",
"target",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/helpers/MBeanRoutedNotificationHelper.java#L231-L234 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/helpers/MBeanRoutedNotificationHelper.java | MBeanRoutedNotificationHelper.postRoutedServerNotificationListenerRegistrationEvent | private void postRoutedServerNotificationListenerRegistrationEvent(String operation, NotificationTargetInformation nti, ObjectName listener,
NotificationFilter filter, Object handback) {
Map<String, Object> props = createServerListenerRegistrationEvent(operation, nti, listener, filter, handback);
safePostEvent(new Event(REGISTER_JMX_NOTIFICATION_LISTENER_TOPIC, props));
} | java | private void postRoutedServerNotificationListenerRegistrationEvent(String operation, NotificationTargetInformation nti, ObjectName listener,
NotificationFilter filter, Object handback) {
Map<String, Object> props = createServerListenerRegistrationEvent(operation, nti, listener, filter, handback);
safePostEvent(new Event(REGISTER_JMX_NOTIFICATION_LISTENER_TOPIC, props));
} | [
"private",
"void",
"postRoutedServerNotificationListenerRegistrationEvent",
"(",
"String",
"operation",
",",
"NotificationTargetInformation",
"nti",
",",
"ObjectName",
"listener",
",",
"NotificationFilter",
"filter",
",",
"Object",
"handback",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
"=",
"createServerListenerRegistrationEvent",
"(",
"operation",
",",
"nti",
",",
"listener",
",",
"filter",
",",
"handback",
")",
";",
"safePostEvent",
"(",
"new",
"Event",
"(",
"REGISTER_JMX_NOTIFICATION_LISTENER_TOPIC",
",",
"props",
")",
")",
";",
"}"
] | Post an event to EventAdmin, instructing the Target-Client Manager to register or unregister a listener MBean on a given target. | [
"Post",
"an",
"event",
"to",
"EventAdmin",
"instructing",
"the",
"Target",
"-",
"Client",
"Manager",
"to",
"register",
"or",
"unregister",
"a",
"listener",
"MBean",
"on",
"a",
"given",
"target",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/helpers/MBeanRoutedNotificationHelper.java#L257-L261 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/helpers/MBeanRoutedNotificationHelper.java | MBeanRoutedNotificationHelper.safePostEvent | private void safePostEvent(Event event) {
EventAdmin ea = eventAdminRef.getService();
if (ea != null) {
ea.postEvent(event);
} else if (tc.isEventEnabled()) {
Tr.event(tc, "The EventAdmin service is unavailable. Unable to post the Event: " + event);
}
} | java | private void safePostEvent(Event event) {
EventAdmin ea = eventAdminRef.getService();
if (ea != null) {
ea.postEvent(event);
} else if (tc.isEventEnabled()) {
Tr.event(tc, "The EventAdmin service is unavailable. Unable to post the Event: " + event);
}
} | [
"private",
"void",
"safePostEvent",
"(",
"Event",
"event",
")",
"{",
"EventAdmin",
"ea",
"=",
"eventAdminRef",
".",
"getService",
"(",
")",
";",
"if",
"(",
"ea",
"!=",
"null",
")",
"{",
"ea",
".",
"postEvent",
"(",
"event",
")",
";",
"}",
"else",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"The EventAdmin service is unavailable. Unable to post the Event: \"",
"+",
"event",
")",
";",
"}",
"}"
] | Null-safe event posting to eventAdminRef.
@param event | [
"Null",
"-",
"safe",
"event",
"posting",
"to",
"eventAdminRef",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/helpers/MBeanRoutedNotificationHelper.java#L301-L308 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/ute/UTEHelperImpl.java | UTEHelperImpl.enableDestinationCreation | public void enableDestinationCreation(SICoreConnectionFactory siccf)
{
if (tcInt.isEntryEnabled())
SibTr.entry(tcInt, "enableDestinationCreation");
try
{
if (admin == null)
{
if (tcInt.isDebugEnabled())
SibTr.debug(tcInt, "Setting up destination definition objects.");
// The same object implements the admin interface...
admin = ((SIMPAdmin)siccf).getAdministrator();
if (tcInt.isDebugEnabled())
SibTr.debug(tcInt, "DestinationDefinition objects complete");
}//if
} catch(Exception e)
{
// No FFDC code needed
if (tcInt.isDebugEnabled())
SibTr.debug(tcInt, "Exception enabling destination creation", e);
}//try
if (tcInt.isEntryEnabled())
SibTr.exit(tcInt, "enableDestinationCreation");
} | java | public void enableDestinationCreation(SICoreConnectionFactory siccf)
{
if (tcInt.isEntryEnabled())
SibTr.entry(tcInt, "enableDestinationCreation");
try
{
if (admin == null)
{
if (tcInt.isDebugEnabled())
SibTr.debug(tcInt, "Setting up destination definition objects.");
// The same object implements the admin interface...
admin = ((SIMPAdmin)siccf).getAdministrator();
if (tcInt.isDebugEnabled())
SibTr.debug(tcInt, "DestinationDefinition objects complete");
}//if
} catch(Exception e)
{
// No FFDC code needed
if (tcInt.isDebugEnabled())
SibTr.debug(tcInt, "Exception enabling destination creation", e);
}//try
if (tcInt.isEntryEnabled())
SibTr.exit(tcInt, "enableDestinationCreation");
} | [
"public",
"void",
"enableDestinationCreation",
"(",
"SICoreConnectionFactory",
"siccf",
")",
"{",
"if",
"(",
"tcInt",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tcInt",
",",
"\"enableDestinationCreation\"",
")",
";",
"try",
"{",
"if",
"(",
"admin",
"==",
"null",
")",
"{",
"if",
"(",
"tcInt",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tcInt",
",",
"\"Setting up destination definition objects.\"",
")",
";",
"// The same object implements the admin interface... ",
"admin",
"=",
"(",
"(",
"SIMPAdmin",
")",
"siccf",
")",
".",
"getAdministrator",
"(",
")",
";",
"if",
"(",
"tcInt",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tcInt",
",",
"\"DestinationDefinition objects complete\"",
")",
";",
"}",
"//if",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// No FFDC code needed",
"if",
"(",
"tcInt",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tcInt",
",",
"\"Exception enabling destination creation\"",
",",
"e",
")",
";",
"}",
"//try",
"if",
"(",
"tcInt",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tcInt",
",",
"\"enableDestinationCreation\"",
")",
";",
"}"
] | This method sets up the destination definitions. It is called | [
"This",
"method",
"sets",
"up",
"the",
"destination",
"definitions",
".",
"It",
"is",
"called"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/ute/UTEHelperImpl.java#L330-L360 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/ute/UTEHelperImpl.java | UTEHelperImpl.createDestination | private void createDestination(String name,
com.ibm.wsspi.sib.core.DestinationType destType,
Reliability defaultReliability)
throws JMSException
{
if (tcInt.isEntryEnabled())
SibTr.entry(tcInt, "createDestination(String, DestinationType)");
if (tcInt.isDebugEnabled())
{
SibTr.debug(tcInt, "name: "+name);
SibTr.debug(tcInt, "type: "+destType);
}
try
{
try
{
// Obtain information about the destination from the core connection.
SIDestinationAddress sida = JmsServiceFacade.getSIDestinationAddressFactory().createSIDestinationAddress(name, null);
DestinationConfiguration dc = coreConnection.getDestinationConfiguration(sida);
// If the Destination exists, then recreate it.
if (dc != null)
{
String uuid = dc.getUUID();
if (tcInt.isDebugEnabled()) SibTr.debug(tcInt, "delete UUID: "+uuid);
// The destination has been found, so delete it.
admin.deleteDestinationLocalization(uuid, null);
} else
{
if (tcInt.isDebugEnabled())
SibTr.debug(tcInt, "No object was returned from getDestinationConfiguration");
}
} catch(SINotPossibleInCurrentConfigurationException f)
{
// No FFDC code needed
// This is OK. No action required.
}
//lohith liberty change
com.ibm.ws.sib.admin.DestinationDefinition adminDDF = null ; //JsAdminFactory.getInstance(.createDestinationDefinition(destType, name);
adminDDF.setMaxReliability(Reliability.ASSURED_PERSISTENT);
adminDDF.setDefaultReliability(defaultReliability);
// Set the default exception destination
String excDestinationName = SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION+getMEName();
adminDDF.setExceptionDestination(excDestinationName);
//lohith liberty change
LocalizationDefinition dloc = null; // JsAdminFactory.getInstance().createLocalizationDefinition(name);
// Make sure the max message count is outside the range used by the tests.
dloc.setDestinationHighMsgs(30000);
//lohith liberty change
admin.createDestinationLocalization(adminDDF, dloc ); //, null, null, null, null);
} catch (Exception se)
{
// No FFDC code needed
if (tcInt.isDebugEnabled())
SibTr.debug(tcInt, "Exception creating", se);
// NB. No need to NLS this because it is only for unit test.
JMSException jmse =
new JMSException("Exception received creating destination");
jmse.setLinkedException(se);
jmse.initCause(se);
if (tcInt.isEntryEnabled())
SibTr.exit(tcInt, "createDestination(String, DestinationDefinition)");
throw jmse;
}
if (tcInt.isEntryEnabled())
SibTr.exit(tcInt, "createDestination(String, DestinationDefinition)");
} | java | private void createDestination(String name,
com.ibm.wsspi.sib.core.DestinationType destType,
Reliability defaultReliability)
throws JMSException
{
if (tcInt.isEntryEnabled())
SibTr.entry(tcInt, "createDestination(String, DestinationType)");
if (tcInt.isDebugEnabled())
{
SibTr.debug(tcInt, "name: "+name);
SibTr.debug(tcInt, "type: "+destType);
}
try
{
try
{
// Obtain information about the destination from the core connection.
SIDestinationAddress sida = JmsServiceFacade.getSIDestinationAddressFactory().createSIDestinationAddress(name, null);
DestinationConfiguration dc = coreConnection.getDestinationConfiguration(sida);
// If the Destination exists, then recreate it.
if (dc != null)
{
String uuid = dc.getUUID();
if (tcInt.isDebugEnabled()) SibTr.debug(tcInt, "delete UUID: "+uuid);
// The destination has been found, so delete it.
admin.deleteDestinationLocalization(uuid, null);
} else
{
if (tcInt.isDebugEnabled())
SibTr.debug(tcInt, "No object was returned from getDestinationConfiguration");
}
} catch(SINotPossibleInCurrentConfigurationException f)
{
// No FFDC code needed
// This is OK. No action required.
}
//lohith liberty change
com.ibm.ws.sib.admin.DestinationDefinition adminDDF = null ; //JsAdminFactory.getInstance(.createDestinationDefinition(destType, name);
adminDDF.setMaxReliability(Reliability.ASSURED_PERSISTENT);
adminDDF.setDefaultReliability(defaultReliability);
// Set the default exception destination
String excDestinationName = SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION+getMEName();
adminDDF.setExceptionDestination(excDestinationName);
//lohith liberty change
LocalizationDefinition dloc = null; // JsAdminFactory.getInstance().createLocalizationDefinition(name);
// Make sure the max message count is outside the range used by the tests.
dloc.setDestinationHighMsgs(30000);
//lohith liberty change
admin.createDestinationLocalization(adminDDF, dloc ); //, null, null, null, null);
} catch (Exception se)
{
// No FFDC code needed
if (tcInt.isDebugEnabled())
SibTr.debug(tcInt, "Exception creating", se);
// NB. No need to NLS this because it is only for unit test.
JMSException jmse =
new JMSException("Exception received creating destination");
jmse.setLinkedException(se);
jmse.initCause(se);
if (tcInt.isEntryEnabled())
SibTr.exit(tcInt, "createDestination(String, DestinationDefinition)");
throw jmse;
}
if (tcInt.isEntryEnabled())
SibTr.exit(tcInt, "createDestination(String, DestinationDefinition)");
} | [
"private",
"void",
"createDestination",
"(",
"String",
"name",
",",
"com",
".",
"ibm",
".",
"wsspi",
".",
"sib",
".",
"core",
".",
"DestinationType",
"destType",
",",
"Reliability",
"defaultReliability",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"tcInt",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tcInt",
",",
"\"createDestination(String, DestinationType)\"",
")",
";",
"if",
"(",
"tcInt",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tcInt",
",",
"\"name: \"",
"+",
"name",
")",
";",
"SibTr",
".",
"debug",
"(",
"tcInt",
",",
"\"type: \"",
"+",
"destType",
")",
";",
"}",
"try",
"{",
"try",
"{",
"// Obtain information about the destination from the core connection.",
"SIDestinationAddress",
"sida",
"=",
"JmsServiceFacade",
".",
"getSIDestinationAddressFactory",
"(",
")",
".",
"createSIDestinationAddress",
"(",
"name",
",",
"null",
")",
";",
"DestinationConfiguration",
"dc",
"=",
"coreConnection",
".",
"getDestinationConfiguration",
"(",
"sida",
")",
";",
"// If the Destination exists, then recreate it. ",
"if",
"(",
"dc",
"!=",
"null",
")",
"{",
"String",
"uuid",
"=",
"dc",
".",
"getUUID",
"(",
")",
";",
"if",
"(",
"tcInt",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tcInt",
",",
"\"delete UUID: \"",
"+",
"uuid",
")",
";",
"// The destination has been found, so delete it.",
"admin",
".",
"deleteDestinationLocalization",
"(",
"uuid",
",",
"null",
")",
";",
"}",
"else",
"{",
"if",
"(",
"tcInt",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tcInt",
",",
"\"No object was returned from getDestinationConfiguration\"",
")",
";",
"}",
"}",
"catch",
"(",
"SINotPossibleInCurrentConfigurationException",
"f",
")",
"{",
"// No FFDC code needed",
"// This is OK. No action required.",
"}",
"//lohith liberty change",
"com",
".",
"ibm",
".",
"ws",
".",
"sib",
".",
"admin",
".",
"DestinationDefinition",
"adminDDF",
"=",
"null",
";",
"//JsAdminFactory.getInstance(.createDestinationDefinition(destType, name); ",
"adminDDF",
".",
"setMaxReliability",
"(",
"Reliability",
".",
"ASSURED_PERSISTENT",
")",
";",
"adminDDF",
".",
"setDefaultReliability",
"(",
"defaultReliability",
")",
";",
"// Set the default exception destination",
"String",
"excDestinationName",
"=",
"SIMPConstants",
".",
"SYSTEM_DEFAULT_EXCEPTION_DESTINATION",
"+",
"getMEName",
"(",
")",
";",
"adminDDF",
".",
"setExceptionDestination",
"(",
"excDestinationName",
")",
";",
"//lohith liberty change",
"LocalizationDefinition",
"dloc",
"=",
"null",
";",
"// JsAdminFactory.getInstance().createLocalizationDefinition(name);",
"// Make sure the max message count is outside the range used by the tests.",
"dloc",
".",
"setDestinationHighMsgs",
"(",
"30000",
")",
";",
"//lohith liberty change",
"admin",
".",
"createDestinationLocalization",
"(",
"adminDDF",
",",
"dloc",
")",
";",
"//, null, null, null, null);",
"}",
"catch",
"(",
"Exception",
"se",
")",
"{",
"// No FFDC code needed",
"if",
"(",
"tcInt",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tcInt",
",",
"\"Exception creating\"",
",",
"se",
")",
";",
"// NB. No need to NLS this because it is only for unit test.",
"JMSException",
"jmse",
"=",
"new",
"JMSException",
"(",
"\"Exception received creating destination\"",
")",
";",
"jmse",
".",
"setLinkedException",
"(",
"se",
")",
";",
"jmse",
".",
"initCause",
"(",
"se",
")",
";",
"if",
"(",
"tcInt",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tcInt",
",",
"\"createDestination(String, DestinationDefinition)\"",
")",
";",
"throw",
"jmse",
";",
"}",
"if",
"(",
"tcInt",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tcInt",
",",
"\"createDestination(String, DestinationDefinition)\"",
")",
";",
"}"
] | Internal method to do the creation given a name a ddf. | [
"Internal",
"method",
"to",
"do",
"the",
"creation",
"given",
"a",
"name",
"a",
"ddf",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/ute/UTEHelperImpl.java#L365-L451 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStore.java | LdapIdentityStore.bind | private DirContext bind(String bindDn, ProtectedString bindPw) throws NamingException {
Hashtable<Object, Object> env = new Hashtable<Object, Object>();
String url = this.idStoreDefinition.getUrl();
if (url == null || url.isEmpty()) {
throw new IllegalArgumentException("No URL was provided to the LdapIdentityStore.");
}
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, url);
boolean sslEnabled = url != null && url.startsWith("ldaps");
if (sslEnabled) {
env.put("java.naming.ldap.factory.socket", "com.ibm.ws.ssl.protocol.LibertySSLSocketFactory");
env.put(Context.SECURITY_PROTOCOL, "ssl");
}
/*
* Add credentials.
*/
if (bindDn != null && !bindDn.isEmpty() && bindPw != null) {
/*
* Support encoded passwords.
*/
String decodedBindPw = PasswordUtil.passwordDecode(new String(bindPw.getChars()).trim());
if (decodedBindPw == null || decodedBindPw.isEmpty()) {
throw new IllegalArgumentException("An empty password is invalid.");
}
env.put(Context.SECURITY_PRINCIPAL, bindDn);
env.put(Context.SECURITY_CREDENTIALS, decodedBindPw);
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JNDI_CALL bind", new Object[] { bindDn, url });
}
return getDirContext(env);
} | java | private DirContext bind(String bindDn, ProtectedString bindPw) throws NamingException {
Hashtable<Object, Object> env = new Hashtable<Object, Object>();
String url = this.idStoreDefinition.getUrl();
if (url == null || url.isEmpty()) {
throw new IllegalArgumentException("No URL was provided to the LdapIdentityStore.");
}
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, url);
boolean sslEnabled = url != null && url.startsWith("ldaps");
if (sslEnabled) {
env.put("java.naming.ldap.factory.socket", "com.ibm.ws.ssl.protocol.LibertySSLSocketFactory");
env.put(Context.SECURITY_PROTOCOL, "ssl");
}
/*
* Add credentials.
*/
if (bindDn != null && !bindDn.isEmpty() && bindPw != null) {
/*
* Support encoded passwords.
*/
String decodedBindPw = PasswordUtil.passwordDecode(new String(bindPw.getChars()).trim());
if (decodedBindPw == null || decodedBindPw.isEmpty()) {
throw new IllegalArgumentException("An empty password is invalid.");
}
env.put(Context.SECURITY_PRINCIPAL, bindDn);
env.put(Context.SECURITY_CREDENTIALS, decodedBindPw);
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JNDI_CALL bind", new Object[] { bindDn, url });
}
return getDirContext(env);
} | [
"private",
"DirContext",
"bind",
"(",
"String",
"bindDn",
",",
"ProtectedString",
"bindPw",
")",
"throws",
"NamingException",
"{",
"Hashtable",
"<",
"Object",
",",
"Object",
">",
"env",
"=",
"new",
"Hashtable",
"<",
"Object",
",",
"Object",
">",
"(",
")",
";",
"String",
"url",
"=",
"this",
".",
"idStoreDefinition",
".",
"getUrl",
"(",
")",
";",
"if",
"(",
"url",
"==",
"null",
"||",
"url",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"No URL was provided to the LdapIdentityStore.\"",
")",
";",
"}",
"env",
".",
"put",
"(",
"Context",
".",
"INITIAL_CONTEXT_FACTORY",
",",
"\"com.sun.jndi.ldap.LdapCtxFactory\"",
")",
";",
"env",
".",
"put",
"(",
"Context",
".",
"PROVIDER_URL",
",",
"url",
")",
";",
"boolean",
"sslEnabled",
"=",
"url",
"!=",
"null",
"&&",
"url",
".",
"startsWith",
"(",
"\"ldaps\"",
")",
";",
"if",
"(",
"sslEnabled",
")",
"{",
"env",
".",
"put",
"(",
"\"java.naming.ldap.factory.socket\"",
",",
"\"com.ibm.ws.ssl.protocol.LibertySSLSocketFactory\"",
")",
";",
"env",
".",
"put",
"(",
"Context",
".",
"SECURITY_PROTOCOL",
",",
"\"ssl\"",
")",
";",
"}",
"/*\n * Add credentials.\n */",
"if",
"(",
"bindDn",
"!=",
"null",
"&&",
"!",
"bindDn",
".",
"isEmpty",
"(",
")",
"&&",
"bindPw",
"!=",
"null",
")",
"{",
"/*\n * Support encoded passwords.\n */",
"String",
"decodedBindPw",
"=",
"PasswordUtil",
".",
"passwordDecode",
"(",
"new",
"String",
"(",
"bindPw",
".",
"getChars",
"(",
")",
")",
".",
"trim",
"(",
")",
")",
";",
"if",
"(",
"decodedBindPw",
"==",
"null",
"||",
"decodedBindPw",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"An empty password is invalid.\"",
")",
";",
"}",
"env",
".",
"put",
"(",
"Context",
".",
"SECURITY_PRINCIPAL",
",",
"bindDn",
")",
";",
"env",
".",
"put",
"(",
"Context",
".",
"SECURITY_CREDENTIALS",
",",
"decodedBindPw",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"JNDI_CALL bind\"",
",",
"new",
"Object",
"[",
"]",
"{",
"bindDn",
",",
"url",
"}",
")",
";",
"}",
"return",
"getDirContext",
"(",
"env",
")",
";",
"}"
] | Bind to the LDAP server.
@param bindDn The distinguished name used to bind to the LDAP server.
@param bindPw The password used to bind to the LDAP server.
@return The bound {@link DirContext}.
@throws NamingException If there was a failure to bind to the LDAP server. | [
"Bind",
"to",
"the",
"LDAP",
"server",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStore.java#L88-L125 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStore.java | LdapIdentityStore.getGroups | private Set<String> getGroups(DirContext context, String callerDn) {
Set<String> groups = null;
String groupSearchBase = idStoreDefinition.getGroupSearchBase();
String groupSearchFilter = idStoreDefinition.getGroupSearchFilter();
if (groupSearchBase.isEmpty() || groupSearchFilter.isEmpty()) {
groups = getGroupsByMembership(context, callerDn);
} else {
groups = getGroupsByMember(context, callerDn, groupSearchBase, groupSearchFilter);
}
return groups;
} | java | private Set<String> getGroups(DirContext context, String callerDn) {
Set<String> groups = null;
String groupSearchBase = idStoreDefinition.getGroupSearchBase();
String groupSearchFilter = idStoreDefinition.getGroupSearchFilter();
if (groupSearchBase.isEmpty() || groupSearchFilter.isEmpty()) {
groups = getGroupsByMembership(context, callerDn);
} else {
groups = getGroupsByMember(context, callerDn, groupSearchBase, groupSearchFilter);
}
return groups;
} | [
"private",
"Set",
"<",
"String",
">",
"getGroups",
"(",
"DirContext",
"context",
",",
"String",
"callerDn",
")",
"{",
"Set",
"<",
"String",
">",
"groups",
"=",
"null",
";",
"String",
"groupSearchBase",
"=",
"idStoreDefinition",
".",
"getGroupSearchBase",
"(",
")",
";",
"String",
"groupSearchFilter",
"=",
"idStoreDefinition",
".",
"getGroupSearchFilter",
"(",
")",
";",
"if",
"(",
"groupSearchBase",
".",
"isEmpty",
"(",
")",
"||",
"groupSearchFilter",
".",
"isEmpty",
"(",
")",
")",
"{",
"groups",
"=",
"getGroupsByMembership",
"(",
"context",
",",
"callerDn",
")",
";",
"}",
"else",
"{",
"groups",
"=",
"getGroupsByMember",
"(",
"context",
",",
"callerDn",
",",
"groupSearchBase",
",",
"groupSearchFilter",
")",
";",
"}",
"return",
"groups",
";",
"}"
] | Get the groups for the caller
@param context The {@link DirContext} to use when performing the search.
@param callerDn The caller's distinguished name.
@return The set of groups the caller is a member of. | [
"Get",
"the",
"groups",
"for",
"the",
"caller"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStore.java#L332-L342 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStore.java | LdapIdentityStore.getGroupsByMember | private Set<String> getGroupsByMember(DirContext context, String callerDn, String groupSearchBase, String groupSearchFilter) {
String groupNameAttribute = idStoreDefinition.getGroupNameAttribute();
String[] attrIds = { groupNameAttribute };
long limit = Long.valueOf(idStoreDefinition.getMaxResults());
int timeOut = idStoreDefinition.getReadTimeout();
int scope = getSearchScope(idStoreDefinition.getGroupSearchScope());
SearchControls controls = new SearchControls(scope, limit, timeOut, attrIds, false, false);
String filter = getFormattedFilter(groupSearchFilter, callerDn, idStoreDefinition.getGroupMemberAttribute());
Set<String> groupNames = new HashSet<String>();
try {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JNDI_CALL search", new Object[] { groupSearchBase, filter, printControls(controls) });
}
NamingEnumeration<SearchResult> ne = context.search(new LdapName(groupSearchBase), filter, controls);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Iterate through the search results");
}
while (ne.hasMoreElements()) {
SearchResult sr = ne.nextElement();
String groupDn = sr.getNameInNamespace();
if (groupNameAttribute.equalsIgnoreCase("dn")) {
groupNames.add(groupDn);
} else {
Attribute groupNameAttr = sr.getAttributes().get(groupNameAttribute);
if (groupNameAttr == null) {
Tr.warning(tc, "JAVAEESEC_WARNING_MISSING_GROUP_ATTR", new Object[] { groupDn, groupNameAttribute });
continue;
}
NamingEnumeration<?> ne2 = groupNameAttr.getAll();
if (ne2.hasMoreElements()) {
groupNames.add((String) ne2.nextElement());
}
}
}
} catch (NamingException e) {
Tr.error(tc, "JAVAEESEC_ERROR_EXCEPTION_ON_GROUP_SEARCH", new Object[] { callerDn, e });
throw new IllegalStateException(e);
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, "getGroupsByMember", groupNames);
}
return groupNames;
} | java | private Set<String> getGroupsByMember(DirContext context, String callerDn, String groupSearchBase, String groupSearchFilter) {
String groupNameAttribute = idStoreDefinition.getGroupNameAttribute();
String[] attrIds = { groupNameAttribute };
long limit = Long.valueOf(idStoreDefinition.getMaxResults());
int timeOut = idStoreDefinition.getReadTimeout();
int scope = getSearchScope(idStoreDefinition.getGroupSearchScope());
SearchControls controls = new SearchControls(scope, limit, timeOut, attrIds, false, false);
String filter = getFormattedFilter(groupSearchFilter, callerDn, idStoreDefinition.getGroupMemberAttribute());
Set<String> groupNames = new HashSet<String>();
try {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JNDI_CALL search", new Object[] { groupSearchBase, filter, printControls(controls) });
}
NamingEnumeration<SearchResult> ne = context.search(new LdapName(groupSearchBase), filter, controls);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Iterate through the search results");
}
while (ne.hasMoreElements()) {
SearchResult sr = ne.nextElement();
String groupDn = sr.getNameInNamespace();
if (groupNameAttribute.equalsIgnoreCase("dn")) {
groupNames.add(groupDn);
} else {
Attribute groupNameAttr = sr.getAttributes().get(groupNameAttribute);
if (groupNameAttr == null) {
Tr.warning(tc, "JAVAEESEC_WARNING_MISSING_GROUP_ATTR", new Object[] { groupDn, groupNameAttribute });
continue;
}
NamingEnumeration<?> ne2 = groupNameAttr.getAll();
if (ne2.hasMoreElements()) {
groupNames.add((String) ne2.nextElement());
}
}
}
} catch (NamingException e) {
Tr.error(tc, "JAVAEESEC_ERROR_EXCEPTION_ON_GROUP_SEARCH", new Object[] { callerDn, e });
throw new IllegalStateException(e);
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, "getGroupsByMember", groupNames);
}
return groupNames;
} | [
"private",
"Set",
"<",
"String",
">",
"getGroupsByMember",
"(",
"DirContext",
"context",
",",
"String",
"callerDn",
",",
"String",
"groupSearchBase",
",",
"String",
"groupSearchFilter",
")",
"{",
"String",
"groupNameAttribute",
"=",
"idStoreDefinition",
".",
"getGroupNameAttribute",
"(",
")",
";",
"String",
"[",
"]",
"attrIds",
"=",
"{",
"groupNameAttribute",
"}",
";",
"long",
"limit",
"=",
"Long",
".",
"valueOf",
"(",
"idStoreDefinition",
".",
"getMaxResults",
"(",
")",
")",
";",
"int",
"timeOut",
"=",
"idStoreDefinition",
".",
"getReadTimeout",
"(",
")",
";",
"int",
"scope",
"=",
"getSearchScope",
"(",
"idStoreDefinition",
".",
"getGroupSearchScope",
"(",
")",
")",
";",
"SearchControls",
"controls",
"=",
"new",
"SearchControls",
"(",
"scope",
",",
"limit",
",",
"timeOut",
",",
"attrIds",
",",
"false",
",",
"false",
")",
";",
"String",
"filter",
"=",
"getFormattedFilter",
"(",
"groupSearchFilter",
",",
"callerDn",
",",
"idStoreDefinition",
".",
"getGroupMemberAttribute",
"(",
")",
")",
";",
"Set",
"<",
"String",
">",
"groupNames",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"try",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"JNDI_CALL search\"",
",",
"new",
"Object",
"[",
"]",
"{",
"groupSearchBase",
",",
"filter",
",",
"printControls",
"(",
"controls",
")",
"}",
")",
";",
"}",
"NamingEnumeration",
"<",
"SearchResult",
">",
"ne",
"=",
"context",
".",
"search",
"(",
"new",
"LdapName",
"(",
"groupSearchBase",
")",
",",
"filter",
",",
"controls",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Iterate through the search results\"",
")",
";",
"}",
"while",
"(",
"ne",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"SearchResult",
"sr",
"=",
"ne",
".",
"nextElement",
"(",
")",
";",
"String",
"groupDn",
"=",
"sr",
".",
"getNameInNamespace",
"(",
")",
";",
"if",
"(",
"groupNameAttribute",
".",
"equalsIgnoreCase",
"(",
"\"dn\"",
")",
")",
"{",
"groupNames",
".",
"add",
"(",
"groupDn",
")",
";",
"}",
"else",
"{",
"Attribute",
"groupNameAttr",
"=",
"sr",
".",
"getAttributes",
"(",
")",
".",
"get",
"(",
"groupNameAttribute",
")",
";",
"if",
"(",
"groupNameAttr",
"==",
"null",
")",
"{",
"Tr",
".",
"warning",
"(",
"tc",
",",
"\"JAVAEESEC_WARNING_MISSING_GROUP_ATTR\"",
",",
"new",
"Object",
"[",
"]",
"{",
"groupDn",
",",
"groupNameAttribute",
"}",
")",
";",
"continue",
";",
"}",
"NamingEnumeration",
"<",
"?",
">",
"ne2",
"=",
"groupNameAttr",
".",
"getAll",
"(",
")",
";",
"if",
"(",
"ne2",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"groupNames",
".",
"add",
"(",
"(",
"String",
")",
"ne2",
".",
"nextElement",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"JAVAEESEC_ERROR_EXCEPTION_ON_GROUP_SEARCH\"",
",",
"new",
"Object",
"[",
"]",
"{",
"callerDn",
",",
"e",
"}",
")",
";",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getGroupsByMember\"",
",",
"groupNames",
")",
";",
"}",
"return",
"groupNames",
";",
"}"
] | Get the groups for the caller by using a member-style attribute found on group LDAP entities.
@param context The {@link DirContext} to use when performing the search.
@param callerDn The caller's distinguished name.
@param groupSearchFilter The filter to use when searching for groups
@param groupSearchBase The base of the tree to start the group search from
@return The set of groups the caller is a member of. | [
"Get",
"the",
"groups",
"for",
"the",
"caller",
"by",
"using",
"a",
"member",
"-",
"style",
"attribute",
"found",
"on",
"group",
"LDAP",
"entities",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStore.java#L353-L404 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStore.java | LdapIdentityStore.getFormattedFilter | private String getFormattedFilter(String searchFilter, String caller, String attribute) {
//Allow %v in addition to %s for string replacement
String filter = searchFilter.replaceAll("%v", "%s");
if (!(filter.startsWith("(") && filter.endsWith(")")) && !filter.isEmpty()) {
filter = "(" + filter + ")";
}
if (filter.contains("%s")) {
filter = String.format(filter, caller);
} else {
filter = "(&" + filter + "(" + attribute + "=" + caller + "))";
}
return filter;
} | java | private String getFormattedFilter(String searchFilter, String caller, String attribute) {
//Allow %v in addition to %s for string replacement
String filter = searchFilter.replaceAll("%v", "%s");
if (!(filter.startsWith("(") && filter.endsWith(")")) && !filter.isEmpty()) {
filter = "(" + filter + ")";
}
if (filter.contains("%s")) {
filter = String.format(filter, caller);
} else {
filter = "(&" + filter + "(" + attribute + "=" + caller + "))";
}
return filter;
} | [
"private",
"String",
"getFormattedFilter",
"(",
"String",
"searchFilter",
",",
"String",
"caller",
",",
"String",
"attribute",
")",
"{",
"//Allow %v in addition to %s for string replacement",
"String",
"filter",
"=",
"searchFilter",
".",
"replaceAll",
"(",
"\"%v\"",
",",
"\"%s\"",
")",
";",
"if",
"(",
"!",
"(",
"filter",
".",
"startsWith",
"(",
"\"(\"",
")",
"&&",
"filter",
".",
"endsWith",
"(",
"\")\"",
")",
")",
"&&",
"!",
"filter",
".",
"isEmpty",
"(",
")",
")",
"{",
"filter",
"=",
"\"(\"",
"+",
"filter",
"+",
"\")\"",
";",
"}",
"if",
"(",
"filter",
".",
"contains",
"(",
"\"%s\"",
")",
")",
"{",
"filter",
"=",
"String",
".",
"format",
"(",
"filter",
",",
"caller",
")",
";",
"}",
"else",
"{",
"filter",
"=",
"\"(&\"",
"+",
"filter",
"+",
"\"(\"",
"+",
"attribute",
"+",
"\"=\"",
"+",
"caller",
"+",
"\"))\"",
";",
"}",
"return",
"filter",
";",
"}"
] | Format the callerSearchFilter or groupSearchFilter. We need to check for String substitution.
If a substitution is needed, use the result as is. Otherwise, construct the remainder of the
filter using the name attribute of the group or caller.
@param searchFilter The filter set in LdapIdentityStore
@param caller The name of the caller whose groups or DN we are searching for
@param attribute The attribute to use when forming the filter
@return The new filter after string replacements or constructing the filter | [
"Format",
"the",
"callerSearchFilter",
"or",
"groupSearchFilter",
".",
"We",
"need",
"to",
"check",
"for",
"String",
"substitution",
".",
"If",
"a",
"substitution",
"is",
"needed",
"use",
"the",
"result",
"as",
"is",
".",
"Otherwise",
"construct",
"the",
"remainder",
"of",
"the",
"filter",
"using",
"the",
"name",
"attribute",
"of",
"the",
"group",
"or",
"caller",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStore.java#L416-L428 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStore.java | LdapIdentityStore.getGroupsByMembership | private Set<String> getGroupsByMembership(DirContext context, String callerDn) {
String memberOfAttribute = idStoreDefinition.getGroupMemberOfAttribute();
String groupNameAttribute = idStoreDefinition.getGroupNameAttribute();
Attributes attrs;
Set<String> groupDns = new HashSet<String>();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JNDI_CALL getAttributes", new Object[] { callerDn, memberOfAttribute });
}
try {
attrs = context.getAttributes(callerDn, new String[] { memberOfAttribute });
Attribute groupSet = attrs.get(memberOfAttribute);
if (groupSet != null) {
NamingEnumeration<?> ne = groupSet.getAll();
while (ne.hasMoreElements()) {
groupDns.add((String) ne.nextElement());
}
}
} catch (NamingException e) {
Tr.warning(tc, "JAVAEESEC_WARNING_EXCEPTION_ON_GETATTRIBUTES", new Object[] { callerDn, memberOfAttribute, e });
}
if (groupNameAttribute.equalsIgnoreCase("dn")) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "getGroupsByMembership", groupDns);
}
return groupDns;
}
Set<String> groupNames = new HashSet<String>();
String groupDn = null;
Iterator<String> it = groupDns.iterator();
try {
while (it.hasNext()) {
groupDn = it.next();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JNDI_CALL getAttributes", new Object[] { groupDn, groupNameAttribute });
}
Attributes groupNameAttrs = context.getAttributes(groupDn, new String[] { groupNameAttribute });
Attribute groupNameAttr = groupNameAttrs.get(groupNameAttribute);
if (groupNameAttr == null) {
Tr.warning(tc, "JAVAEESEC_WARNING_MISSING_GROUP_ATTR", new Object[] { groupDn, groupNameAttribute });
continue;
}
NamingEnumeration<?> ne = groupNameAttr.getAll();
if (ne.hasMoreElements()) {
groupNames.add((String) ne.nextElement());
}
}
} catch (NamingException e) {
Tr.warning(tc, "JAVAEESEC_WARNING_EXCEPTION_ON_GETATTRIBUTES", new Object[] { groupDn, groupNameAttribute, e });
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, "getGroupsByMembership", groupNames);
}
return groupNames;
} | java | private Set<String> getGroupsByMembership(DirContext context, String callerDn) {
String memberOfAttribute = idStoreDefinition.getGroupMemberOfAttribute();
String groupNameAttribute = idStoreDefinition.getGroupNameAttribute();
Attributes attrs;
Set<String> groupDns = new HashSet<String>();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JNDI_CALL getAttributes", new Object[] { callerDn, memberOfAttribute });
}
try {
attrs = context.getAttributes(callerDn, new String[] { memberOfAttribute });
Attribute groupSet = attrs.get(memberOfAttribute);
if (groupSet != null) {
NamingEnumeration<?> ne = groupSet.getAll();
while (ne.hasMoreElements()) {
groupDns.add((String) ne.nextElement());
}
}
} catch (NamingException e) {
Tr.warning(tc, "JAVAEESEC_WARNING_EXCEPTION_ON_GETATTRIBUTES", new Object[] { callerDn, memberOfAttribute, e });
}
if (groupNameAttribute.equalsIgnoreCase("dn")) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "getGroupsByMembership", groupDns);
}
return groupDns;
}
Set<String> groupNames = new HashSet<String>();
String groupDn = null;
Iterator<String> it = groupDns.iterator();
try {
while (it.hasNext()) {
groupDn = it.next();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JNDI_CALL getAttributes", new Object[] { groupDn, groupNameAttribute });
}
Attributes groupNameAttrs = context.getAttributes(groupDn, new String[] { groupNameAttribute });
Attribute groupNameAttr = groupNameAttrs.get(groupNameAttribute);
if (groupNameAttr == null) {
Tr.warning(tc, "JAVAEESEC_WARNING_MISSING_GROUP_ATTR", new Object[] { groupDn, groupNameAttribute });
continue;
}
NamingEnumeration<?> ne = groupNameAttr.getAll();
if (ne.hasMoreElements()) {
groupNames.add((String) ne.nextElement());
}
}
} catch (NamingException e) {
Tr.warning(tc, "JAVAEESEC_WARNING_EXCEPTION_ON_GETATTRIBUTES", new Object[] { groupDn, groupNameAttribute, e });
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, "getGroupsByMembership", groupNames);
}
return groupNames;
} | [
"private",
"Set",
"<",
"String",
">",
"getGroupsByMembership",
"(",
"DirContext",
"context",
",",
"String",
"callerDn",
")",
"{",
"String",
"memberOfAttribute",
"=",
"idStoreDefinition",
".",
"getGroupMemberOfAttribute",
"(",
")",
";",
"String",
"groupNameAttribute",
"=",
"idStoreDefinition",
".",
"getGroupNameAttribute",
"(",
")",
";",
"Attributes",
"attrs",
";",
"Set",
"<",
"String",
">",
"groupDns",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"JNDI_CALL getAttributes\"",
",",
"new",
"Object",
"[",
"]",
"{",
"callerDn",
",",
"memberOfAttribute",
"}",
")",
";",
"}",
"try",
"{",
"attrs",
"=",
"context",
".",
"getAttributes",
"(",
"callerDn",
",",
"new",
"String",
"[",
"]",
"{",
"memberOfAttribute",
"}",
")",
";",
"Attribute",
"groupSet",
"=",
"attrs",
".",
"get",
"(",
"memberOfAttribute",
")",
";",
"if",
"(",
"groupSet",
"!=",
"null",
")",
"{",
"NamingEnumeration",
"<",
"?",
">",
"ne",
"=",
"groupSet",
".",
"getAll",
"(",
")",
";",
"while",
"(",
"ne",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"groupDns",
".",
"add",
"(",
"(",
"String",
")",
"ne",
".",
"nextElement",
"(",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"Tr",
".",
"warning",
"(",
"tc",
",",
"\"JAVAEESEC_WARNING_EXCEPTION_ON_GETATTRIBUTES\"",
",",
"new",
"Object",
"[",
"]",
"{",
"callerDn",
",",
"memberOfAttribute",
",",
"e",
"}",
")",
";",
"}",
"if",
"(",
"groupNameAttribute",
".",
"equalsIgnoreCase",
"(",
"\"dn\"",
")",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getGroupsByMembership\"",
",",
"groupDns",
")",
";",
"}",
"return",
"groupDns",
";",
"}",
"Set",
"<",
"String",
">",
"groupNames",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"String",
"groupDn",
"=",
"null",
";",
"Iterator",
"<",
"String",
">",
"it",
"=",
"groupDns",
".",
"iterator",
"(",
")",
";",
"try",
"{",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"groupDn",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"JNDI_CALL getAttributes\"",
",",
"new",
"Object",
"[",
"]",
"{",
"groupDn",
",",
"groupNameAttribute",
"}",
")",
";",
"}",
"Attributes",
"groupNameAttrs",
"=",
"context",
".",
"getAttributes",
"(",
"groupDn",
",",
"new",
"String",
"[",
"]",
"{",
"groupNameAttribute",
"}",
")",
";",
"Attribute",
"groupNameAttr",
"=",
"groupNameAttrs",
".",
"get",
"(",
"groupNameAttribute",
")",
";",
"if",
"(",
"groupNameAttr",
"==",
"null",
")",
"{",
"Tr",
".",
"warning",
"(",
"tc",
",",
"\"JAVAEESEC_WARNING_MISSING_GROUP_ATTR\"",
",",
"new",
"Object",
"[",
"]",
"{",
"groupDn",
",",
"groupNameAttribute",
"}",
")",
";",
"continue",
";",
"}",
"NamingEnumeration",
"<",
"?",
">",
"ne",
"=",
"groupNameAttr",
".",
"getAll",
"(",
")",
";",
"if",
"(",
"ne",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"groupNames",
".",
"add",
"(",
"(",
"String",
")",
"ne",
".",
"nextElement",
"(",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"Tr",
".",
"warning",
"(",
"tc",
",",
"\"JAVAEESEC_WARNING_EXCEPTION_ON_GETATTRIBUTES\"",
",",
"new",
"Object",
"[",
"]",
"{",
"groupDn",
",",
"groupNameAttribute",
",",
"e",
"}",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getGroupsByMembership\"",
",",
"groupNames",
")",
";",
"}",
"return",
"groupNames",
";",
"}"
] | Get the groups for the caller by using the memberOf-style attribute found on user LDAP entities.
@param context The {@link DirContext} to use when performing the search.
@param callerDn The caller's distinguished name.
@return The set of groups the caller is a member of. | [
"Get",
"the",
"groups",
"for",
"the",
"caller",
"by",
"using",
"the",
"memberOf",
"-",
"style",
"attribute",
"found",
"on",
"user",
"LDAP",
"entities",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStore.java#L437-L494 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.beanvalidation.core/src/com/ibm/ws/beanvalidation/ValidatorFactoryObjectFactory.java | ValidatorFactoryObjectFactory.getValidatorFactory | @Deprecated
public static ValidatorFactory getValidatorFactory()
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getValidatorFactory");
ValidatorFactory validatorFactory = AbstractBeanValidation.getValidatorFactory();
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getValidatorFactory: " + Util.identity(validatorFactory));
return validatorFactory;
} | java | @Deprecated
public static ValidatorFactory getValidatorFactory()
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getValidatorFactory");
ValidatorFactory validatorFactory = AbstractBeanValidation.getValidatorFactory();
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getValidatorFactory: " + Util.identity(validatorFactory));
return validatorFactory;
} | [
"@",
"Deprecated",
"public",
"static",
"ValidatorFactory",
"getValidatorFactory",
"(",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getValidatorFactory\"",
")",
";",
"ValidatorFactory",
"validatorFactory",
"=",
"AbstractBeanValidation",
".",
"getValidatorFactory",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getValidatorFactory: \"",
"+",
"Util",
".",
"identity",
"(",
"validatorFactory",
")",
")",
";",
"return",
"validatorFactory",
";",
"}"
] | This method will return null if no BeanValidationService is available in the process
@deprecated Use {@link BeanValidation#getValidatorFactory} instead | [
"This",
"method",
"will",
"return",
"null",
"if",
"no",
"BeanValidationService",
"is",
"available",
"in",
"the",
"process"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.beanvalidation.core/src/com/ibm/ws/beanvalidation/ValidatorFactoryObjectFactory.java#L51-L64 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ras/SibMessage.java | TrListener.message | public void message(MessageType type, String me, TraceComponent tc, String msgKey, Object objs, Object[] formattedMessage)
{
switch(type)
{
case AUDIT : if (TraceComponent.isAnyTracingEnabled() && myTc.isAuditEnabled()) Tr.audit(myTc, SIB_MESSAGE, formattedMessage);
break;
case ERROR : Tr.error(myTc, SIB_MESSAGE, formattedMessage);
break;
case FATAL : Tr.fatal(myTc, SIB_MESSAGE, formattedMessage);
break;
case INFO : Tr.info(myTc, SIB_MESSAGE, formattedMessage);
break;
case WARNING: Tr.warning(myTc, SIB_MESSAGE, formattedMessage);
break;
}
} | java | public void message(MessageType type, String me, TraceComponent tc, String msgKey, Object objs, Object[] formattedMessage)
{
switch(type)
{
case AUDIT : if (TraceComponent.isAnyTracingEnabled() && myTc.isAuditEnabled()) Tr.audit(myTc, SIB_MESSAGE, formattedMessage);
break;
case ERROR : Tr.error(myTc, SIB_MESSAGE, formattedMessage);
break;
case FATAL : Tr.fatal(myTc, SIB_MESSAGE, formattedMessage);
break;
case INFO : Tr.info(myTc, SIB_MESSAGE, formattedMessage);
break;
case WARNING: Tr.warning(myTc, SIB_MESSAGE, formattedMessage);
break;
}
} | [
"public",
"void",
"message",
"(",
"MessageType",
"type",
",",
"String",
"me",
",",
"TraceComponent",
"tc",
",",
"String",
"msgKey",
",",
"Object",
"objs",
",",
"Object",
"[",
"]",
"formattedMessage",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"AUDIT",
":",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"myTc",
".",
"isAuditEnabled",
"(",
")",
")",
"Tr",
".",
"audit",
"(",
"myTc",
",",
"SIB_MESSAGE",
",",
"formattedMessage",
")",
";",
"break",
";",
"case",
"ERROR",
":",
"Tr",
".",
"error",
"(",
"myTc",
",",
"SIB_MESSAGE",
",",
"formattedMessage",
")",
";",
"break",
";",
"case",
"FATAL",
":",
"Tr",
".",
"fatal",
"(",
"myTc",
",",
"SIB_MESSAGE",
",",
"formattedMessage",
")",
";",
"break",
";",
"case",
"INFO",
":",
"Tr",
".",
"info",
"(",
"myTc",
",",
"SIB_MESSAGE",
",",
"formattedMessage",
")",
";",
"break",
";",
"case",
"WARNING",
":",
"Tr",
".",
"warning",
"(",
"myTc",
",",
"SIB_MESSAGE",
",",
"formattedMessage",
")",
";",
"break",
";",
"}",
"}"
] | The method called to indicate that a message is being generated by SibMessage
@param type The type of the event
@param me The messaging engine (if any) generating the message
@param tc The trace component generating the message
@param msgKey The message key of the message being generated
@param objs The inserts of the message being generated
@param formattedMessage A formatted version of the message being generated | [
"The",
"method",
"called",
"to",
"indicate",
"that",
"a",
"message",
"is",
"being",
"generated",
"by",
"SibMessage"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ras/SibMessage.java#L94-L109 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/boot/templates/ProbeProxy.java | ProbeProxy.fireProbe | public final static void fireProbe(long probeId, Object instance, Object target, Object args) {
// Load statics onto the stack to avoid a window where they can be cleared
// between the test for null and the invocation of the method
Object proxyTarget = fireProbeTarget;
Method method = fireProbeMethod;
if (proxyTarget == null || method == null) {
return;
}
try {
method.invoke(proxyTarget, probeId, instance, target, args);
} catch (Throwable t) {
t.printStackTrace();
}
} | java | public final static void fireProbe(long probeId, Object instance, Object target, Object args) {
// Load statics onto the stack to avoid a window where they can be cleared
// between the test for null and the invocation of the method
Object proxyTarget = fireProbeTarget;
Method method = fireProbeMethod;
if (proxyTarget == null || method == null) {
return;
}
try {
method.invoke(proxyTarget, probeId, instance, target, args);
} catch (Throwable t) {
t.printStackTrace();
}
} | [
"public",
"final",
"static",
"void",
"fireProbe",
"(",
"long",
"probeId",
",",
"Object",
"instance",
",",
"Object",
"target",
",",
"Object",
"args",
")",
"{",
"// Load statics onto the stack to avoid a window where they can be cleared",
"// between the test for null and the invocation of the method",
"Object",
"proxyTarget",
"=",
"fireProbeTarget",
";",
"Method",
"method",
"=",
"fireProbeMethod",
";",
"if",
"(",
"proxyTarget",
"==",
"null",
"||",
"method",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"method",
".",
"invoke",
"(",
"proxyTarget",
",",
"probeId",
",",
"instance",
",",
"target",
",",
"args",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"t",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | Fire a probe event to the registered target.
@param probeId the generated probe identifier
@param instance the object instance emitting the probe or null
@param args the probe payload | [
"Fire",
"a",
"probe",
"event",
"to",
"the",
"registered",
"target",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/boot/templates/ProbeProxy.java#L51-L64 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ShortIdAllocator.java | ShortIdAllocator.releaseId | public synchronized void releaseId(short id) throws IdAllocatorException
{
if (tc.isEntryEnabled()) SibTr.entry(tc, "releaseId", ""+id);
deallocate(id);
// If we are releasing the id 1 less than the next id, set the next id to this one
if (id == (nextId - 1))
{
nextId = id;
// Ensure the next free id is not this as well
if (nextId == lastFreeId)
{
lastFreeId = NULL_ID;
}
}
// Otherwise save this id away so we can allocate it quickly
else
{
lastFreeId = id;
}
if (tc.isEntryEnabled()) SibTr.exit(tc, "releaseId");
} | java | public synchronized void releaseId(short id) throws IdAllocatorException
{
if (tc.isEntryEnabled()) SibTr.entry(tc, "releaseId", ""+id);
deallocate(id);
// If we are releasing the id 1 less than the next id, set the next id to this one
if (id == (nextId - 1))
{
nextId = id;
// Ensure the next free id is not this as well
if (nextId == lastFreeId)
{
lastFreeId = NULL_ID;
}
}
// Otherwise save this id away so we can allocate it quickly
else
{
lastFreeId = id;
}
if (tc.isEntryEnabled()) SibTr.exit(tc, "releaseId");
} | [
"public",
"synchronized",
"void",
"releaseId",
"(",
"short",
"id",
")",
"throws",
"IdAllocatorException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"releaseId\"",
",",
"\"\"",
"+",
"id",
")",
";",
"deallocate",
"(",
"id",
")",
";",
"// If we are releasing the id 1 less than the next id, set the next id to this one",
"if",
"(",
"id",
"==",
"(",
"nextId",
"-",
"1",
")",
")",
"{",
"nextId",
"=",
"id",
";",
"// Ensure the next free id is not this as well",
"if",
"(",
"nextId",
"==",
"lastFreeId",
")",
"{",
"lastFreeId",
"=",
"NULL_ID",
";",
"}",
"}",
"// Otherwise save this id away so we can allocate it quickly",
"else",
"{",
"lastFreeId",
"=",
"id",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"releaseId\"",
")",
";",
"}"
] | Releases an ID, making it available to be allocated once more.
@param id The ID to release.
@throws IdAllocatorException Thrown if ID was not allocated
in the first place. | [
"Releases",
"an",
"ID",
"making",
"it",
"available",
"to",
"be",
"allocated",
"once",
"more",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ShortIdAllocator.java#L250-L273 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.3/src/javax/faces/convert/EnumConverter.java | EnumConverter.firstConstantOfEnum | private String firstConstantOfEnum()
{
Object[] enumConstants = targetClass.getEnumConstants();
if (enumConstants.length != 0)
{
return enumConstants[0].toString();
}
return ""; // if empty Enum
} | java | private String firstConstantOfEnum()
{
Object[] enumConstants = targetClass.getEnumConstants();
if (enumConstants.length != 0)
{
return enumConstants[0].toString();
}
return ""; // if empty Enum
} | [
"private",
"String",
"firstConstantOfEnum",
"(",
")",
"{",
"Object",
"[",
"]",
"enumConstants",
"=",
"targetClass",
".",
"getEnumConstants",
"(",
")",
";",
"if",
"(",
"enumConstants",
".",
"length",
"!=",
"0",
")",
"{",
"return",
"enumConstants",
"[",
"0",
"]",
".",
"toString",
"(",
")",
";",
"}",
"return",
"\"\"",
";",
"// if empty Enum",
"}"
] | find the first constant value of the targetClass and return as a String | [
"find",
"the",
"first",
"constant",
"value",
"of",
"the",
"targetClass",
"and",
"return",
"as",
"a",
"String"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.3/src/javax/faces/convert/EnumConverter.java#L151-L161 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventEngineImpl.java | EventEngineImpl.checkTopicPublishPermission | void checkTopicPublishPermission(String topic) {
SecurityManager sm = System.getSecurityManager();
if (sm == null)
return;
sm.checkPermission(new TopicPermission(topic, PUBLISH));
} | java | void checkTopicPublishPermission(String topic) {
SecurityManager sm = System.getSecurityManager();
if (sm == null)
return;
sm.checkPermission(new TopicPermission(topic, PUBLISH));
} | [
"void",
"checkTopicPublishPermission",
"(",
"String",
"topic",
")",
"{",
"SecurityManager",
"sm",
"=",
"System",
".",
"getSecurityManager",
"(",
")",
";",
"if",
"(",
"sm",
"==",
"null",
")",
"return",
";",
"sm",
".",
"checkPermission",
"(",
"new",
"TopicPermission",
"(",
"topic",
",",
"PUBLISH",
")",
")",
";",
"}"
] | Check if the caller has permission to publish events to the specified
topic.
@param topic
the topic the event is being published to | [
"Check",
"if",
"the",
"caller",
"has",
"permission",
"to",
"publish",
"events",
"to",
"the",
"specified",
"topic",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventEngineImpl.java#L323-L329 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventEngineImpl.java | EventEngineImpl.activate | @Activate
protected void activate(ComponentContext componentContext, Map<String, Object> props) {
this.componentContext = componentContext;
// // Parse the configuration that we've been provided
// Dictionary<?, ?> configProperties = componentContext.getProperties();
// processConfigProperties(configProperties);
// Hold a reference to the bundle context
bundleContext = componentContext.getBundleContext();
// Start listening to the framework events so we can publish them
// as specified in section 113.6.3
frameworkEventAdapter = new FrameworkEventAdapter(this);
bundleContext.addFrameworkListener(frameworkEventAdapter);
// Start listening to the bundle events so we can publish them
// as specified in section 113.6.4
bundleEventAdapter = new BundleEventAdapter(this);
bundleContext.addBundleListener(bundleEventAdapter);
// Start listening to the service events so we can publish them
// as specified in section 113.6.5
serviceEventAdapter = new ServiceEventAdapter(this);
bundleContext.addServiceListener(serviceEventAdapter);
processConfigProperties(props);
} | java | @Activate
protected void activate(ComponentContext componentContext, Map<String, Object> props) {
this.componentContext = componentContext;
// // Parse the configuration that we've been provided
// Dictionary<?, ?> configProperties = componentContext.getProperties();
// processConfigProperties(configProperties);
// Hold a reference to the bundle context
bundleContext = componentContext.getBundleContext();
// Start listening to the framework events so we can publish them
// as specified in section 113.6.3
frameworkEventAdapter = new FrameworkEventAdapter(this);
bundleContext.addFrameworkListener(frameworkEventAdapter);
// Start listening to the bundle events so we can publish them
// as specified in section 113.6.4
bundleEventAdapter = new BundleEventAdapter(this);
bundleContext.addBundleListener(bundleEventAdapter);
// Start listening to the service events so we can publish them
// as specified in section 113.6.5
serviceEventAdapter = new ServiceEventAdapter(this);
bundleContext.addServiceListener(serviceEventAdapter);
processConfigProperties(props);
} | [
"@",
"Activate",
"protected",
"void",
"activate",
"(",
"ComponentContext",
"componentContext",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
")",
"{",
"this",
".",
"componentContext",
"=",
"componentContext",
";",
"// // Parse the configuration that we've been provided",
"// Dictionary<?, ?> configProperties = componentContext.getProperties();",
"// processConfigProperties(configProperties);",
"// Hold a reference to the bundle context",
"bundleContext",
"=",
"componentContext",
".",
"getBundleContext",
"(",
")",
";",
"// Start listening to the framework events so we can publish them",
"// as specified in section 113.6.3",
"frameworkEventAdapter",
"=",
"new",
"FrameworkEventAdapter",
"(",
"this",
")",
";",
"bundleContext",
".",
"addFrameworkListener",
"(",
"frameworkEventAdapter",
")",
";",
"// Start listening to the bundle events so we can publish them",
"// as specified in section 113.6.4",
"bundleEventAdapter",
"=",
"new",
"BundleEventAdapter",
"(",
"this",
")",
";",
"bundleContext",
".",
"addBundleListener",
"(",
"bundleEventAdapter",
")",
";",
"// Start listening to the service events so we can publish them",
"// as specified in section 113.6.5",
"serviceEventAdapter",
"=",
"new",
"ServiceEventAdapter",
"(",
"this",
")",
";",
"bundleContext",
".",
"addServiceListener",
"(",
"serviceEventAdapter",
")",
";",
"processConfigProperties",
"(",
"props",
")",
";",
"}"
] | Activate the EventEngine implementation. This method will be called by
OSGi Declarative Services implementation when the component is initially
activated and when changes to our configuration have occurred.
@param componentContext
the OSGi DS context | [
"Activate",
"the",
"EventEngine",
"implementation",
".",
"This",
"method",
"will",
"be",
"called",
"by",
"OSGi",
"Declarative",
"Services",
"implementation",
"when",
"the",
"component",
"is",
"initially",
"activated",
"and",
"when",
"changes",
"to",
"our",
"configuration",
"have",
"occurred",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventEngineImpl.java#L339-L365 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventEngineImpl.java | EventEngineImpl.deactivate | @Deactivate
protected void deactivate(ComponentContext componentContext) {
// Remove the framework event adapter
bundleContext.removeFrameworkListener(frameworkEventAdapter);
frameworkEventAdapter = null;
// Remove the bundle event adapter
bundleContext.removeBundleListener(bundleEventAdapter);
bundleEventAdapter = null;
// Remove the service event adapter
bundleContext.removeServiceListener(serviceEventAdapter);
serviceEventAdapter = null;
bundleContext = null;
this.componentContext = null;
} | java | @Deactivate
protected void deactivate(ComponentContext componentContext) {
// Remove the framework event adapter
bundleContext.removeFrameworkListener(frameworkEventAdapter);
frameworkEventAdapter = null;
// Remove the bundle event adapter
bundleContext.removeBundleListener(bundleEventAdapter);
bundleEventAdapter = null;
// Remove the service event adapter
bundleContext.removeServiceListener(serviceEventAdapter);
serviceEventAdapter = null;
bundleContext = null;
this.componentContext = null;
} | [
"@",
"Deactivate",
"protected",
"void",
"deactivate",
"(",
"ComponentContext",
"componentContext",
")",
"{",
"// Remove the framework event adapter",
"bundleContext",
".",
"removeFrameworkListener",
"(",
"frameworkEventAdapter",
")",
";",
"frameworkEventAdapter",
"=",
"null",
";",
"// Remove the bundle event adapter",
"bundleContext",
".",
"removeBundleListener",
"(",
"bundleEventAdapter",
")",
";",
"bundleEventAdapter",
"=",
"null",
";",
"// Remove the service event adapter",
"bundleContext",
".",
"removeServiceListener",
"(",
"serviceEventAdapter",
")",
";",
"serviceEventAdapter",
"=",
"null",
";",
"bundleContext",
"=",
"null",
";",
"this",
".",
"componentContext",
"=",
"null",
";",
"}"
] | Deactivate the EventAdmin service. This method will be called by the
OSGi Declarative Services implementation when the component is
deactivated. Deactivation will occur when the service configuration
needs to be refreshed, when the bundle is stopped, or when the DS
implementation is stopped.
@param componentContext | [
"Deactivate",
"the",
"EventAdmin",
"service",
".",
"This",
"method",
"will",
"be",
"called",
"by",
"the",
"OSGi",
"Declarative",
"Services",
"implementation",
"when",
"the",
"component",
"is",
"deactivated",
".",
"Deactivation",
"will",
"occur",
"when",
"the",
"service",
"configuration",
"needs",
"to",
"be",
"refreshed",
"when",
"the",
"bundle",
"is",
"stopped",
"or",
"when",
"the",
"DS",
"implementation",
"is",
"stopped",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventEngineImpl.java#L381-L397 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubOutputHandler.java | PubSubOutputHandler.addTopic | public void addTopic(String topic)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addTopic", topic);
SelectionCriteria criteria = _messageProcessor.
getSelectionCriteriaFactory().
createSelectionCriteria(topic,
null,
SelectorDomain.SIMESSAGE);
if (_subscriptionState == null)
{
_subscriptionState =
new ConsumerDispatcherState(_destinationHandler.getUuid(), criteria, _destName, _busName);
}
else
_subscriptionState.addSelectionCriteria(criteria);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addTopic");
} | java | public void addTopic(String topic)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addTopic", topic);
SelectionCriteria criteria = _messageProcessor.
getSelectionCriteriaFactory().
createSelectionCriteria(topic,
null,
SelectorDomain.SIMESSAGE);
if (_subscriptionState == null)
{
_subscriptionState =
new ConsumerDispatcherState(_destinationHandler.getUuid(), criteria, _destName, _busName);
}
else
_subscriptionState.addSelectionCriteria(criteria);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addTopic");
} | [
"public",
"void",
"addTopic",
"(",
"String",
"topic",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"addTopic\"",
",",
"topic",
")",
";",
"SelectionCriteria",
"criteria",
"=",
"_messageProcessor",
".",
"getSelectionCriteriaFactory",
"(",
")",
".",
"createSelectionCriteria",
"(",
"topic",
",",
"null",
",",
"SelectorDomain",
".",
"SIMESSAGE",
")",
";",
"if",
"(",
"_subscriptionState",
"==",
"null",
")",
"{",
"_subscriptionState",
"=",
"new",
"ConsumerDispatcherState",
"(",
"_destinationHandler",
".",
"getUuid",
"(",
")",
",",
"criteria",
",",
"_destName",
",",
"_busName",
")",
";",
"}",
"else",
"_subscriptionState",
".",
"addSelectionCriteria",
"(",
"criteria",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"addTopic\"",
")",
";",
"}"
] | Adds a topic to the subscription state for this OutputHandler.
@param topic The name of the topic | [
"Adds",
"a",
"topic",
"to",
"the",
"subscription",
"state",
"for",
"this",
"OutputHandler",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubOutputHandler.java#L228-L249 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubOutputHandler.java | PubSubOutputHandler.removeTopic | public void removeTopic(String topic)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeTopic", topic);
if (_subscriptionState == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "removeTopic", "Topic not found");
}
else
_subscriptionState.removeTopic(topic);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeTopic");
} | java | public void removeTopic(String topic)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeTopic", topic);
if (_subscriptionState == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "removeTopic", "Topic not found");
}
else
_subscriptionState.removeTopic(topic);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeTopic");
} | [
"public",
"void",
"removeTopic",
"(",
"String",
"topic",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"removeTopic\"",
",",
"topic",
")",
";",
"if",
"(",
"_subscriptionState",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"removeTopic\"",
",",
"\"Topic not found\"",
")",
";",
"}",
"else",
"_subscriptionState",
".",
"removeTopic",
"(",
"topic",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"removeTopic\"",
")",
";",
"}"
] | Removes a topic from the set of topics with this OutputHandler | [
"Removes",
"a",
"topic",
"from",
"the",
"set",
"of",
"topics",
"with",
"this",
"OutputHandler"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubOutputHandler.java#L254-L269 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubOutputHandler.java | PubSubOutputHandler.getTopics | public String[] getTopics()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getTopics");
String[] topics = null;
if (_subscriptionState != null)
topics = _subscriptionState.getTopics();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getTopics", topics);
return topics;
} | java | public String[] getTopics()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getTopics");
String[] topics = null;
if (_subscriptionState != null)
topics = _subscriptionState.getTopics();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getTopics", topics);
return topics;
} | [
"public",
"String",
"[",
"]",
"getTopics",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getTopics\"",
")",
";",
"String",
"[",
"]",
"topics",
"=",
"null",
";",
"if",
"(",
"_subscriptionState",
"!=",
"null",
")",
"topics",
"=",
"_subscriptionState",
".",
"getTopics",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getTopics\"",
",",
"topics",
")",
";",
"return",
"topics",
";",
"}"
] | Get the set of topics associated with this OutputHandler | [
"Get",
"the",
"set",
"of",
"topics",
"associated",
"with",
"this",
"OutputHandler"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubOutputHandler.java#L274-L286 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubOutputHandler.java | PubSubOutputHandler.getTopicSpaceUuid | public SIBUuid12 getTopicSpaceUuid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getTopicSpaceUuid");
SIBUuid12 retval = _destinationHandler.getUuid();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getTopicSpaceUuid", retval);
return retval;
} | java | public SIBUuid12 getTopicSpaceUuid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getTopicSpaceUuid");
SIBUuid12 retval = _destinationHandler.getUuid();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getTopicSpaceUuid", retval);
return retval;
} | [
"public",
"SIBUuid12",
"getTopicSpaceUuid",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getTopicSpaceUuid\"",
")",
";",
"SIBUuid12",
"retval",
"=",
"_destinationHandler",
".",
"getUuid",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getTopicSpaceUuid\"",
",",
"retval",
")",
";",
"return",
"retval",
";",
"}"
] | Get the topic space name associated with this OutputHandler | [
"Get",
"the",
"topic",
"space",
"name",
"associated",
"with",
"this",
"OutputHandler"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubOutputHandler.java#L291-L299 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubOutputHandler.java | PubSubOutputHandler.processAckExpected | void processAckExpected(
long ackExpStamp,
int priority,
Reliability reliability,
SIBUuid12 stream)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "processAckExpected", new Long(ackExpStamp));
_internalOutputStreamManager.processAckExpected(ackExpStamp, priority, reliability, stream);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processAckExpected");
} | java | void processAckExpected(
long ackExpStamp,
int priority,
Reliability reliability,
SIBUuid12 stream)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "processAckExpected", new Long(ackExpStamp));
_internalOutputStreamManager.processAckExpected(ackExpStamp, priority, reliability, stream);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processAckExpected");
} | [
"void",
"processAckExpected",
"(",
"long",
"ackExpStamp",
",",
"int",
"priority",
",",
"Reliability",
"reliability",
",",
"SIBUuid12",
"stream",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"processAckExpected\"",
",",
"new",
"Long",
"(",
"ackExpStamp",
")",
")",
";",
"_internalOutputStreamManager",
".",
"processAckExpected",
"(",
"ackExpStamp",
",",
"priority",
",",
"reliability",
",",
"stream",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"processAckExpected\"",
")",
";",
"}"
] | needs to be forwarded downstream. | [
"needs",
"to",
"be",
"forwarded",
"downstream",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubOutputHandler.java#L530-L544 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.