repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java | ParserBase.processLAandLI | protected void processLAandLI(File archive, RepositoryResourceWritable resource,
Manifest manifest) throws RepositoryException, IOException {
Attributes attribs = manifest.getMainAttributes();
String LAHeader = attribs.getValue(LA_HEADER_PRODUCT);
String LIHeader = attribs.getValue(LI_HEADER_PRODUCT);
processLAandLI(archive, resource, LAHeader, LIHeader);
} | java | protected void processLAandLI(File archive, RepositoryResourceWritable resource,
Manifest manifest) throws RepositoryException, IOException {
Attributes attribs = manifest.getMainAttributes();
String LAHeader = attribs.getValue(LA_HEADER_PRODUCT);
String LIHeader = attribs.getValue(LI_HEADER_PRODUCT);
processLAandLI(archive, resource, LAHeader, LIHeader);
} | [
"protected",
"void",
"processLAandLI",
"(",
"File",
"archive",
",",
"RepositoryResourceWritable",
"resource",
",",
"Manifest",
"manifest",
")",
"throws",
"RepositoryException",
",",
"IOException",
"{",
"Attributes",
"attribs",
"=",
"manifest",
".",
"getMainAttributes",
"(",
")",
";",
"String",
"LAHeader",
"=",
"attribs",
".",
"getValue",
"(",
"LA_HEADER_PRODUCT",
")",
";",
"String",
"LIHeader",
"=",
"attribs",
".",
"getValue",
"(",
"LI_HEADER_PRODUCT",
")",
";",
"processLAandLI",
"(",
"archive",
",",
"resource",
",",
"LAHeader",
",",
"LIHeader",
")",
";",
"}"
] | Locate and process license agreement and information files within a jar
@param esa
@param resource
@throws IOException | [
"Locate",
"and",
"process",
"license",
"agreement",
"and",
"information",
"files",
"within",
"a",
"jar"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java#L527-L533 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java | ParserBase.getRequiresFeature | public List<String> getRequiresFeature(ArtifactMetadata amd) {
// Now check we have non-null input. I would like to check for valid
// features
// but as these may be user created I cannot find any way to do this so
// it
// is important there are no typos in the requires feature list TODO ?
List<String> requiresFeature = new ArrayList<String>();
String requiresFeatureProp = amd.getProperty(PROP_REQUIRE_FEATURE);
if (requiresFeatureProp == null) {
return null;
}
if (requiresFeatureProp.equals("")) {
return requiresFeature;
} else {
String[] features = requiresFeatureProp.split("\\,");
for (String feature : features) {
requiresFeature.add(feature.trim());
}
return requiresFeature;
}
} | java | public List<String> getRequiresFeature(ArtifactMetadata amd) {
// Now check we have non-null input. I would like to check for valid
// features
// but as these may be user created I cannot find any way to do this so
// it
// is important there are no typos in the requires feature list TODO ?
List<String> requiresFeature = new ArrayList<String>();
String requiresFeatureProp = amd.getProperty(PROP_REQUIRE_FEATURE);
if (requiresFeatureProp == null) {
return null;
}
if (requiresFeatureProp.equals("")) {
return requiresFeature;
} else {
String[] features = requiresFeatureProp.split("\\,");
for (String feature : features) {
requiresFeature.add(feature.trim());
}
return requiresFeature;
}
} | [
"public",
"List",
"<",
"String",
">",
"getRequiresFeature",
"(",
"ArtifactMetadata",
"amd",
")",
"{",
"// Now check we have non-null input. I would like to check for valid",
"// features",
"// but as these may be user created I cannot find any way to do this so",
"// it",
"// is important there are no typos in the requires feature list TODO ?",
"List",
"<",
"String",
">",
"requiresFeature",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"String",
"requiresFeatureProp",
"=",
"amd",
".",
"getProperty",
"(",
"PROP_REQUIRE_FEATURE",
")",
";",
"if",
"(",
"requiresFeatureProp",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"requiresFeatureProp",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"return",
"requiresFeature",
";",
"}",
"else",
"{",
"String",
"[",
"]",
"features",
"=",
"requiresFeatureProp",
".",
"split",
"(",
"\"\\\\,\"",
")",
";",
"for",
"(",
"String",
"feature",
":",
"features",
")",
"{",
"requiresFeature",
".",
"add",
"(",
"feature",
".",
"trim",
"(",
")",
")",
";",
"}",
"return",
"requiresFeature",
";",
"}",
"}"
] | Take the require.feature comma separated list and return a List of the
entries
@return List - the required features | [
"Take",
"the",
"require",
".",
"feature",
"comma",
"separated",
"list",
"and",
"return",
"a",
"List",
"of",
"the",
"entries"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java#L769-L790 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java | ParserBase.processIcons | protected void processIcons(ArtifactMetadata amd, RepositoryResourceWritable res) throws RepositoryException {
String current = "";
String sizeString = "";
String iconName = "";
String iconNames = amd.getIcons();
if (iconNames != null) {
iconNames.replaceAll("\\s", "");
StringTokenizer s = new StringTokenizer(iconNames, ",");
while (s.hasMoreTokens()) {
current = s.nextToken();
int size = 0;
if (current.contains(";")) { // if the icon has an associated
// size
StringTokenizer t = new StringTokenizer(current, ";");
while (t.hasMoreTokens()) {
sizeString = t.nextToken();
if (sizeString.contains("size=")) {
String sizes[] = sizeString.split("size=");
size = Integer.parseInt(sizes[sizes.length - 1]);
} else {
iconName = sizeString;
}
}
} else {
iconName = current;
}
File icon = this.extractFileFromArchive(amd.getArchive().getAbsolutePath(), iconName).getExtractedFile();
if (icon.exists()) {
AttachmentResourceWritable at = res.addAttachment(icon, AttachmentType.THUMBNAIL);
if (size != 0) {
at.setImageDimensions(size, size);
}
} else {
throw new RepositoryArchiveEntryNotFoundException("Icon does not exist", amd.getArchive(), iconName);
}
}
}
} | java | protected void processIcons(ArtifactMetadata amd, RepositoryResourceWritable res) throws RepositoryException {
String current = "";
String sizeString = "";
String iconName = "";
String iconNames = amd.getIcons();
if (iconNames != null) {
iconNames.replaceAll("\\s", "");
StringTokenizer s = new StringTokenizer(iconNames, ",");
while (s.hasMoreTokens()) {
current = s.nextToken();
int size = 0;
if (current.contains(";")) { // if the icon has an associated
// size
StringTokenizer t = new StringTokenizer(current, ";");
while (t.hasMoreTokens()) {
sizeString = t.nextToken();
if (sizeString.contains("size=")) {
String sizes[] = sizeString.split("size=");
size = Integer.parseInt(sizes[sizes.length - 1]);
} else {
iconName = sizeString;
}
}
} else {
iconName = current;
}
File icon = this.extractFileFromArchive(amd.getArchive().getAbsolutePath(), iconName).getExtractedFile();
if (icon.exists()) {
AttachmentResourceWritable at = res.addAttachment(icon, AttachmentType.THUMBNAIL);
if (size != 0) {
at.setImageDimensions(size, size);
}
} else {
throw new RepositoryArchiveEntryNotFoundException("Icon does not exist", amd.getArchive(), iconName);
}
}
}
} | [
"protected",
"void",
"processIcons",
"(",
"ArtifactMetadata",
"amd",
",",
"RepositoryResourceWritable",
"res",
")",
"throws",
"RepositoryException",
"{",
"String",
"current",
"=",
"\"\"",
";",
"String",
"sizeString",
"=",
"\"\"",
";",
"String",
"iconName",
"=",
"\"\"",
";",
"String",
"iconNames",
"=",
"amd",
".",
"getIcons",
"(",
")",
";",
"if",
"(",
"iconNames",
"!=",
"null",
")",
"{",
"iconNames",
".",
"replaceAll",
"(",
"\"\\\\s\"",
",",
"\"\"",
")",
";",
"StringTokenizer",
"s",
"=",
"new",
"StringTokenizer",
"(",
"iconNames",
",",
"\",\"",
")",
";",
"while",
"(",
"s",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"current",
"=",
"s",
".",
"nextToken",
"(",
")",
";",
"int",
"size",
"=",
"0",
";",
"if",
"(",
"current",
".",
"contains",
"(",
"\";\"",
")",
")",
"{",
"// if the icon has an associated",
"// size",
"StringTokenizer",
"t",
"=",
"new",
"StringTokenizer",
"(",
"current",
",",
"\";\"",
")",
";",
"while",
"(",
"t",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"sizeString",
"=",
"t",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"sizeString",
".",
"contains",
"(",
"\"size=\"",
")",
")",
"{",
"String",
"sizes",
"[",
"]",
"=",
"sizeString",
".",
"split",
"(",
"\"size=\"",
")",
";",
"size",
"=",
"Integer",
".",
"parseInt",
"(",
"sizes",
"[",
"sizes",
".",
"length",
"-",
"1",
"]",
")",
";",
"}",
"else",
"{",
"iconName",
"=",
"sizeString",
";",
"}",
"}",
"}",
"else",
"{",
"iconName",
"=",
"current",
";",
"}",
"File",
"icon",
"=",
"this",
".",
"extractFileFromArchive",
"(",
"amd",
".",
"getArchive",
"(",
")",
".",
"getAbsolutePath",
"(",
")",
",",
"iconName",
")",
".",
"getExtractedFile",
"(",
")",
";",
"if",
"(",
"icon",
".",
"exists",
"(",
")",
")",
"{",
"AttachmentResourceWritable",
"at",
"=",
"res",
".",
"addAttachment",
"(",
"icon",
",",
"AttachmentType",
".",
"THUMBNAIL",
")",
";",
"if",
"(",
"size",
"!=",
"0",
")",
"{",
"at",
".",
"setImageDimensions",
"(",
"size",
",",
"size",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"RepositoryArchiveEntryNotFoundException",
"(",
"\"Icon does not exist\"",
",",
"amd",
".",
"getArchive",
"(",
")",
",",
"iconName",
")",
";",
"}",
"}",
"}",
"}"
] | Process icons from the properties file
@param amd
Metadata
@param res
Resource to add icons to
@throws RepositoryException | [
"Process",
"icons",
"from",
"the",
"properties",
"file"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java#L801-L845 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MQLinkHandler.java | MQLinkHandler.reconstitute | public void reconstitute(
MessageProcessor processor,
HashMap durableSubscriptionsTable,
int startMode) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reconstitute",
new Object[] { processor, durableSubscriptionsTable, Integer.valueOf(startMode) });
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Reconstituting MQLink " + getName());
try
{
super.reconstitute(processor, durableSubscriptionsTable, startMode);
// Check Removed.
// if(!isToBeDeleted())
// {
// There should only be one MQLinkStateItemStream in the MQLinkLocalizationItemStream.
if (_mqLinkStateItemStreamId != 0)
{
_mqLinkStateItemStream
= (ItemStream) findById(_mqLinkStateItemStreamId);
// A MQLinkHandler must have a MQLinkStateItemStream as long as the destination
// is not in delete state. The ME may have restarted and the item stream already
// deleted
if (_mqLinkStateItemStream == null && !isToBeDeleted())
{
SIResourceException e =
new SIResourceException(
nls.getFormattedMessage(
"LINK_HANDLER_RECOVERY_ERROR_CWSIP0049",
new Object[] { getName() },
null));
SibTr.error(tc, "LINK_HANDLER_RECOVERY_ERROR_CWSIP0049", new Object[] { getName() });
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
"1:270:1.71",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute", e);
throw e;
}
}
// There should only be one MQLinkStateItemStream in the MQLinkLocalizationItemStream.
NonLockingCursor cursor = newNonLockingItemStreamCursor(
new ClassEqualsFilter(MQLinkPubSubBridgeItemStream.class));
_mqLinkPubSubBridgeItemStream = (MQLinkPubSubBridgeItemStream)cursor.next();
// A MQLinkLocalizationItemStream should not be in the DestinationManager
// without a MQLinkStateItemStream as long as the destination
// is not in delete state. The ME may have restarted and the item stream already
// deleted
if (_mqLinkPubSubBridgeItemStream == null && !isToBeDeleted())
{
SIResourceException e =
new SIResourceException(
nls.getFormattedMessage(
"LINK_HANDLER_RECOVERY_ERROR_CWSIP0049",
new Object[] { getName() },
null));
SibTr.error(tc, "LINK_HANDLER_RECOVERY_ERROR_CWSIP0049", new Object[] { getName() });
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
"1:303:1.71",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute", e);
throw e;
}
cursor.finished();
/* }
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "MQLink marked to be deleted, bypass state stream integrity checks");
}*/
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
"1:325:1.71",
this);
SibTr.exception(tc, e);
// At the moment, any exception we get while reconstituting means that we
// want to mark the destination as corrupt.
_isCorruptOrIndoubt = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute", e);
throw new SIResourceException(e);
}
/*
* We should have completed all restart message store operations for this
* link by this point.
*/
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute");
} | java | public void reconstitute(
MessageProcessor processor,
HashMap durableSubscriptionsTable,
int startMode) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reconstitute",
new Object[] { processor, durableSubscriptionsTable, Integer.valueOf(startMode) });
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Reconstituting MQLink " + getName());
try
{
super.reconstitute(processor, durableSubscriptionsTable, startMode);
// Check Removed.
// if(!isToBeDeleted())
// {
// There should only be one MQLinkStateItemStream in the MQLinkLocalizationItemStream.
if (_mqLinkStateItemStreamId != 0)
{
_mqLinkStateItemStream
= (ItemStream) findById(_mqLinkStateItemStreamId);
// A MQLinkHandler must have a MQLinkStateItemStream as long as the destination
// is not in delete state. The ME may have restarted and the item stream already
// deleted
if (_mqLinkStateItemStream == null && !isToBeDeleted())
{
SIResourceException e =
new SIResourceException(
nls.getFormattedMessage(
"LINK_HANDLER_RECOVERY_ERROR_CWSIP0049",
new Object[] { getName() },
null));
SibTr.error(tc, "LINK_HANDLER_RECOVERY_ERROR_CWSIP0049", new Object[] { getName() });
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
"1:270:1.71",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute", e);
throw e;
}
}
// There should only be one MQLinkStateItemStream in the MQLinkLocalizationItemStream.
NonLockingCursor cursor = newNonLockingItemStreamCursor(
new ClassEqualsFilter(MQLinkPubSubBridgeItemStream.class));
_mqLinkPubSubBridgeItemStream = (MQLinkPubSubBridgeItemStream)cursor.next();
// A MQLinkLocalizationItemStream should not be in the DestinationManager
// without a MQLinkStateItemStream as long as the destination
// is not in delete state. The ME may have restarted and the item stream already
// deleted
if (_mqLinkPubSubBridgeItemStream == null && !isToBeDeleted())
{
SIResourceException e =
new SIResourceException(
nls.getFormattedMessage(
"LINK_HANDLER_RECOVERY_ERROR_CWSIP0049",
new Object[] { getName() },
null));
SibTr.error(tc, "LINK_HANDLER_RECOVERY_ERROR_CWSIP0049", new Object[] { getName() });
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
"1:303:1.71",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute", e);
throw e;
}
cursor.finished();
/* }
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "MQLink marked to be deleted, bypass state stream integrity checks");
}*/
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
"1:325:1.71",
this);
SibTr.exception(tc, e);
// At the moment, any exception we get while reconstituting means that we
// want to mark the destination as corrupt.
_isCorruptOrIndoubt = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute", e);
throw new SIResourceException(e);
}
/*
* We should have completed all restart message store operations for this
* link by this point.
*/
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconstitute");
} | [
"public",
"void",
"reconstitute",
"(",
"MessageProcessor",
"processor",
",",
"HashMap",
"durableSubscriptionsTable",
",",
"int",
"startMode",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"reconstitute\"",
",",
"new",
"Object",
"[",
"]",
"{",
"processor",
",",
"durableSubscriptionsTable",
",",
"Integer",
".",
"valueOf",
"(",
"startMode",
")",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Reconstituting MQLink \"",
"+",
"getName",
"(",
")",
")",
";",
"try",
"{",
"super",
".",
"reconstitute",
"(",
"processor",
",",
"durableSubscriptionsTable",
",",
"startMode",
")",
";",
"// Check Removed.",
"// if(!isToBeDeleted())",
"// { ",
"// There should only be one MQLinkStateItemStream in the MQLinkLocalizationItemStream.",
"if",
"(",
"_mqLinkStateItemStreamId",
"!=",
"0",
")",
"{",
"_mqLinkStateItemStream",
"=",
"(",
"ItemStream",
")",
"findById",
"(",
"_mqLinkStateItemStreamId",
")",
";",
"// A MQLinkHandler must have a MQLinkStateItemStream as long as the destination",
"// is not in delete state. The ME may have restarted and the item stream already ",
"// deleted",
"if",
"(",
"_mqLinkStateItemStream",
"==",
"null",
"&&",
"!",
"isToBeDeleted",
"(",
")",
")",
"{",
"SIResourceException",
"e",
"=",
"new",
"SIResourceException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"LINK_HANDLER_RECOVERY_ERROR_CWSIP0049\"",
",",
"new",
"Object",
"[",
"]",
"{",
"getName",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"LINK_HANDLER_RECOVERY_ERROR_CWSIP0049\"",
",",
"new",
"Object",
"[",
"]",
"{",
"getName",
"(",
")",
"}",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute\"",
",",
"\"1:270:1.71\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"reconstitute\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"}",
"// There should only be one MQLinkStateItemStream in the MQLinkLocalizationItemStream.",
"NonLockingCursor",
"cursor",
"=",
"newNonLockingItemStreamCursor",
"(",
"new",
"ClassEqualsFilter",
"(",
"MQLinkPubSubBridgeItemStream",
".",
"class",
")",
")",
";",
"_mqLinkPubSubBridgeItemStream",
"=",
"(",
"MQLinkPubSubBridgeItemStream",
")",
"cursor",
".",
"next",
"(",
")",
";",
"// A MQLinkLocalizationItemStream should not be in the DestinationManager",
"// without a MQLinkStateItemStream as long as the destination",
"// is not in delete state. The ME may have restarted and the item stream already ",
"// deleted",
"if",
"(",
"_mqLinkPubSubBridgeItemStream",
"==",
"null",
"&&",
"!",
"isToBeDeleted",
"(",
")",
")",
"{",
"SIResourceException",
"e",
"=",
"new",
"SIResourceException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"LINK_HANDLER_RECOVERY_ERROR_CWSIP0049\"",
",",
"new",
"Object",
"[",
"]",
"{",
"getName",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"LINK_HANDLER_RECOVERY_ERROR_CWSIP0049\"",
",",
"new",
"Object",
"[",
"]",
"{",
"getName",
"(",
")",
"}",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute\"",
",",
"\"1:303:1.71\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"reconstitute\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"cursor",
".",
"finished",
"(",
")",
";",
"/* }\n else\n {\n if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())\n SibTr.debug(tc, \"MQLink marked to be deleted, bypass state stream integrity checks\");\n }*/",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute\"",
",",
"\"1:325:1.71\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"// At the moment, any exception we get while reconstituting means that we",
"// want to mark the destination as corrupt.",
"_isCorruptOrIndoubt",
"=",
"true",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"reconstitute\"",
",",
"e",
")",
";",
"throw",
"new",
"SIResourceException",
"(",
"e",
")",
";",
"}",
"/*\n * We should have completed all restart message store operations for this\n * link by this point.\n */",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"reconstitute\"",
")",
";",
"}"
] | Complete recovery of a MQLinkLocalizationItemStream retrieved from the
MessageStore.
@param processor
@param destinationHandler to use in reconstitution
@throws SIResourceException | [
"Complete",
"recovery",
"of",
"a",
"MQLinkLocalizationItemStream",
"retrieved",
"from",
"the",
"MessageStore",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MQLinkHandler.java#L178-L297 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MQLinkHandler.java | MQLinkHandler.registerLink | public void registerLink() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "registerLink");
// Tell TRM that the link exists
try
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Register MQLink: " + getUuid() + ", with mqLinkManager");
_mqLinkManager.define(getUuid());
}
catch (LinkException e)
{
//Error during create of the link. Trace an FFST and exit
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.registerLink",
"1:804:1.71",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "registerLink", e);
throw new SIResourceException(e);
}
//Register the link with TRM
registerDestination();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "registerLink");
} | java | public void registerLink() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "registerLink");
// Tell TRM that the link exists
try
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Register MQLink: " + getUuid() + ", with mqLinkManager");
_mqLinkManager.define(getUuid());
}
catch (LinkException e)
{
//Error during create of the link. Trace an FFST and exit
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.registerLink",
"1:804:1.71",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "registerLink", e);
throw new SIResourceException(e);
}
//Register the link with TRM
registerDestination();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "registerLink");
} | [
"public",
"void",
"registerLink",
"(",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"registerLink\"",
")",
";",
"// Tell TRM that the link exists ",
"try",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Register MQLink: \"",
"+",
"getUuid",
"(",
")",
"+",
"\", with mqLinkManager\"",
")",
";",
"_mqLinkManager",
".",
"define",
"(",
"getUuid",
"(",
")",
")",
";",
"}",
"catch",
"(",
"LinkException",
"e",
")",
"{",
"//Error during create of the link. Trace an FFST and exit",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.MQLinkHandler.registerLink\"",
",",
"\"1:804:1.71\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"registerLink\"",
",",
"e",
")",
";",
"throw",
"new",
"SIResourceException",
"(",
"e",
")",
";",
"}",
"//Register the link with TRM",
"registerDestination",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"registerLink\"",
")",
";",
"}"
] | Registers the link with WLM
@throws SIResourceException | [
"Registers",
"the",
"link",
"with",
"WLM"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MQLinkHandler.java#L735-L765 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MQLinkHandler.java | MQLinkHandler.deregisterLink | public void deregisterLink()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "deregisterLink");
//Deregister the link with TRM
deregisterDestination();
// Tell TRM that the link should be undefined
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Deregister MQLink: " + getUuid() + ", with mqLinkManager");
_mqLinkManager.undefine(getUuid());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deregisterLink");
} | java | public void deregisterLink()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "deregisterLink");
//Deregister the link with TRM
deregisterDestination();
// Tell TRM that the link should be undefined
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Deregister MQLink: " + getUuid() + ", with mqLinkManager");
_mqLinkManager.undefine(getUuid());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deregisterLink");
} | [
"public",
"void",
"deregisterLink",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"deregisterLink\"",
")",
";",
"//Deregister the link with TRM",
"deregisterDestination",
"(",
")",
";",
"// Tell TRM that the link should be undefined ",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Deregister MQLink: \"",
"+",
"getUuid",
"(",
")",
"+",
"\", with mqLinkManager\"",
")",
";",
"_mqLinkManager",
".",
"undefine",
"(",
"getUuid",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"deregisterLink\"",
")",
";",
"}"
] | De-registers the link from WLM
@throws SIResourceException | [
"De",
"-",
"registers",
"the",
"link",
"from",
"WLM"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MQLinkHandler.java#L771-L784 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MQLinkHandler.java | MQLinkHandler.stop | public void stop(int mode) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stop");
super.stop(mode);
// Signal the MQLink component to stop
try
{
if(_mqLinkObject != null)
_mqLinkObject.stop();
}
catch (SIResourceException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// The MQLink component will have FFDC'd we'll trace
// the problem but allow processing to continue
}
catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// The MQLink component will have FFDC'd we'll trace
// the problem but allow processing to continue
}
_mqLinkManager.undefine(getUuid());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "stop");
} | java | public void stop(int mode) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stop");
super.stop(mode);
// Signal the MQLink component to stop
try
{
if(_mqLinkObject != null)
_mqLinkObject.stop();
}
catch (SIResourceException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// The MQLink component will have FFDC'd we'll trace
// the problem but allow processing to continue
}
catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// The MQLink component will have FFDC'd we'll trace
// the problem but allow processing to continue
}
_mqLinkManager.undefine(getUuid());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "stop");
} | [
"public",
"void",
"stop",
"(",
"int",
"mode",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"stop\"",
")",
";",
"super",
".",
"stop",
"(",
"mode",
")",
";",
"// Signal the MQLink component to stop",
"try",
"{",
"if",
"(",
"_mqLinkObject",
"!=",
"null",
")",
"_mqLinkObject",
".",
"stop",
"(",
")",
";",
"}",
"catch",
"(",
"SIResourceException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"// The MQLink component will have FFDC'd we'll trace",
"// the problem but allow processing to continue ",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"// The MQLink component will have FFDC'd we'll trace",
"// the problem but allow processing to continue ",
"}",
"_mqLinkManager",
".",
"undefine",
"(",
"getUuid",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"stop\"",
")",
";",
"}"
] | This stop method overrides the stop method in BaseDestinationHandler and is driven when the ME
is stopped. As well as performing the normal stop processing for the MQLink object, it also
ensures that the uuid of the the MQLink is undefined from the set managed by the TRM. Otherwise,
there is the potential to add the uuid of the same MQLink twice.
Additionally, call the MQLink component via the MQLinkObjct to notify
it that we are stopping.
@param mode - stop mode | [
"This",
"stop",
"method",
"overrides",
"the",
"stop",
"method",
"in",
"BaseDestinationHandler",
"and",
"is",
"driven",
"when",
"the",
"ME",
"is",
"stopped",
".",
"As",
"well",
"as",
"performing",
"the",
"normal",
"stop",
"processing",
"for",
"the",
"MQLink",
"object",
"it",
"also",
"ensures",
"that",
"the",
"uuid",
"of",
"the",
"the",
"MQLink",
"is",
"undefined",
"from",
"the",
"set",
"managed",
"by",
"the",
"TRM",
".",
"Otherwise",
"there",
"is",
"the",
"potential",
"to",
"add",
"the",
"uuid",
"of",
"the",
"same",
"MQLink",
"twice",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MQLinkHandler.java#L976-L1013 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MQLinkHandler.java | MQLinkHandler.announceMPStarted | public void announceMPStarted(
int startMode,
JsMessagingEngine me) throws SIResourceException, SIException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"announceMPStarted",
new Object[] {
startMode,
me });
// Drive mpStarted against the associated MQLink object
if(_mqLinkObject != null)
_mqLinkObject.mpStarted(startMode, me);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "announceMPStarted");
} | java | public void announceMPStarted(
int startMode,
JsMessagingEngine me) throws SIResourceException, SIException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"announceMPStarted",
new Object[] {
startMode,
me });
// Drive mpStarted against the associated MQLink object
if(_mqLinkObject != null)
_mqLinkObject.mpStarted(startMode, me);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "announceMPStarted");
} | [
"public",
"void",
"announceMPStarted",
"(",
"int",
"startMode",
",",
"JsMessagingEngine",
"me",
")",
"throws",
"SIResourceException",
",",
"SIException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"announceMPStarted\"",
",",
"new",
"Object",
"[",
"]",
"{",
"startMode",
",",
"me",
"}",
")",
";",
"// Drive mpStarted against the associated MQLink object",
"if",
"(",
"_mqLinkObject",
"!=",
"null",
")",
"_mqLinkObject",
".",
"mpStarted",
"(",
"startMode",
",",
"me",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"announceMPStarted\"",
")",
";",
"}"
] | Alert the MQLink and PSB components that MP has now started.
@param startMode
@param me
@throws SIException
@throws SIResourceException | [
"Alert",
"the",
"MQLink",
"and",
"PSB",
"components",
"that",
"MP",
"has",
"now",
"started",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MQLinkHandler.java#L1081-L1100 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MQLinkHandler.java | MQLinkHandler.destroy | public void destroy() throws SIResourceException, SIException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"destroy");
// Drive destroy against the associated MQLink object
if(_mqLinkObject != null)
_mqLinkObject.destroy();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "destroy");
} | java | public void destroy() throws SIResourceException, SIException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"destroy");
// Drive destroy against the associated MQLink object
if(_mqLinkObject != null)
_mqLinkObject.destroy();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "destroy");
} | [
"public",
"void",
"destroy",
"(",
")",
"throws",
"SIResourceException",
",",
"SIException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"destroy\"",
")",
";",
"// Drive destroy against the associated MQLink object",
"if",
"(",
"_mqLinkObject",
"!=",
"null",
")",
"_mqLinkObject",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"destroy\"",
")",
";",
"}"
] | Alert the MQLink and PSB components that destroy has been driven.
@throws SIException
@throws SIResourceException | [
"Alert",
"the",
"MQLink",
"and",
"PSB",
"components",
"that",
"destroy",
"has",
"been",
"driven",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MQLinkHandler.java#L1108-L1123 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspWriterImpl.java | JspWriterImpl.recycle | void recycle() {
flushed = false;
closed = false;
out = null;
nextChar = 0;
converterBuffer.clear(); //PM19500
response = null; //PM23029
} | java | void recycle() {
flushed = false;
closed = false;
out = null;
nextChar = 0;
converterBuffer.clear(); //PM19500
response = null; //PM23029
} | [
"void",
"recycle",
"(",
")",
"{",
"flushed",
"=",
"false",
";",
"closed",
"=",
"false",
";",
"out",
"=",
"null",
";",
"nextChar",
"=",
"0",
";",
"converterBuffer",
".",
"clear",
"(",
")",
";",
"//PM19500",
"response",
"=",
"null",
";",
"//PM23029",
"}"
] | Package-level access | [
"Package",
"-",
"level",
"access"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspWriterImpl.java#L156-L163 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspWriterImpl.java | JspWriterImpl.clear | public final void clear() throws IOException {
if ((bufferSize == 0) && (out != null))
// clear() is illegal after any unbuffered output (JSP.5.5)
throw new IllegalStateException("jsp.error.ise_on_clear");
if (flushed)
throw new IOException("jsp.error.attempt_to_clear_flushed_buffer");
// defect 312981 begin
//ensureOpen();
if (closed) {
throw new IOException("Stream closed");
}
// defect 312981 end
nextChar = 0;
} | java | public final void clear() throws IOException {
if ((bufferSize == 0) && (out != null))
// clear() is illegal after any unbuffered output (JSP.5.5)
throw new IllegalStateException("jsp.error.ise_on_clear");
if (flushed)
throw new IOException("jsp.error.attempt_to_clear_flushed_buffer");
// defect 312981 begin
//ensureOpen();
if (closed) {
throw new IOException("Stream closed");
}
// defect 312981 end
nextChar = 0;
} | [
"public",
"final",
"void",
"clear",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"bufferSize",
"==",
"0",
")",
"&&",
"(",
"out",
"!=",
"null",
")",
")",
"// clear() is illegal after any unbuffered output (JSP.5.5)",
"throw",
"new",
"IllegalStateException",
"(",
"\"jsp.error.ise_on_clear\"",
")",
";",
"if",
"(",
"flushed",
")",
"throw",
"new",
"IOException",
"(",
"\"jsp.error.attempt_to_clear_flushed_buffer\"",
")",
";",
"// defect 312981 begin",
"//ensureOpen();",
"if",
"(",
"closed",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Stream closed\"",
")",
";",
"}",
"// defect 312981 end",
"nextChar",
"=",
"0",
";",
"}"
] | Discard the output buffer. | [
"Discard",
"the",
"output",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspWriterImpl.java#L226-L239 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/productinfo/ProductInfo.java | ProductInfo.getUserExtensionVersionFiles | public static File[] getUserExtensionVersionFiles(File installDir) {
File[] versionFiles = null;
String userDirLoc = System.getenv(BootstrapConstants.ENV_WLP_USER_DIR);
File userDir = (userDirLoc != null) ? new File(userDirLoc) : ((installDir != null) ? new File(installDir, "usr") : null);
if (userDir != null && userDir.exists()) {
File userExtVersionDir = new File(userDir, "extension/lib/versions");
if (userExtVersionDir.exists()) {
versionFiles = userExtVersionDir.listFiles(versionFileFilter);
}
}
return versionFiles;
} | java | public static File[] getUserExtensionVersionFiles(File installDir) {
File[] versionFiles = null;
String userDirLoc = System.getenv(BootstrapConstants.ENV_WLP_USER_DIR);
File userDir = (userDirLoc != null) ? new File(userDirLoc) : ((installDir != null) ? new File(installDir, "usr") : null);
if (userDir != null && userDir.exists()) {
File userExtVersionDir = new File(userDir, "extension/lib/versions");
if (userExtVersionDir.exists()) {
versionFiles = userExtVersionDir.listFiles(versionFileFilter);
}
}
return versionFiles;
} | [
"public",
"static",
"File",
"[",
"]",
"getUserExtensionVersionFiles",
"(",
"File",
"installDir",
")",
"{",
"File",
"[",
"]",
"versionFiles",
"=",
"null",
";",
"String",
"userDirLoc",
"=",
"System",
".",
"getenv",
"(",
"BootstrapConstants",
".",
"ENV_WLP_USER_DIR",
")",
";",
"File",
"userDir",
"=",
"(",
"userDirLoc",
"!=",
"null",
")",
"?",
"new",
"File",
"(",
"userDirLoc",
")",
":",
"(",
"(",
"installDir",
"!=",
"null",
")",
"?",
"new",
"File",
"(",
"installDir",
",",
"\"usr\"",
")",
":",
"null",
")",
";",
"if",
"(",
"userDir",
"!=",
"null",
"&&",
"userDir",
".",
"exists",
"(",
")",
")",
"{",
"File",
"userExtVersionDir",
"=",
"new",
"File",
"(",
"userDir",
",",
"\"extension/lib/versions\"",
")",
";",
"if",
"(",
"userExtVersionDir",
".",
"exists",
"(",
")",
")",
"{",
"versionFiles",
"=",
"userExtVersionDir",
".",
"listFiles",
"(",
"versionFileFilter",
")",
";",
"}",
"}",
"return",
"versionFiles",
";",
"}"
] | Retrieves the product extension jar bundles located in the installation's usr directory.
@return The array of product extension jar bundles in the default (usr) location. | [
"Retrieves",
"the",
"product",
"extension",
"jar",
"bundles",
"located",
"in",
"the",
"installation",
"s",
"usr",
"directory",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/productinfo/ProductInfo.java#L233-L247 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.registry/src/com/ibm/ws/security/wim/registry/WIMUserRegistry.java | WIMUserRegistry.getUserFromUniqueID | private String getUserFromUniqueID(String id) {
if (id == null) {
return "";
}
id = id.trim();
int realmDelimiterIndex = id.indexOf("/");
if (realmDelimiterIndex < 0) {
return "";
} else {
return id.substring(realmDelimiterIndex + 1);
}
} | java | private String getUserFromUniqueID(String id) {
if (id == null) {
return "";
}
id = id.trim();
int realmDelimiterIndex = id.indexOf("/");
if (realmDelimiterIndex < 0) {
return "";
} else {
return id.substring(realmDelimiterIndex + 1);
}
} | [
"private",
"String",
"getUserFromUniqueID",
"(",
"String",
"id",
")",
"{",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"id",
"=",
"id",
".",
"trim",
"(",
")",
";",
"int",
"realmDelimiterIndex",
"=",
"id",
".",
"indexOf",
"(",
"\"/\"",
")",
";",
"if",
"(",
"realmDelimiterIndex",
"<",
"0",
")",
"{",
"return",
"\"\"",
";",
"}",
"else",
"{",
"return",
"id",
".",
"substring",
"(",
"realmDelimiterIndex",
"+",
"1",
")",
";",
"}",
"}"
] | New method added as an alternative of getUserFromUniqueId method of WSSecurityPropagationHelper | [
"New",
"method",
"added",
"as",
"an",
"alternative",
"of",
"getUserFromUniqueId",
"method",
"of",
"WSSecurityPropagationHelper"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.registry/src/com/ibm/ws/security/wim/registry/WIMUserRegistry.java#L513-L524 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.checkNotClosed | private void checkNotClosed() throws SIConnectionUnavailableException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkNotClosed");
//Synchronize on the closed object to prevent it being changed while we check it.
synchronized (this)
{
if (_closed)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed", "Connection Closed exception");
SIMPConnectionUnavailableException e = new SIMPConnectionUnavailableException(
nls_cwsik.getFormattedMessage(
"DELIVERY_ERROR_SIRC_22", // OBJECT_CLOSED_ERROR_CWSIP0091
new Object[] { _messageProcessor.getMessagingEngineName() },
null));
e.setExceptionReason(SIRCConstants.SIRC0022_OBJECT_CLOSED_ERROR);
e.setExceptionInserts(new String[] { _messageProcessor.getMessagingEngineName() });
throw e;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed");
} | java | private void checkNotClosed() throws SIConnectionUnavailableException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkNotClosed");
//Synchronize on the closed object to prevent it being changed while we check it.
synchronized (this)
{
if (_closed)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed", "Connection Closed exception");
SIMPConnectionUnavailableException e = new SIMPConnectionUnavailableException(
nls_cwsik.getFormattedMessage(
"DELIVERY_ERROR_SIRC_22", // OBJECT_CLOSED_ERROR_CWSIP0091
new Object[] { _messageProcessor.getMessagingEngineName() },
null));
e.setExceptionReason(SIRCConstants.SIRC0022_OBJECT_CLOSED_ERROR);
e.setExceptionInserts(new String[] { _messageProcessor.getMessagingEngineName() });
throw e;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed");
} | [
"private",
"void",
"checkNotClosed",
"(",
")",
"throws",
"SIConnectionUnavailableException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"checkNotClosed\"",
")",
";",
"//Synchronize on the closed object to prevent it being changed while we check it.",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"_closed",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkNotClosed\"",
",",
"\"Connection Closed exception\"",
")",
";",
"SIMPConnectionUnavailableException",
"e",
"=",
"new",
"SIMPConnectionUnavailableException",
"(",
"nls_cwsik",
".",
"getFormattedMessage",
"(",
"\"DELIVERY_ERROR_SIRC_22\"",
",",
"// OBJECT_CLOSED_ERROR_CWSIP0091",
"new",
"Object",
"[",
"]",
"{",
"_messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"e",
".",
"setExceptionReason",
"(",
"SIRCConstants",
".",
"SIRC0022_OBJECT_CLOSED_ERROR",
")",
";",
"e",
".",
"setExceptionInserts",
"(",
"new",
"String",
"[",
"]",
"{",
"_messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
"}",
")",
";",
"throw",
"e",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkNotClosed\"",
")",
";",
"}"
] | Check if this connection has been closed. If it has, a SIObjectClosedException
is thrown.
@throws SIConnectionUnavailableException | [
"Check",
"if",
"this",
"connection",
"has",
"been",
"closed",
".",
"If",
"it",
"has",
"a",
"SIObjectClosedException",
"is",
"thrown",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L246-L273 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.removeBrowserSession | void removeBrowserSession(BrowserSessionImpl browser)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeBrowserSession", browser);
synchronized (_browsers)
{
_browsers.remove(browser);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeBrowserSession");
} | java | void removeBrowserSession(BrowserSessionImpl browser)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeBrowserSession", browser);
synchronized (_browsers)
{
_browsers.remove(browser);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeBrowserSession");
} | [
"void",
"removeBrowserSession",
"(",
"BrowserSessionImpl",
"browser",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"removeBrowserSession\"",
",",
"browser",
")",
";",
"synchronized",
"(",
"_browsers",
")",
"{",
"_browsers",
".",
"remove",
"(",
"browser",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"removeBrowserSession\"",
")",
";",
"}"
] | This method simply removes a Browser Session from our list. It is generally
called by the Browser Session as it is closing down.
@param browser | [
"This",
"method",
"simply",
"removes",
"a",
"Browser",
"Session",
"from",
"our",
"list",
".",
"It",
"is",
"generally",
"called",
"by",
"the",
"Browser",
"Session",
"as",
"it",
"is",
"closing",
"down",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L704-L715 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.removeConsumerSession | void removeConsumerSession(ConsumerSessionImpl consumer)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeConsumerSession", consumer);
synchronized (_consumers)
{
_consumers.remove(consumer);
}
_messageProcessor.removeConsumer(consumer);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerSession");
} | java | void removeConsumerSession(ConsumerSessionImpl consumer)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeConsumerSession", consumer);
synchronized (_consumers)
{
_consumers.remove(consumer);
}
_messageProcessor.removeConsumer(consumer);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerSession");
} | [
"void",
"removeConsumerSession",
"(",
"ConsumerSessionImpl",
"consumer",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"removeConsumerSession\"",
",",
"consumer",
")",
";",
"synchronized",
"(",
"_consumers",
")",
"{",
"_consumers",
".",
"remove",
"(",
"consumer",
")",
";",
"}",
"_messageProcessor",
".",
"removeConsumer",
"(",
"consumer",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"removeConsumerSession\"",
")",
";",
"}"
] | This method simply removes a Consumer Session from our list. It is generally
called by the Consumer Session as it is closing down.
@param consumer | [
"This",
"method",
"simply",
"removes",
"a",
"Consumer",
"Session",
"from",
"our",
"list",
".",
"It",
"is",
"generally",
"called",
"by",
"the",
"Consumer",
"Session",
"as",
"it",
"is",
"closing",
"down",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L723-L737 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.removeProducerSession | void removeProducerSession(ProducerSessionImpl producer)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeProducerSession");
synchronized (_producers)
{
_producers.remove(producer);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeProducerSession");
} | java | void removeProducerSession(ProducerSessionImpl producer)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeProducerSession");
synchronized (_producers)
{
_producers.remove(producer);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeProducerSession");
} | [
"void",
"removeProducerSession",
"(",
"ProducerSessionImpl",
"producer",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"removeProducerSession\"",
")",
";",
"synchronized",
"(",
"_producers",
")",
"{",
"_producers",
".",
"remove",
"(",
"producer",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"removeProducerSession\"",
")",
";",
"}"
] | This method simply removes a Producer Session from our list. It is generally
called by the Producer Session as it is closing down.
@param producer | [
"This",
"method",
"simply",
"removes",
"a",
"Producer",
"Session",
"from",
"our",
"list",
".",
"It",
"is",
"generally",
"called",
"by",
"the",
"Producer",
"Session",
"as",
"it",
"is",
"closing",
"down",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L745-L755 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.internalCreateProducerSession | private ProducerSession internalCreateProducerSession(
SIDestinationAddress destAddress,
DestinationType destinationType,
boolean system,
SecurityContext secContext,
boolean keepSecurityUserid,
boolean fixedMessagePoint,
boolean preferLocal,
boolean clearPubSubFingerprints,
String discriminator)
throws SIConnectionUnavailableException, SIConnectionDroppedException,
SIErrorException,
SITemporaryDestinationNotFoundException, SIIncorrectCallException, SIResourceException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"internalCreateProducerSession",
new Object[] { destAddress,
destinationType,
system,
secContext,
keepSecurityUserid,
fixedMessagePoint,
preferLocal,
clearPubSubFingerprints });
String destinationName = destAddress.getDestinationName();
String busName = destAddress.getBusName();
DestinationHandler destination =
_destinationManager.getDestination(destinationName, busName, false, true);
// Check the destination type
checkDestinationType(destinationType, destAddress, destination, system);
// Check authority to produce to destination
// If security is disabled then we'll bypass the check
// Security changes for Liberty Messaging: Sharath Start
// Remove the If condition, since the proxy class handles it
checkDestinationAuthority(destination, MessagingSecurityConstants.OPERATION_TYPE_SEND, discriminator);
// Security changes for Liberty Messaging: Sharath End
ProducerSession producer = null;
// Synchronize on the close object, we don't want the connection closing
// while we try to add the producer.
synchronized (this)
{
// See if this connection has been closed
checkNotClosed();
producer =
new ProducerSessionImpl(destAddress,
destination,
this,
secContext,
keepSecurityUserid,
fixedMessagePoint,
preferLocal,
clearPubSubFingerprints);
synchronized (_producers)
{
//store a reference to that producer session so that we can close
//it again later if needed
_producers.add(producer);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "internalCreateProducerSession", producer);
return producer; //169892
} | java | private ProducerSession internalCreateProducerSession(
SIDestinationAddress destAddress,
DestinationType destinationType,
boolean system,
SecurityContext secContext,
boolean keepSecurityUserid,
boolean fixedMessagePoint,
boolean preferLocal,
boolean clearPubSubFingerprints,
String discriminator)
throws SIConnectionUnavailableException, SIConnectionDroppedException,
SIErrorException,
SITemporaryDestinationNotFoundException, SIIncorrectCallException, SIResourceException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"internalCreateProducerSession",
new Object[] { destAddress,
destinationType,
system,
secContext,
keepSecurityUserid,
fixedMessagePoint,
preferLocal,
clearPubSubFingerprints });
String destinationName = destAddress.getDestinationName();
String busName = destAddress.getBusName();
DestinationHandler destination =
_destinationManager.getDestination(destinationName, busName, false, true);
// Check the destination type
checkDestinationType(destinationType, destAddress, destination, system);
// Check authority to produce to destination
// If security is disabled then we'll bypass the check
// Security changes for Liberty Messaging: Sharath Start
// Remove the If condition, since the proxy class handles it
checkDestinationAuthority(destination, MessagingSecurityConstants.OPERATION_TYPE_SEND, discriminator);
// Security changes for Liberty Messaging: Sharath End
ProducerSession producer = null;
// Synchronize on the close object, we don't want the connection closing
// while we try to add the producer.
synchronized (this)
{
// See if this connection has been closed
checkNotClosed();
producer =
new ProducerSessionImpl(destAddress,
destination,
this,
secContext,
keepSecurityUserid,
fixedMessagePoint,
preferLocal,
clearPubSubFingerprints);
synchronized (_producers)
{
//store a reference to that producer session so that we can close
//it again later if needed
_producers.add(producer);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "internalCreateProducerSession", producer);
return producer; //169892
} | [
"private",
"ProducerSession",
"internalCreateProducerSession",
"(",
"SIDestinationAddress",
"destAddress",
",",
"DestinationType",
"destinationType",
",",
"boolean",
"system",
",",
"SecurityContext",
"secContext",
",",
"boolean",
"keepSecurityUserid",
",",
"boolean",
"fixedMessagePoint",
",",
"boolean",
"preferLocal",
",",
"boolean",
"clearPubSubFingerprints",
",",
"String",
"discriminator",
")",
"throws",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
"SIErrorException",
",",
"SITemporaryDestinationNotFoundException",
",",
"SIIncorrectCallException",
",",
"SIResourceException",
",",
"SINotPossibleInCurrentConfigurationException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"internalCreateProducerSession\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destAddress",
",",
"destinationType",
",",
"system",
",",
"secContext",
",",
"keepSecurityUserid",
",",
"fixedMessagePoint",
",",
"preferLocal",
",",
"clearPubSubFingerprints",
"}",
")",
";",
"String",
"destinationName",
"=",
"destAddress",
".",
"getDestinationName",
"(",
")",
";",
"String",
"busName",
"=",
"destAddress",
".",
"getBusName",
"(",
")",
";",
"DestinationHandler",
"destination",
"=",
"_destinationManager",
".",
"getDestination",
"(",
"destinationName",
",",
"busName",
",",
"false",
",",
"true",
")",
";",
"// Check the destination type",
"checkDestinationType",
"(",
"destinationType",
",",
"destAddress",
",",
"destination",
",",
"system",
")",
";",
"// Check authority to produce to destination",
"// If security is disabled then we'll bypass the check",
"// Security changes for Liberty Messaging: Sharath Start",
"// Remove the If condition, since the proxy class handles it",
"checkDestinationAuthority",
"(",
"destination",
",",
"MessagingSecurityConstants",
".",
"OPERATION_TYPE_SEND",
",",
"discriminator",
")",
";",
"// Security changes for Liberty Messaging: Sharath End",
"ProducerSession",
"producer",
"=",
"null",
";",
"// Synchronize on the close object, we don't want the connection closing",
"// while we try to add the producer.",
"synchronized",
"(",
"this",
")",
"{",
"// See if this connection has been closed",
"checkNotClosed",
"(",
")",
";",
"producer",
"=",
"new",
"ProducerSessionImpl",
"(",
"destAddress",
",",
"destination",
",",
"this",
",",
"secContext",
",",
"keepSecurityUserid",
",",
"fixedMessagePoint",
",",
"preferLocal",
",",
"clearPubSubFingerprints",
")",
";",
"synchronized",
"(",
"_producers",
")",
"{",
"//store a reference to that producer session so that we can close",
"//it again later if needed",
"_producers",
".",
"add",
"(",
"producer",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"internalCreateProducerSession\"",
",",
"producer",
")",
";",
"return",
"producer",
";",
"//169892",
"}"
] | Method that creates the producer session.
@param destAddress
@param destinationType
@param system
@param discriminator
@param testDiscrimAtCreate
@param fixedMessagePoint
@param preferLocal
@return
@throws SINotAuthorizedException
@throws SIDestinationNotFoundException
@throws SIDestinationWrongTypeException
@throws SIDestinationLockedException
@throws SIObjectClosedException
@throws SICoreException | [
"Method",
"that",
"creates",
"the",
"producer",
"session",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L1005-L1077 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.checkTemporary | private void checkTemporary(DestinationHandler destination, boolean mqinterop)
throws SITemporaryDestinationNotFoundException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkTemporary", new Object[] { destination, Boolean.valueOf(mqinterop) });
// If a Temporary Destination, ensure it is on this connection unless mqinterop
if (destination.isTemporary()
&& !mqinterop
&& (_temporaryDestinations.indexOf(destination.getName()) == -1))
{
SIMPTemporaryDestinationNotFoundException e =
new SIMPTemporaryDestinationNotFoundException(
nls.getFormattedMessage(
"TEMPORARY_DESTINATION_CONNECTION_ERROR_CWSIP0099",
new Object[] { destination.getName() },
null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "checkTemporary", e);
}
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkTemporary");
} | java | private void checkTemporary(DestinationHandler destination, boolean mqinterop)
throws SITemporaryDestinationNotFoundException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkTemporary", new Object[] { destination, Boolean.valueOf(mqinterop) });
// If a Temporary Destination, ensure it is on this connection unless mqinterop
if (destination.isTemporary()
&& !mqinterop
&& (_temporaryDestinations.indexOf(destination.getName()) == -1))
{
SIMPTemporaryDestinationNotFoundException e =
new SIMPTemporaryDestinationNotFoundException(
nls.getFormattedMessage(
"TEMPORARY_DESTINATION_CONNECTION_ERROR_CWSIP0099",
new Object[] { destination.getName() },
null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "checkTemporary", e);
}
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkTemporary");
} | [
"private",
"void",
"checkTemporary",
"(",
"DestinationHandler",
"destination",
",",
"boolean",
"mqinterop",
")",
"throws",
"SITemporaryDestinationNotFoundException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"checkTemporary\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destination",
",",
"Boolean",
".",
"valueOf",
"(",
"mqinterop",
")",
"}",
")",
";",
"// If a Temporary Destination, ensure it is on this connection unless mqinterop",
"if",
"(",
"destination",
".",
"isTemporary",
"(",
")",
"&&",
"!",
"mqinterop",
"&&",
"(",
"_temporaryDestinations",
".",
"indexOf",
"(",
"destination",
".",
"getName",
"(",
")",
")",
"==",
"-",
"1",
")",
")",
"{",
"SIMPTemporaryDestinationNotFoundException",
"e",
"=",
"new",
"SIMPTemporaryDestinationNotFoundException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"TEMPORARY_DESTINATION_CONNECTION_ERROR_CWSIP0099\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destination",
".",
"getName",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkTemporary\"",
",",
"e",
")",
";",
"}",
"throw",
"e",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkTemporary\"",
")",
";",
"}"
] | Checks to see if the destination is temporary and the connection
used to create the temp destination is the same as the one trying to
access it.
Checking skipped if this is a mqinterop request
@param destination
@param mqinterop
@throws SITemporaryDestinationNotFoundException If the temp destination wasn't
created using the current connection. | [
"Checks",
"to",
"see",
"if",
"the",
"destination",
"is",
"temporary",
"and",
"the",
"connection",
"used",
"to",
"create",
"the",
"temp",
"destination",
"is",
"the",
"same",
"as",
"the",
"one",
"trying",
"to",
"access",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L1228-L1257 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.internalCreateConsumerSession | private ConsumerSession internalCreateConsumerSession(
SIDestinationAddress destAddr,
String alternateUser,
DestinationType destinationType,
SelectionCriteria criteria,
Reliability reliability,
boolean enableReadAhead,
boolean nolocal,
boolean forwardScanning,
boolean system,
Reliability unrecoverableReliability,
boolean bifurcatable,
boolean mqinterop,
boolean ignoreInitialIndoubts,
boolean gatherMessages)
throws SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIErrorException,
SINotAuthorizedException,
SIIncorrectCallException,
SIDestinationLockedException,
SINotPossibleInCurrentConfigurationException, SITemporaryDestinationNotFoundException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"internalCreateConsumerSession",
new Object[] {
destAddr,
alternateUser,
destinationType,
criteria,
reliability,
Boolean.valueOf(enableReadAhead),
Boolean.valueOf(nolocal),
Boolean.valueOf(forwardScanning),
Boolean.valueOf(system),
unrecoverableReliability,
Boolean.valueOf(bifurcatable),
Boolean.valueOf(mqinterop),
Boolean.valueOf(ignoreInitialIndoubts),
Boolean.valueOf(gatherMessages) });
try {
return internalCreateConsumerSession(null,
destAddr,
alternateUser,
destinationType,
criteria,
reliability,
enableReadAhead,
nolocal,
forwardScanning,
system,
unrecoverableReliability,
bifurcatable,
mqinterop,
ignoreInitialIndoubts,
gatherMessages);
} finally {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "internalCreateConsumerSession");
}
} | java | private ConsumerSession internalCreateConsumerSession(
SIDestinationAddress destAddr,
String alternateUser,
DestinationType destinationType,
SelectionCriteria criteria,
Reliability reliability,
boolean enableReadAhead,
boolean nolocal,
boolean forwardScanning,
boolean system,
Reliability unrecoverableReliability,
boolean bifurcatable,
boolean mqinterop,
boolean ignoreInitialIndoubts,
boolean gatherMessages)
throws SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIErrorException,
SINotAuthorizedException,
SIIncorrectCallException,
SIDestinationLockedException,
SINotPossibleInCurrentConfigurationException, SITemporaryDestinationNotFoundException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"internalCreateConsumerSession",
new Object[] {
destAddr,
alternateUser,
destinationType,
criteria,
reliability,
Boolean.valueOf(enableReadAhead),
Boolean.valueOf(nolocal),
Boolean.valueOf(forwardScanning),
Boolean.valueOf(system),
unrecoverableReliability,
Boolean.valueOf(bifurcatable),
Boolean.valueOf(mqinterop),
Boolean.valueOf(ignoreInitialIndoubts),
Boolean.valueOf(gatherMessages) });
try {
return internalCreateConsumerSession(null,
destAddr,
alternateUser,
destinationType,
criteria,
reliability,
enableReadAhead,
nolocal,
forwardScanning,
system,
unrecoverableReliability,
bifurcatable,
mqinterop,
ignoreInitialIndoubts,
gatherMessages);
} finally {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "internalCreateConsumerSession");
}
} | [
"private",
"ConsumerSession",
"internalCreateConsumerSession",
"(",
"SIDestinationAddress",
"destAddr",
",",
"String",
"alternateUser",
",",
"DestinationType",
"destinationType",
",",
"SelectionCriteria",
"criteria",
",",
"Reliability",
"reliability",
",",
"boolean",
"enableReadAhead",
",",
"boolean",
"nolocal",
",",
"boolean",
"forwardScanning",
",",
"boolean",
"system",
",",
"Reliability",
"unrecoverableReliability",
",",
"boolean",
"bifurcatable",
",",
"boolean",
"mqinterop",
",",
"boolean",
"ignoreInitialIndoubts",
",",
"boolean",
"gatherMessages",
")",
"throws",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SILimitExceededException",
",",
"SIErrorException",
",",
"SINotAuthorizedException",
",",
"SIIncorrectCallException",
",",
"SIDestinationLockedException",
",",
"SINotPossibleInCurrentConfigurationException",
",",
"SITemporaryDestinationNotFoundException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"internalCreateConsumerSession\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destAddr",
",",
"alternateUser",
",",
"destinationType",
",",
"criteria",
",",
"reliability",
",",
"Boolean",
".",
"valueOf",
"(",
"enableReadAhead",
")",
",",
"Boolean",
".",
"valueOf",
"(",
"nolocal",
")",
",",
"Boolean",
".",
"valueOf",
"(",
"forwardScanning",
")",
",",
"Boolean",
".",
"valueOf",
"(",
"system",
")",
",",
"unrecoverableReliability",
",",
"Boolean",
".",
"valueOf",
"(",
"bifurcatable",
")",
",",
"Boolean",
".",
"valueOf",
"(",
"mqinterop",
")",
",",
"Boolean",
".",
"valueOf",
"(",
"ignoreInitialIndoubts",
")",
",",
"Boolean",
".",
"valueOf",
"(",
"gatherMessages",
")",
"}",
")",
";",
"try",
"{",
"return",
"internalCreateConsumerSession",
"(",
"null",
",",
"destAddr",
",",
"alternateUser",
",",
"destinationType",
",",
"criteria",
",",
"reliability",
",",
"enableReadAhead",
",",
"nolocal",
",",
"forwardScanning",
",",
"system",
",",
"unrecoverableReliability",
",",
"bifurcatable",
",",
"mqinterop",
",",
"ignoreInitialIndoubts",
",",
"gatherMessages",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"internalCreateConsumerSession\"",
")",
";",
"}",
"}"
] | Internal method for creating the consumer.
@param destAddr
@param alternateUser
@param destinationType
@param discriminator
@param selector
@param reliability
@param enableReadAhead
@param nolocal
@param forwardScanning
@param system
@param unrecoverableReliability
@param bifurcatable
@param mqinterop
@return | [
"Internal",
"method",
"for",
"creating",
"the",
"consumer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L1277-L1342 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.checkDurableSubscriptionInformation | private SIBUuid8 checkDurableSubscriptionInformation(String subscriptionName,
String durableSubscriptionHome,
SIDestinationAddress destinationAddress,
boolean supportsMultipleConsumers,
boolean nolocal,
boolean delete,
boolean createForDurSub)
throws SIIncorrectCallException, SIConnectionUnavailableException
{
//liberty code change : chetan
//Since there is no ME-ME communication the durableSubscriptionHome is always the local ME
durableSubscriptionHome = _messageProcessor.getMessagingEngineName();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkDurableSubscriptionInformation",
new Object[] { subscriptionName,
destinationAddress,
Boolean.valueOf(supportsMultipleConsumers),
Boolean.valueOf(nolocal) });
// See if this connection has been closed
checkNotClosed();
if (subscriptionName == null)
{
String exText = "CREATE_DURABLE_SUB_CWSIR0042";
if (createForDurSub)
exText = "CREATE_DURABLE_SUB_CWSIR0032";
else if (delete)
exText = "DELETE_DURABLE_SUB_CWSIR0061";
SIIncorrectCallException e =
new SIIncorrectCallException(
nls_cwsir.getFormattedMessage(
exText,
null,
null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "checkDurableSubscriptionInformation", e);
}
throw e;
}
if (destinationAddress == null && !delete)
{
String exText = "CREATE_DURABLE_SUB_CWSIR0041";
if (createForDurSub)
exText = "CREATE_DURABLE_SUB_CWSIR0031";
SIIncorrectCallException e =
new SIIncorrectCallException(
nls_cwsir.getFormattedMessage(
exText,
null,
null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "checkDurableSubscriptionInformation", e);
}
throw e;
}
// Convert the durable subscription home to a UUID and figure out whether
// this is a local or remote create.
SIBUuid8 durableHomeID = _messageProcessor.mapMeNameToUuid(durableSubscriptionHome);
if (durableHomeID == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDurableSubscriptionInformation", "SIMENotFoundException");
// Lookup failed, throw an excepiton
throw new SIIncorrectCallException(
nls.getFormattedMessage(
"REMOTE_ME_MAPPING_ERROR_CWSIP0156",
new Object[] { durableSubscriptionHome },
null));
}
// noLocal on a cloned subscription is not supported.
if (nolocal && supportsMultipleConsumers)
{
SIIncorrectCallException e =
new SIIncorrectCallException(
nls.getFormattedMessage(
"INVALID_PARAMETER_COMBINATION_ERROR_CWSIP0100",
new Object[] { subscriptionName,
destinationAddress.getDestinationName(),
_messageProcessor.getMessagingEngineName() },
null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "checkDurableSubscriptionInformation", e);
}
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDurableSubscriptionInformation", durableHomeID);
return durableHomeID;
} | java | private SIBUuid8 checkDurableSubscriptionInformation(String subscriptionName,
String durableSubscriptionHome,
SIDestinationAddress destinationAddress,
boolean supportsMultipleConsumers,
boolean nolocal,
boolean delete,
boolean createForDurSub)
throws SIIncorrectCallException, SIConnectionUnavailableException
{
//liberty code change : chetan
//Since there is no ME-ME communication the durableSubscriptionHome is always the local ME
durableSubscriptionHome = _messageProcessor.getMessagingEngineName();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkDurableSubscriptionInformation",
new Object[] { subscriptionName,
destinationAddress,
Boolean.valueOf(supportsMultipleConsumers),
Boolean.valueOf(nolocal) });
// See if this connection has been closed
checkNotClosed();
if (subscriptionName == null)
{
String exText = "CREATE_DURABLE_SUB_CWSIR0042";
if (createForDurSub)
exText = "CREATE_DURABLE_SUB_CWSIR0032";
else if (delete)
exText = "DELETE_DURABLE_SUB_CWSIR0061";
SIIncorrectCallException e =
new SIIncorrectCallException(
nls_cwsir.getFormattedMessage(
exText,
null,
null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "checkDurableSubscriptionInformation", e);
}
throw e;
}
if (destinationAddress == null && !delete)
{
String exText = "CREATE_DURABLE_SUB_CWSIR0041";
if (createForDurSub)
exText = "CREATE_DURABLE_SUB_CWSIR0031";
SIIncorrectCallException e =
new SIIncorrectCallException(
nls_cwsir.getFormattedMessage(
exText,
null,
null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "checkDurableSubscriptionInformation", e);
}
throw e;
}
// Convert the durable subscription home to a UUID and figure out whether
// this is a local or remote create.
SIBUuid8 durableHomeID = _messageProcessor.mapMeNameToUuid(durableSubscriptionHome);
if (durableHomeID == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDurableSubscriptionInformation", "SIMENotFoundException");
// Lookup failed, throw an excepiton
throw new SIIncorrectCallException(
nls.getFormattedMessage(
"REMOTE_ME_MAPPING_ERROR_CWSIP0156",
new Object[] { durableSubscriptionHome },
null));
}
// noLocal on a cloned subscription is not supported.
if (nolocal && supportsMultipleConsumers)
{
SIIncorrectCallException e =
new SIIncorrectCallException(
nls.getFormattedMessage(
"INVALID_PARAMETER_COMBINATION_ERROR_CWSIP0100",
new Object[] { subscriptionName,
destinationAddress.getDestinationName(),
_messageProcessor.getMessagingEngineName() },
null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "checkDurableSubscriptionInformation", e);
}
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDurableSubscriptionInformation", durableHomeID);
return durableHomeID;
} | [
"private",
"SIBUuid8",
"checkDurableSubscriptionInformation",
"(",
"String",
"subscriptionName",
",",
"String",
"durableSubscriptionHome",
",",
"SIDestinationAddress",
"destinationAddress",
",",
"boolean",
"supportsMultipleConsumers",
",",
"boolean",
"nolocal",
",",
"boolean",
"delete",
",",
"boolean",
"createForDurSub",
")",
"throws",
"SIIncorrectCallException",
",",
"SIConnectionUnavailableException",
"{",
"//liberty code change : chetan",
"//Since there is no ME-ME communication the durableSubscriptionHome is always the local ME ",
"durableSubscriptionHome",
"=",
"_messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"checkDurableSubscriptionInformation\"",
",",
"new",
"Object",
"[",
"]",
"{",
"subscriptionName",
",",
"destinationAddress",
",",
"Boolean",
".",
"valueOf",
"(",
"supportsMultipleConsumers",
")",
",",
"Boolean",
".",
"valueOf",
"(",
"nolocal",
")",
"}",
")",
";",
"// See if this connection has been closed",
"checkNotClosed",
"(",
")",
";",
"if",
"(",
"subscriptionName",
"==",
"null",
")",
"{",
"String",
"exText",
"=",
"\"CREATE_DURABLE_SUB_CWSIR0042\"",
";",
"if",
"(",
"createForDurSub",
")",
"exText",
"=",
"\"CREATE_DURABLE_SUB_CWSIR0032\"",
";",
"else",
"if",
"(",
"delete",
")",
"exText",
"=",
"\"DELETE_DURABLE_SUB_CWSIR0061\"",
";",
"SIIncorrectCallException",
"e",
"=",
"new",
"SIIncorrectCallException",
"(",
"nls_cwsir",
".",
"getFormattedMessage",
"(",
"exText",
",",
"null",
",",
"null",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkDurableSubscriptionInformation\"",
",",
"e",
")",
";",
"}",
"throw",
"e",
";",
"}",
"if",
"(",
"destinationAddress",
"==",
"null",
"&&",
"!",
"delete",
")",
"{",
"String",
"exText",
"=",
"\"CREATE_DURABLE_SUB_CWSIR0041\"",
";",
"if",
"(",
"createForDurSub",
")",
"exText",
"=",
"\"CREATE_DURABLE_SUB_CWSIR0031\"",
";",
"SIIncorrectCallException",
"e",
"=",
"new",
"SIIncorrectCallException",
"(",
"nls_cwsir",
".",
"getFormattedMessage",
"(",
"exText",
",",
"null",
",",
"null",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkDurableSubscriptionInformation\"",
",",
"e",
")",
";",
"}",
"throw",
"e",
";",
"}",
"// Convert the durable subscription home to a UUID and figure out whether",
"// this is a local or remote create.",
"SIBUuid8",
"durableHomeID",
"=",
"_messageProcessor",
".",
"mapMeNameToUuid",
"(",
"durableSubscriptionHome",
")",
";",
"if",
"(",
"durableHomeID",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkDurableSubscriptionInformation\"",
",",
"\"SIMENotFoundException\"",
")",
";",
"// Lookup failed, throw an excepiton",
"throw",
"new",
"SIIncorrectCallException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"REMOTE_ME_MAPPING_ERROR_CWSIP0156\"",
",",
"new",
"Object",
"[",
"]",
"{",
"durableSubscriptionHome",
"}",
",",
"null",
")",
")",
";",
"}",
"// noLocal on a cloned subscription is not supported.",
"if",
"(",
"nolocal",
"&&",
"supportsMultipleConsumers",
")",
"{",
"SIIncorrectCallException",
"e",
"=",
"new",
"SIIncorrectCallException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"INVALID_PARAMETER_COMBINATION_ERROR_CWSIP0100\"",
",",
"new",
"Object",
"[",
"]",
"{",
"subscriptionName",
",",
"destinationAddress",
".",
"getDestinationName",
"(",
")",
",",
"_messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkDurableSubscriptionInformation\"",
",",
"e",
")",
";",
"}",
"throw",
"e",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkDurableSubscriptionInformation\"",
",",
"durableHomeID",
")",
";",
"return",
"durableHomeID",
";",
"}"
] | Checks made for durable subscription support.
returns the uuid of the durable sub home
Checks that the connection isn't closed
Checks that the subscription name isn't null
Checks that the destination address isn't null
Checks that the supports multiple consumers and noLocal aren't both set. | [
"Checks",
"made",
"for",
"durable",
"subscription",
"support",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L2705-L2811 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.internalReceiveNoWait | private SIBusMessage internalReceiveNoWait(SITransaction tran,
Reliability unrecoverableReliability,
SIDestinationAddress destAddr,
DestinationType destinationType,
SelectionCriteria criteria,
Reliability reliability,
String alternateUser,
boolean system)
throws SIConnectionDroppedException, SIConnectionUnavailableException,
SIConnectionLostException, SILimitExceededException,
SINotAuthorizedException, SIDestinationLockedException,
SITemporaryDestinationNotFoundException, SIResourceException,
SIErrorException, SIIncorrectCallException,
SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"internalReceiveNoWait",
new Object[] { destAddr,
alternateUser,
destinationType,
criteria,
tran,
reliability,
unrecoverableReliability,
Boolean.valueOf(system) });
if (destAddr == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "internalReceiveNoWait", "SIIncorrectCallException - null destAddr");
throw new SIIncorrectCallException(
nls_cwsir.getFormattedMessage(
"RECEIVE_NO_WAIT_CWSIR0091",
null,
null));
}
SIBusMessage message = null;
if (tran != null && !((TransactionCommon) tran).isAlive())
{
SIIncorrectCallException e = new SIIncorrectCallException(nls.getFormattedMessage(
"TRANSACTION_RECEIVE_USAGE_ERROR_CWSIP0777",
new Object[] { destAddr },
null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "internalReceiveNoWait", e);
throw e;
}
try
{
//TODO there may be some optimization we can do here to just receive one message
//Create a consumer session
ConsumerSession session =
internalCreateConsumerSession(
destAddr,
alternateUser,
destinationType,
criteria,
reliability,
false, //enableReadAhead
false, //noLocal
false, //forwardScanning
system,
unrecoverableReliability,
false, // bifurcatable
false, // mqInterop
true, // ignoreIntialIndoubts
false // gatherMessages
);
session.start(false);
//receive one message
message = session.receiveNoWait(tran);
//close the session
session.close();
} catch (SISessionUnavailableException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// If any of these calls failed due to being closed the connection
// must have been closed. Call checkNotClosed() to force out the
// correct exception.
checkNotClosed();
// Just in case the connection isn't closed we better re-throw the
// original exception.
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "internalReceiveNoWait", e);
throw new SIMPConnectionUnavailableException(
nls_cwsik.getFormattedMessage(
"DELIVERY_ERROR_SIRC_22", // OBJECT_CLOSED_ERROR_CWSIP0091
new Object[] { _messageProcessor.getMessagingEngineName() },
null),
e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "internalReceiveNoWait", message);
return message;
} | java | private SIBusMessage internalReceiveNoWait(SITransaction tran,
Reliability unrecoverableReliability,
SIDestinationAddress destAddr,
DestinationType destinationType,
SelectionCriteria criteria,
Reliability reliability,
String alternateUser,
boolean system)
throws SIConnectionDroppedException, SIConnectionUnavailableException,
SIConnectionLostException, SILimitExceededException,
SINotAuthorizedException, SIDestinationLockedException,
SITemporaryDestinationNotFoundException, SIResourceException,
SIErrorException, SIIncorrectCallException,
SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"internalReceiveNoWait",
new Object[] { destAddr,
alternateUser,
destinationType,
criteria,
tran,
reliability,
unrecoverableReliability,
Boolean.valueOf(system) });
if (destAddr == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "internalReceiveNoWait", "SIIncorrectCallException - null destAddr");
throw new SIIncorrectCallException(
nls_cwsir.getFormattedMessage(
"RECEIVE_NO_WAIT_CWSIR0091",
null,
null));
}
SIBusMessage message = null;
if (tran != null && !((TransactionCommon) tran).isAlive())
{
SIIncorrectCallException e = new SIIncorrectCallException(nls.getFormattedMessage(
"TRANSACTION_RECEIVE_USAGE_ERROR_CWSIP0777",
new Object[] { destAddr },
null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "internalReceiveNoWait", e);
throw e;
}
try
{
//TODO there may be some optimization we can do here to just receive one message
//Create a consumer session
ConsumerSession session =
internalCreateConsumerSession(
destAddr,
alternateUser,
destinationType,
criteria,
reliability,
false, //enableReadAhead
false, //noLocal
false, //forwardScanning
system,
unrecoverableReliability,
false, // bifurcatable
false, // mqInterop
true, // ignoreIntialIndoubts
false // gatherMessages
);
session.start(false);
//receive one message
message = session.receiveNoWait(tran);
//close the session
session.close();
} catch (SISessionUnavailableException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// If any of these calls failed due to being closed the connection
// must have been closed. Call checkNotClosed() to force out the
// correct exception.
checkNotClosed();
// Just in case the connection isn't closed we better re-throw the
// original exception.
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "internalReceiveNoWait", e);
throw new SIMPConnectionUnavailableException(
nls_cwsik.getFormattedMessage(
"DELIVERY_ERROR_SIRC_22", // OBJECT_CLOSED_ERROR_CWSIP0091
new Object[] { _messageProcessor.getMessagingEngineName() },
null),
e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "internalReceiveNoWait", message);
return message;
} | [
"private",
"SIBusMessage",
"internalReceiveNoWait",
"(",
"SITransaction",
"tran",
",",
"Reliability",
"unrecoverableReliability",
",",
"SIDestinationAddress",
"destAddr",
",",
"DestinationType",
"destinationType",
",",
"SelectionCriteria",
"criteria",
",",
"Reliability",
"reliability",
",",
"String",
"alternateUser",
",",
"boolean",
"system",
")",
"throws",
"SIConnectionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionLostException",
",",
"SILimitExceededException",
",",
"SINotAuthorizedException",
",",
"SIDestinationLockedException",
",",
"SITemporaryDestinationNotFoundException",
",",
"SIResourceException",
",",
"SIErrorException",
",",
"SIIncorrectCallException",
",",
"SINotPossibleInCurrentConfigurationException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"internalReceiveNoWait\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destAddr",
",",
"alternateUser",
",",
"destinationType",
",",
"criteria",
",",
"tran",
",",
"reliability",
",",
"unrecoverableReliability",
",",
"Boolean",
".",
"valueOf",
"(",
"system",
")",
"}",
")",
";",
"if",
"(",
"destAddr",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"internalReceiveNoWait\"",
",",
"\"SIIncorrectCallException - null destAddr\"",
")",
";",
"throw",
"new",
"SIIncorrectCallException",
"(",
"nls_cwsir",
".",
"getFormattedMessage",
"(",
"\"RECEIVE_NO_WAIT_CWSIR0091\"",
",",
"null",
",",
"null",
")",
")",
";",
"}",
"SIBusMessage",
"message",
"=",
"null",
";",
"if",
"(",
"tran",
"!=",
"null",
"&&",
"!",
"(",
"(",
"TransactionCommon",
")",
"tran",
")",
".",
"isAlive",
"(",
")",
")",
"{",
"SIIncorrectCallException",
"e",
"=",
"new",
"SIIncorrectCallException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"TRANSACTION_RECEIVE_USAGE_ERROR_CWSIP0777\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destAddr",
"}",
",",
"null",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"internalReceiveNoWait\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"try",
"{",
"//TODO there may be some optimization we can do here to just receive one message",
"//Create a consumer session ",
"ConsumerSession",
"session",
"=",
"internalCreateConsumerSession",
"(",
"destAddr",
",",
"alternateUser",
",",
"destinationType",
",",
"criteria",
",",
"reliability",
",",
"false",
",",
"//enableReadAhead",
"false",
",",
"//noLocal",
"false",
",",
"//forwardScanning",
"system",
",",
"unrecoverableReliability",
",",
"false",
",",
"// bifurcatable",
"false",
",",
"// mqInterop",
"true",
",",
"// ignoreIntialIndoubts",
"false",
"// gatherMessages",
")",
";",
"session",
".",
"start",
"(",
"false",
")",
";",
"//receive one message",
"message",
"=",
"session",
".",
"receiveNoWait",
"(",
"tran",
")",
";",
"//close the session",
"session",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"SISessionUnavailableException",
"e",
")",
"{",
"// No FFDC code needed ",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"// If any of these calls failed due to being closed the connection",
"// must have been closed. Call checkNotClosed() to force out the",
"// correct exception.",
"checkNotClosed",
"(",
")",
";",
"// Just in case the connection isn't closed we better re-throw the",
"// original exception.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"internalReceiveNoWait\"",
",",
"e",
")",
";",
"throw",
"new",
"SIMPConnectionUnavailableException",
"(",
"nls_cwsik",
".",
"getFormattedMessage",
"(",
"\"DELIVERY_ERROR_SIRC_22\"",
",",
"// OBJECT_CLOSED_ERROR_CWSIP0091 ",
"new",
"Object",
"[",
"]",
"{",
"_messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
"}",
",",
"null",
")",
",",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"internalReceiveNoWait\"",
",",
"message",
")",
";",
"return",
"message",
";",
"}"
] | Internal implementation for receiving no wait | [
"Internal",
"implementation",
"for",
"receiving",
"no",
"wait"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L3249-L3358 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.createBrowserSession | private BrowserSession createBrowserSession(
SIDestinationAddress destinationAddress,
DestinationType destinationType,
SelectionCriteria criteria,
boolean system,
String alternateUser,
boolean gatherMessages)
throws SIConnectionUnavailableException, SIConnectionDroppedException,
SIErrorException,
SITemporaryDestinationNotFoundException,
SIResourceException,
SINotPossibleInCurrentConfigurationException, SISelectorSyntaxException, SIDiscriminatorSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"createBrowserSession",
new Object[] { destinationAddress, destinationType, criteria, Boolean.valueOf(gatherMessages) });
// Finding a destination could take some time so we don't have the
// connection locked (on closed) when we do this.
DestinationHandler destination = _destinationManager.getDestination(
(JsDestinationAddress) destinationAddress, false);
// Check that this is the correct destination type
checkDestinationType(destinationType, destinationAddress, destination, system);
if (destination.getDestinationType() == DestinationType.SERVICE)
{
//Cant browse a service destination
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createBrowserSession", "cannot browse a service destination");
throw new SINotPossibleInCurrentConfigurationException(
nls.getFormattedMessage(
"INVALID_DESTINATION_USAGE_ERROR_CWSIP0022",
new Object[] { destination.getName(),
_messageProcessor.getMessagingEngineName() },
null));
}
// Check that this temporary destination was created by this connection.
checkTemporary(destination, false);
// Check authority to browse this destination
// If security is disabled then we'll bypass the check
checkDestinationAuthority(destination, MessagingSecurityConstants.OPERATION_TYPE_BROWSE, null);
//if the destination turns out to be pub-sub then that doesn't make sense
//so we'll just set it back to null
if (destination.isPubSub())
{
destination = null;
}
BrowserSession browser = null;
// Synchronize on the close object, we don't want the connection closing
// while we try to add the browser.
synchronized (this)
{
// See if this connection has been closed
checkNotClosed();
//create a browser session with the given destination
//if the destination was null - it was pub sub - this will create a browser
//session which never returns any messages
browser = new BrowserSessionImpl(destination,
criteria,
this,
destinationAddress,
gatherMessages);
synchronized (_browsers)
{
//store a reference
_browsers.add(browser);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createBrowserSession", browser);
return browser;
} | java | private BrowserSession createBrowserSession(
SIDestinationAddress destinationAddress,
DestinationType destinationType,
SelectionCriteria criteria,
boolean system,
String alternateUser,
boolean gatherMessages)
throws SIConnectionUnavailableException, SIConnectionDroppedException,
SIErrorException,
SITemporaryDestinationNotFoundException,
SIResourceException,
SINotPossibleInCurrentConfigurationException, SISelectorSyntaxException, SIDiscriminatorSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"createBrowserSession",
new Object[] { destinationAddress, destinationType, criteria, Boolean.valueOf(gatherMessages) });
// Finding a destination could take some time so we don't have the
// connection locked (on closed) when we do this.
DestinationHandler destination = _destinationManager.getDestination(
(JsDestinationAddress) destinationAddress, false);
// Check that this is the correct destination type
checkDestinationType(destinationType, destinationAddress, destination, system);
if (destination.getDestinationType() == DestinationType.SERVICE)
{
//Cant browse a service destination
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createBrowserSession", "cannot browse a service destination");
throw new SINotPossibleInCurrentConfigurationException(
nls.getFormattedMessage(
"INVALID_DESTINATION_USAGE_ERROR_CWSIP0022",
new Object[] { destination.getName(),
_messageProcessor.getMessagingEngineName() },
null));
}
// Check that this temporary destination was created by this connection.
checkTemporary(destination, false);
// Check authority to browse this destination
// If security is disabled then we'll bypass the check
checkDestinationAuthority(destination, MessagingSecurityConstants.OPERATION_TYPE_BROWSE, null);
//if the destination turns out to be pub-sub then that doesn't make sense
//so we'll just set it back to null
if (destination.isPubSub())
{
destination = null;
}
BrowserSession browser = null;
// Synchronize on the close object, we don't want the connection closing
// while we try to add the browser.
synchronized (this)
{
// See if this connection has been closed
checkNotClosed();
//create a browser session with the given destination
//if the destination was null - it was pub sub - this will create a browser
//session which never returns any messages
browser = new BrowserSessionImpl(destination,
criteria,
this,
destinationAddress,
gatherMessages);
synchronized (_browsers)
{
//store a reference
_browsers.add(browser);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createBrowserSession", browser);
return browser;
} | [
"private",
"BrowserSession",
"createBrowserSession",
"(",
"SIDestinationAddress",
"destinationAddress",
",",
"DestinationType",
"destinationType",
",",
"SelectionCriteria",
"criteria",
",",
"boolean",
"system",
",",
"String",
"alternateUser",
",",
"boolean",
"gatherMessages",
")",
"throws",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
"SIErrorException",
",",
"SITemporaryDestinationNotFoundException",
",",
"SIResourceException",
",",
"SINotPossibleInCurrentConfigurationException",
",",
"SISelectorSyntaxException",
",",
"SIDiscriminatorSyntaxException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createBrowserSession\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destinationAddress",
",",
"destinationType",
",",
"criteria",
",",
"Boolean",
".",
"valueOf",
"(",
"gatherMessages",
")",
"}",
")",
";",
"// Finding a destination could take some time so we don't have the",
"// connection locked (on closed) when we do this.",
"DestinationHandler",
"destination",
"=",
"_destinationManager",
".",
"getDestination",
"(",
"(",
"JsDestinationAddress",
")",
"destinationAddress",
",",
"false",
")",
";",
"// Check that this is the correct destination type",
"checkDestinationType",
"(",
"destinationType",
",",
"destinationAddress",
",",
"destination",
",",
"system",
")",
";",
"if",
"(",
"destination",
".",
"getDestinationType",
"(",
")",
"==",
"DestinationType",
".",
"SERVICE",
")",
"{",
"//Cant browse a service destination",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createBrowserSession\"",
",",
"\"cannot browse a service destination\"",
")",
";",
"throw",
"new",
"SINotPossibleInCurrentConfigurationException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"INVALID_DESTINATION_USAGE_ERROR_CWSIP0022\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destination",
".",
"getName",
"(",
")",
",",
"_messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"}",
"// Check that this temporary destination was created by this connection.",
"checkTemporary",
"(",
"destination",
",",
"false",
")",
";",
"// Check authority to browse this destination",
"// If security is disabled then we'll bypass the check",
"checkDestinationAuthority",
"(",
"destination",
",",
"MessagingSecurityConstants",
".",
"OPERATION_TYPE_BROWSE",
",",
"null",
")",
";",
"//if the destination turns out to be pub-sub then that doesn't make sense",
"//so we'll just set it back to null",
"if",
"(",
"destination",
".",
"isPubSub",
"(",
")",
")",
"{",
"destination",
"=",
"null",
";",
"}",
"BrowserSession",
"browser",
"=",
"null",
";",
"// Synchronize on the close object, we don't want the connection closing",
"// while we try to add the browser.",
"synchronized",
"(",
"this",
")",
"{",
"// See if this connection has been closed",
"checkNotClosed",
"(",
")",
";",
"//create a browser session with the given destination",
"//if the destination was null - it was pub sub - this will create a browser",
"//session which never returns any messages",
"browser",
"=",
"new",
"BrowserSessionImpl",
"(",
"destination",
",",
"criteria",
",",
"this",
",",
"destinationAddress",
",",
"gatherMessages",
")",
";",
"synchronized",
"(",
"_browsers",
")",
"{",
"//store a reference",
"_browsers",
".",
"add",
"(",
"browser",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createBrowserSession\"",
",",
"browser",
")",
";",
"return",
"browser",
";",
"}"
] | Creates the Browser session.
@param destName
@param destinationAddress
@param discriminator
@param selector
@param system
@return
@throws SIDiscriminatorSyntaxException
@throws SISelectorSyntaxException | [
"Creates",
"the",
"Browser",
"session",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L3645-L3728 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.isDestinationPrefixValid | private static final boolean isDestinationPrefixValid(String destinationPrefix)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isDestinationPrefixValid", destinationPrefix);
boolean isValid = true; // Assume the prefix is valid until we know otherwise.
// null indicates that no destination prefix is being used.
if (null != destinationPrefix)
{
// Check for the length first.
int len = destinationPrefix.length();
if (len > 24)
{
isValid = false;
}
else
{
// Cycle through each character in the prefix until we find an invalid character,
// or until we come to the end of the string.
int along = 0;
while ((along < len) && isValid)
{
char c = destinationPrefix.charAt(along);
if (!(('A' <= c) && ('Z' >= c)))
{
if (!(('a' <= c) && ('z' >= c)))
{
if (!(('0' <= c) && ('9' >= c)))
{
if ('.' != c && '/' != c && '%' != c)
{
// This character isn't a valid one...
isValid = false;
}
}
}
}
// Move along to the next character in the string.
along += 1;
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isDestinationPrefixValid", Boolean.valueOf(isValid));
return isValid;
} | java | private static final boolean isDestinationPrefixValid(String destinationPrefix)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isDestinationPrefixValid", destinationPrefix);
boolean isValid = true; // Assume the prefix is valid until we know otherwise.
// null indicates that no destination prefix is being used.
if (null != destinationPrefix)
{
// Check for the length first.
int len = destinationPrefix.length();
if (len > 24)
{
isValid = false;
}
else
{
// Cycle through each character in the prefix until we find an invalid character,
// or until we come to the end of the string.
int along = 0;
while ((along < len) && isValid)
{
char c = destinationPrefix.charAt(along);
if (!(('A' <= c) && ('Z' >= c)))
{
if (!(('a' <= c) && ('z' >= c)))
{
if (!(('0' <= c) && ('9' >= c)))
{
if ('.' != c && '/' != c && '%' != c)
{
// This character isn't a valid one...
isValid = false;
}
}
}
}
// Move along to the next character in the string.
along += 1;
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isDestinationPrefixValid", Boolean.valueOf(isValid));
return isValid;
} | [
"private",
"static",
"final",
"boolean",
"isDestinationPrefixValid",
"(",
"String",
"destinationPrefix",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"isDestinationPrefixValid\"",
",",
"destinationPrefix",
")",
";",
"boolean",
"isValid",
"=",
"true",
";",
"// Assume the prefix is valid until we know otherwise.",
"// null indicates that no destination prefix is being used.",
"if",
"(",
"null",
"!=",
"destinationPrefix",
")",
"{",
"// Check for the length first.",
"int",
"len",
"=",
"destinationPrefix",
".",
"length",
"(",
")",
";",
"if",
"(",
"len",
">",
"24",
")",
"{",
"isValid",
"=",
"false",
";",
"}",
"else",
"{",
"// Cycle through each character in the prefix until we find an invalid character, ",
"// or until we come to the end of the string.",
"int",
"along",
"=",
"0",
";",
"while",
"(",
"(",
"along",
"<",
"len",
")",
"&&",
"isValid",
")",
"{",
"char",
"c",
"=",
"destinationPrefix",
".",
"charAt",
"(",
"along",
")",
";",
"if",
"(",
"!",
"(",
"(",
"'",
"'",
"<=",
"c",
")",
"&&",
"(",
"'",
"'",
">=",
"c",
")",
")",
")",
"{",
"if",
"(",
"!",
"(",
"(",
"'",
"'",
"<=",
"c",
")",
"&&",
"(",
"'",
"'",
">=",
"c",
")",
")",
")",
"{",
"if",
"(",
"!",
"(",
"(",
"'",
"'",
"<=",
"c",
")",
"&&",
"(",
"'",
"'",
">=",
"c",
")",
")",
")",
"{",
"if",
"(",
"'",
"'",
"!=",
"c",
"&&",
"'",
"'",
"!=",
"c",
"&&",
"'",
"'",
"!=",
"c",
")",
"{",
"// This character isn't a valid one... ",
"isValid",
"=",
"false",
";",
"}",
"}",
"}",
"}",
"// Move along to the next character in the string.",
"along",
"+=",
"1",
";",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"isDestinationPrefixValid\"",
",",
"Boolean",
".",
"valueOf",
"(",
"isValid",
")",
")",
";",
"return",
"isValid",
";",
"}"
] | Determines whether a destination prefix for a System destination is valid or not.
<p>If the destination prefix has more than 24
characters, then it is invalid.
<p>The destination prefix is invalid if it contains any characters not in the following
list:
<ul>
<li>a-z (lower-case alphas)</li>
<li>A-Z (upper-case alphas)</li>
<li>0-9 (numerics)</li>
<li>. (period)</li>
<li>/ (slash)</li>
<li>% (percent)</li>
</ul>
<p>null and empty string values for a destination prefix are valid, and
simply indicate an empty prefix.
@param destinationPrefix The destination prefix to which the validity
check is applied.
@return true if the destination prefix is valid, false if the destination prefix is
invalid. | [
"Determines",
"whether",
"a",
"destination",
"prefix",
"for",
"a",
"System",
"destination",
"is",
"valid",
"or",
"not",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L5142-L5189 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.getMQLinkPubSubBridgeItemStream | @Override
public ItemStream getMQLinkPubSubBridgeItemStream(String mqLinkUuidStr)
throws SIException
{
MQLinkHandler mqLinkHandler = null;
ItemStream mqLinkPubSubBridgeItemStream = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"getMQLinkPubSubBridgeItemStream", mqLinkUuidStr);
// See if this connection has been closed
checkNotClosed();
if (mqLinkUuidStr == null)
{
SIIncorrectCallException e =
new SIIncorrectCallException(
nls.getFormattedMessage(
"MISSING_PARAM_ERROR_CWSIP0029",
new Object[] { "1:5583:1.347.1.25" },
null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "getMQLinkPubSubBridgeItemStream", e);
}
throw e;
}
SIBUuid8 mqLinkUuid = new SIBUuid8(mqLinkUuidStr);
// Get the destination. It must be localised on this ME
mqLinkHandler = _destinationManager.getMQLinkLocalization(mqLinkUuid, false);
// Check the destination type
if (mqLinkHandler == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMQLinkPubSubBridgeItemStream", "SINotPossibleInCurrentConfigurationException");
throw new SINotPossibleInCurrentConfigurationException(
nls.getFormattedMessage(
"MQLINK_PSB_ERROR_CWSIP0027",
new Object[] {
mqLinkUuid,
_messageProcessor.getMessagingEngineName() },
null));
}
// Got the right kind of handler, now get its itemstream
mqLinkPubSubBridgeItemStream = mqLinkHandler.getMqLinkPubSubBridgeItemStream();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMQLinkPubSubBridgeItemStream", mqLinkPubSubBridgeItemStream);
return mqLinkPubSubBridgeItemStream;
} | java | @Override
public ItemStream getMQLinkPubSubBridgeItemStream(String mqLinkUuidStr)
throws SIException
{
MQLinkHandler mqLinkHandler = null;
ItemStream mqLinkPubSubBridgeItemStream = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"getMQLinkPubSubBridgeItemStream", mqLinkUuidStr);
// See if this connection has been closed
checkNotClosed();
if (mqLinkUuidStr == null)
{
SIIncorrectCallException e =
new SIIncorrectCallException(
nls.getFormattedMessage(
"MISSING_PARAM_ERROR_CWSIP0029",
new Object[] { "1:5583:1.347.1.25" },
null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "getMQLinkPubSubBridgeItemStream", e);
}
throw e;
}
SIBUuid8 mqLinkUuid = new SIBUuid8(mqLinkUuidStr);
// Get the destination. It must be localised on this ME
mqLinkHandler = _destinationManager.getMQLinkLocalization(mqLinkUuid, false);
// Check the destination type
if (mqLinkHandler == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMQLinkPubSubBridgeItemStream", "SINotPossibleInCurrentConfigurationException");
throw new SINotPossibleInCurrentConfigurationException(
nls.getFormattedMessage(
"MQLINK_PSB_ERROR_CWSIP0027",
new Object[] {
mqLinkUuid,
_messageProcessor.getMessagingEngineName() },
null));
}
// Got the right kind of handler, now get its itemstream
mqLinkPubSubBridgeItemStream = mqLinkHandler.getMqLinkPubSubBridgeItemStream();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMQLinkPubSubBridgeItemStream", mqLinkPubSubBridgeItemStream);
return mqLinkPubSubBridgeItemStream;
} | [
"@",
"Override",
"public",
"ItemStream",
"getMQLinkPubSubBridgeItemStream",
"(",
"String",
"mqLinkUuidStr",
")",
"throws",
"SIException",
"{",
"MQLinkHandler",
"mqLinkHandler",
"=",
"null",
";",
"ItemStream",
"mqLinkPubSubBridgeItemStream",
"=",
"null",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getMQLinkPubSubBridgeItemStream\"",
",",
"mqLinkUuidStr",
")",
";",
"// See if this connection has been closed",
"checkNotClosed",
"(",
")",
";",
"if",
"(",
"mqLinkUuidStr",
"==",
"null",
")",
"{",
"SIIncorrectCallException",
"e",
"=",
"new",
"SIIncorrectCallException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"MISSING_PARAM_ERROR_CWSIP0029\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"1:5583:1.347.1.25\"",
"}",
",",
"null",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getMQLinkPubSubBridgeItemStream\"",
",",
"e",
")",
";",
"}",
"throw",
"e",
";",
"}",
"SIBUuid8",
"mqLinkUuid",
"=",
"new",
"SIBUuid8",
"(",
"mqLinkUuidStr",
")",
";",
"// Get the destination. It must be localised on this ME",
"mqLinkHandler",
"=",
"_destinationManager",
".",
"getMQLinkLocalization",
"(",
"mqLinkUuid",
",",
"false",
")",
";",
"// Check the destination type",
"if",
"(",
"mqLinkHandler",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getMQLinkPubSubBridgeItemStream\"",
",",
"\"SINotPossibleInCurrentConfigurationException\"",
")",
";",
"throw",
"new",
"SINotPossibleInCurrentConfigurationException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"MQLINK_PSB_ERROR_CWSIP0027\"",
",",
"new",
"Object",
"[",
"]",
"{",
"mqLinkUuid",
",",
"_messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"}",
"// Got the right kind of handler, now get its itemstream",
"mqLinkPubSubBridgeItemStream",
"=",
"mqLinkHandler",
".",
"getMqLinkPubSubBridgeItemStream",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getMQLinkPubSubBridgeItemStream\"",
",",
"mqLinkPubSubBridgeItemStream",
")",
";",
"return",
"mqLinkPubSubBridgeItemStream",
";",
"}"
] | Retrieves the MQLink's PubSubBridge ItemStream
@param name of the MQLink | [
"Retrieves",
"the",
"MQLink",
"s",
"PubSubBridge",
"ItemStream"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L5823-L5880 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.removeBifurcatedConsumerSession | void removeBifurcatedConsumerSession(BifurcatedConsumerSessionImpl bifurcatedConsumer)
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
SibTr.entry(CoreSPIConnection.tc, "removeBifurcatedConsumerSession",
new Object[] { this, bifurcatedConsumer });
// Remove the consumer from the list.
synchronized (_bifurcatedConsumers)
{
_bifurcatedConsumers.remove(bifurcatedConsumer);
}
if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
SibTr.exit(CoreSPIConnection.tc, "removeBifurcatedConsumerSession");
} | java | void removeBifurcatedConsumerSession(BifurcatedConsumerSessionImpl bifurcatedConsumer)
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
SibTr.entry(CoreSPIConnection.tc, "removeBifurcatedConsumerSession",
new Object[] { this, bifurcatedConsumer });
// Remove the consumer from the list.
synchronized (_bifurcatedConsumers)
{
_bifurcatedConsumers.remove(bifurcatedConsumer);
}
if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
SibTr.exit(CoreSPIConnection.tc, "removeBifurcatedConsumerSession");
} | [
"void",
"removeBifurcatedConsumerSession",
"(",
"BifurcatedConsumerSessionImpl",
"bifurcatedConsumer",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"CoreSPIConnection",
".",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"CoreSPIConnection",
".",
"tc",
",",
"\"removeBifurcatedConsumerSession\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"bifurcatedConsumer",
"}",
")",
";",
"// Remove the consumer from the list.",
"synchronized",
"(",
"_bifurcatedConsumers",
")",
"{",
"_bifurcatedConsumers",
".",
"remove",
"(",
"bifurcatedConsumer",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"CoreSPIConnection",
".",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"CoreSPIConnection",
".",
"tc",
",",
"\"removeBifurcatedConsumerSession\"",
")",
";",
"}"
] | Remove a bifurcated consumer from the connection list.
@param bifurcatedConsumer | [
"Remove",
"a",
"bifurcated",
"consumer",
"from",
"the",
"connection",
"list",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L6025-L6039 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.checkConsumerDiscriminatorAccess | private boolean checkConsumerDiscriminatorAccess(DestinationHandler destination,
String discriminator,
SecurityContext secContext)
throws SIDiscriminatorSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkConsumerDiscriminatorAccess",
new Object[] { destination,
discriminator,
secContext });
boolean allowed = true;
// If the discriminator is non-wildcarded, we can check authority to consume on
// the discriminator.
if (discriminator != null &&
!_messageProcessor.getMessageProcessorMatching().isWildCarded(discriminator))
{
// set the discriminator into the security context
secContext.setDiscriminator(discriminator);
if (!destination.checkDiscriminatorAccess(secContext,
OperationType.RECEIVE))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkConsumerDiscriminatorAccess", "not authorized to consume from this destination's discriminator");
// Write an audit record if access is denied
SibTr.audit(tc, nls.getFormattedMessage(
"USER_NOT_AUTH_RECEIVE_ERROR_CWSIP0310",
new Object[] { destination.getName(),
discriminator,
secContext.getUserName(false) },
null));
allowed = false;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkConsumerDiscriminatorAccess", Boolean.valueOf(allowed));
return allowed;
} | java | private boolean checkConsumerDiscriminatorAccess(DestinationHandler destination,
String discriminator,
SecurityContext secContext)
throws SIDiscriminatorSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkConsumerDiscriminatorAccess",
new Object[] { destination,
discriminator,
secContext });
boolean allowed = true;
// If the discriminator is non-wildcarded, we can check authority to consume on
// the discriminator.
if (discriminator != null &&
!_messageProcessor.getMessageProcessorMatching().isWildCarded(discriminator))
{
// set the discriminator into the security context
secContext.setDiscriminator(discriminator);
if (!destination.checkDiscriminatorAccess(secContext,
OperationType.RECEIVE))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkConsumerDiscriminatorAccess", "not authorized to consume from this destination's discriminator");
// Write an audit record if access is denied
SibTr.audit(tc, nls.getFormattedMessage(
"USER_NOT_AUTH_RECEIVE_ERROR_CWSIP0310",
new Object[] { destination.getName(),
discriminator,
secContext.getUserName(false) },
null));
allowed = false;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkConsumerDiscriminatorAccess", Boolean.valueOf(allowed));
return allowed;
} | [
"private",
"boolean",
"checkConsumerDiscriminatorAccess",
"(",
"DestinationHandler",
"destination",
",",
"String",
"discriminator",
",",
"SecurityContext",
"secContext",
")",
"throws",
"SIDiscriminatorSyntaxException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"checkConsumerDiscriminatorAccess\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destination",
",",
"discriminator",
",",
"secContext",
"}",
")",
";",
"boolean",
"allowed",
"=",
"true",
";",
"// If the discriminator is non-wildcarded, we can check authority to consume on",
"// the discriminator.",
"if",
"(",
"discriminator",
"!=",
"null",
"&&",
"!",
"_messageProcessor",
".",
"getMessageProcessorMatching",
"(",
")",
".",
"isWildCarded",
"(",
"discriminator",
")",
")",
"{",
"// set the discriminator into the security context",
"secContext",
".",
"setDiscriminator",
"(",
"discriminator",
")",
";",
"if",
"(",
"!",
"destination",
".",
"checkDiscriminatorAccess",
"(",
"secContext",
",",
"OperationType",
".",
"RECEIVE",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkConsumerDiscriminatorAccess\"",
",",
"\"not authorized to consume from this destination's discriminator\"",
")",
";",
"// Write an audit record if access is denied",
"SibTr",
".",
"audit",
"(",
"tc",
",",
"nls",
".",
"getFormattedMessage",
"(",
"\"USER_NOT_AUTH_RECEIVE_ERROR_CWSIP0310\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destination",
".",
"getName",
"(",
")",
",",
"discriminator",
",",
"secContext",
".",
"getUserName",
"(",
"false",
")",
"}",
",",
"null",
")",
")",
";",
"allowed",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkConsumerDiscriminatorAccess\"",
",",
"Boolean",
".",
"valueOf",
"(",
"allowed",
")",
")",
";",
"return",
"allowed",
";",
"}"
] | Checks the authority of a consumer to consume from a discriminator | [
"Checks",
"the",
"authority",
"of",
"a",
"consumer",
"to",
"consume",
"from",
"a",
"discriminator"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L6552-L6594 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.checkInquireAuthority | private void checkInquireAuthority(DestinationHandler destination,
String destinationName,
String busName,
SecurityContext secContext,
boolean temporary)
throws SINotAuthorizedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkInquireAuthority",
new Object[] { destination,
destinationName,
busName,
secContext,
Boolean.valueOf(temporary) });
// Check authority to inquire on the destination
if (!temporary) // Non-temorary destination access check
{
if (!destination.checkDestinationAccess(secContext,
OperationType.INQUIRE))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkInquireAuthority", "not authorized to inquire on this destination");
// Get the username
String userName = secContext.getUserName(true);
//Messaging varies dependent on bus versus destination access check
String nlsMessage;
if (destinationName != null)
{
// Build the message for the Exception and the Notification
nlsMessage =
nls.getFormattedMessage("USER_NOT_AUTH_INQUIRE_ERROR_CWSIP0314",
new Object[] { destinationName,
userName },
null);
// Fire a Notification if Eventing is enabled
_accessChecker.
fireDestinationAccessNotAuthorizedEvent(destinationName,
userName,
OperationType.INQUIRE,
nlsMessage);
}
else // foreign bus access
{
// Build the message for the Exception and the Notification
nlsMessage =
nls.getFormattedMessage("USER_NOT_AUTH_INQUIRE_FB_ERROR_CWSIP0315",
new Object[] { busName,
userName },
null);
// Fire a Notification if Eventing is enabled
_accessChecker.
fireDestinationAccessNotAuthorizedEvent(busName,
userName,
OperationType.INQUIRE,
nlsMessage);
}
// Thrown if user denied access to destination
throw new SINotAuthorizedException(nlsMessage);
}
}
else // Check authority to inquire on temp topic
{
// get the temp prefix from the destination name
String destinationPrefix = SIMPUtils.parseTempPrefix(destinationName);
if (!_accessChecker.checkTemporaryDestinationAccess(secContext,
destinationName, // name of destination
(destinationPrefix == null) ? "" : destinationPrefix, // sib.security wants empty string if prefix is null
OperationType.INQUIRE))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkInquireAuthority", "not authorized to inquire on temporary destination");
// Get the username
String userName = secContext.getUserName(true);
// Build the message for the Exception and the Notification
String nlsMessage =
nls.getFormattedMessage("USER_NOT_AUTH_INQUIRE_ERROR_CWSIP0314",
new Object[] { destinationPrefix,
userName },
null);
// Fire a Notification if Eventing is enabled
_accessChecker.
fireDestinationAccessNotAuthorizedEvent(destinationPrefix,
userName,
OperationType.INQUIRE,
nlsMessage);
// Thrown if user denied access to destination
throw new SINotAuthorizedException(nlsMessage);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkInquireAuthority");
} | java | private void checkInquireAuthority(DestinationHandler destination,
String destinationName,
String busName,
SecurityContext secContext,
boolean temporary)
throws SINotAuthorizedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkInquireAuthority",
new Object[] { destination,
destinationName,
busName,
secContext,
Boolean.valueOf(temporary) });
// Check authority to inquire on the destination
if (!temporary) // Non-temorary destination access check
{
if (!destination.checkDestinationAccess(secContext,
OperationType.INQUIRE))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkInquireAuthority", "not authorized to inquire on this destination");
// Get the username
String userName = secContext.getUserName(true);
//Messaging varies dependent on bus versus destination access check
String nlsMessage;
if (destinationName != null)
{
// Build the message for the Exception and the Notification
nlsMessage =
nls.getFormattedMessage("USER_NOT_AUTH_INQUIRE_ERROR_CWSIP0314",
new Object[] { destinationName,
userName },
null);
// Fire a Notification if Eventing is enabled
_accessChecker.
fireDestinationAccessNotAuthorizedEvent(destinationName,
userName,
OperationType.INQUIRE,
nlsMessage);
}
else // foreign bus access
{
// Build the message for the Exception and the Notification
nlsMessage =
nls.getFormattedMessage("USER_NOT_AUTH_INQUIRE_FB_ERROR_CWSIP0315",
new Object[] { busName,
userName },
null);
// Fire a Notification if Eventing is enabled
_accessChecker.
fireDestinationAccessNotAuthorizedEvent(busName,
userName,
OperationType.INQUIRE,
nlsMessage);
}
// Thrown if user denied access to destination
throw new SINotAuthorizedException(nlsMessage);
}
}
else // Check authority to inquire on temp topic
{
// get the temp prefix from the destination name
String destinationPrefix = SIMPUtils.parseTempPrefix(destinationName);
if (!_accessChecker.checkTemporaryDestinationAccess(secContext,
destinationName, // name of destination
(destinationPrefix == null) ? "" : destinationPrefix, // sib.security wants empty string if prefix is null
OperationType.INQUIRE))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkInquireAuthority", "not authorized to inquire on temporary destination");
// Get the username
String userName = secContext.getUserName(true);
// Build the message for the Exception and the Notification
String nlsMessage =
nls.getFormattedMessage("USER_NOT_AUTH_INQUIRE_ERROR_CWSIP0314",
new Object[] { destinationPrefix,
userName },
null);
// Fire a Notification if Eventing is enabled
_accessChecker.
fireDestinationAccessNotAuthorizedEvent(destinationPrefix,
userName,
OperationType.INQUIRE,
nlsMessage);
// Thrown if user denied access to destination
throw new SINotAuthorizedException(nlsMessage);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkInquireAuthority");
} | [
"private",
"void",
"checkInquireAuthority",
"(",
"DestinationHandler",
"destination",
",",
"String",
"destinationName",
",",
"String",
"busName",
",",
"SecurityContext",
"secContext",
",",
"boolean",
"temporary",
")",
"throws",
"SINotAuthorizedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"checkInquireAuthority\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destination",
",",
"destinationName",
",",
"busName",
",",
"secContext",
",",
"Boolean",
".",
"valueOf",
"(",
"temporary",
")",
"}",
")",
";",
"// Check authority to inquire on the destination",
"if",
"(",
"!",
"temporary",
")",
"// Non-temorary destination access check",
"{",
"if",
"(",
"!",
"destination",
".",
"checkDestinationAccess",
"(",
"secContext",
",",
"OperationType",
".",
"INQUIRE",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkInquireAuthority\"",
",",
"\"not authorized to inquire on this destination\"",
")",
";",
"// Get the username",
"String",
"userName",
"=",
"secContext",
".",
"getUserName",
"(",
"true",
")",
";",
"//Messaging varies dependent on bus versus destination access check",
"String",
"nlsMessage",
";",
"if",
"(",
"destinationName",
"!=",
"null",
")",
"{",
"// Build the message for the Exception and the Notification",
"nlsMessage",
"=",
"nls",
".",
"getFormattedMessage",
"(",
"\"USER_NOT_AUTH_INQUIRE_ERROR_CWSIP0314\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destinationName",
",",
"userName",
"}",
",",
"null",
")",
";",
"// Fire a Notification if Eventing is enabled",
"_accessChecker",
".",
"fireDestinationAccessNotAuthorizedEvent",
"(",
"destinationName",
",",
"userName",
",",
"OperationType",
".",
"INQUIRE",
",",
"nlsMessage",
")",
";",
"}",
"else",
"// foreign bus access",
"{",
"// Build the message for the Exception and the Notification",
"nlsMessage",
"=",
"nls",
".",
"getFormattedMessage",
"(",
"\"USER_NOT_AUTH_INQUIRE_FB_ERROR_CWSIP0315\"",
",",
"new",
"Object",
"[",
"]",
"{",
"busName",
",",
"userName",
"}",
",",
"null",
")",
";",
"// Fire a Notification if Eventing is enabled",
"_accessChecker",
".",
"fireDestinationAccessNotAuthorizedEvent",
"(",
"busName",
",",
"userName",
",",
"OperationType",
".",
"INQUIRE",
",",
"nlsMessage",
")",
";",
"}",
"// Thrown if user denied access to destination",
"throw",
"new",
"SINotAuthorizedException",
"(",
"nlsMessage",
")",
";",
"}",
"}",
"else",
"// Check authority to inquire on temp topic",
"{",
"// get the temp prefix from the destination name",
"String",
"destinationPrefix",
"=",
"SIMPUtils",
".",
"parseTempPrefix",
"(",
"destinationName",
")",
";",
"if",
"(",
"!",
"_accessChecker",
".",
"checkTemporaryDestinationAccess",
"(",
"secContext",
",",
"destinationName",
",",
"// name of destination",
"(",
"destinationPrefix",
"==",
"null",
")",
"?",
"\"\"",
":",
"destinationPrefix",
",",
"// sib.security wants empty string if prefix is null",
"OperationType",
".",
"INQUIRE",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkInquireAuthority\"",
",",
"\"not authorized to inquire on temporary destination\"",
")",
";",
"// Get the username",
"String",
"userName",
"=",
"secContext",
".",
"getUserName",
"(",
"true",
")",
";",
"// Build the message for the Exception and the Notification",
"String",
"nlsMessage",
"=",
"nls",
".",
"getFormattedMessage",
"(",
"\"USER_NOT_AUTH_INQUIRE_ERROR_CWSIP0314\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destinationPrefix",
",",
"userName",
"}",
",",
"null",
")",
";",
"// Fire a Notification if Eventing is enabled",
"_accessChecker",
".",
"fireDestinationAccessNotAuthorizedEvent",
"(",
"destinationPrefix",
",",
"userName",
",",
"OperationType",
".",
"INQUIRE",
",",
"nlsMessage",
")",
";",
"// Thrown if user denied access to destination",
"throw",
"new",
"SINotAuthorizedException",
"(",
"nlsMessage",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkInquireAuthority\"",
")",
";",
"}"
] | Checks the authority to inquire on a destination | [
"Checks",
"the",
"authority",
"to",
"inquire",
"on",
"a",
"destination"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L6703-L6807 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.isSIBServerSubject | private boolean isSIBServerSubject()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isSIBServerSubject");
boolean ispriv = false;
if (_subject != null)
ispriv = _messageProcessor.getAuthorisationUtils().isSIBServerSubject(_subject);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isSIBServerSubject", Boolean.valueOf(ispriv));
return ispriv;
} | java | private boolean isSIBServerSubject()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isSIBServerSubject");
boolean ispriv = false;
if (_subject != null)
ispriv = _messageProcessor.getAuthorisationUtils().isSIBServerSubject(_subject);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isSIBServerSubject", Boolean.valueOf(ispriv));
return ispriv;
} | [
"private",
"boolean",
"isSIBServerSubject",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"isSIBServerSubject\"",
")",
";",
"boolean",
"ispriv",
"=",
"false",
";",
"if",
"(",
"_subject",
"!=",
"null",
")",
"ispriv",
"=",
"_messageProcessor",
".",
"getAuthorisationUtils",
"(",
")",
".",
"isSIBServerSubject",
"(",
"_subject",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"isSIBServerSubject\"",
",",
"Boolean",
".",
"valueOf",
"(",
"ispriv",
")",
")",
";",
"return",
"ispriv",
";",
"}"
] | Returns true if the subject associated with the connection is the
privileged SIBServerSubject.
@return true if SIBServerSubject | [
"Returns",
"true",
"if",
"the",
"subject",
"associated",
"with",
"the",
"connection",
"is",
"the",
"privileged",
"SIBServerSubject",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L6955-L6969 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.isMulticastEnabled | @Override
public boolean isMulticastEnabled()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isMulticastEnabled");
boolean enabled = _messageProcessor.isMulticastEnabled();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isMulticastEnabled", Boolean.valueOf(enabled));
return enabled;
} | java | @Override
public boolean isMulticastEnabled()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isMulticastEnabled");
boolean enabled = _messageProcessor.isMulticastEnabled();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isMulticastEnabled", Boolean.valueOf(enabled));
return enabled;
} | [
"@",
"Override",
"public",
"boolean",
"isMulticastEnabled",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"isMulticastEnabled\"",
")",
";",
"boolean",
"enabled",
"=",
"_messageProcessor",
".",
"isMulticastEnabled",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"isMulticastEnabled\"",
",",
"Boolean",
".",
"valueOf",
"(",
"enabled",
")",
")",
";",
"return",
"enabled",
";",
"}"
] | Returns true if multicast is enabled | [
"Returns",
"true",
"if",
"multicast",
"is",
"enabled"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L6974-L6985 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.getMulticastProperties | @Override
public MulticastProperties getMulticastProperties()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getMulticastProperties");
MulticastProperties props = _messageProcessor.getMulticastProperties();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMulticastProperties", props);
return props;
} | java | @Override
public MulticastProperties getMulticastProperties()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getMulticastProperties");
MulticastProperties props = _messageProcessor.getMulticastProperties();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMulticastProperties", props);
return props;
} | [
"@",
"Override",
"public",
"MulticastProperties",
"getMulticastProperties",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getMulticastProperties\"",
")",
";",
"MulticastProperties",
"props",
"=",
"_messageProcessor",
".",
"getMulticastProperties",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getMulticastProperties\"",
",",
"props",
")",
";",
"return",
"props",
";",
"}"
] | Returns the MulticastProperties for this messaging engine
null if multicast is not enabled. | [
"Returns",
"the",
"MulticastProperties",
"for",
"this",
"messaging",
"engine",
"null",
"if",
"multicast",
"is",
"not",
"enabled",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L6991-L7003 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.checkDestinationAccess | private void checkDestinationAccess(DestinationHandler destination,
String destinationName,
String busName,
SecurityContext secContext)
throws SINotAuthorizedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkDestinationAccess",
new Object[] { destination,
destinationName,
busName,
secContext });
// Check authority to produce to destination
if (!destination.checkDestinationAccess(secContext,
OperationType.SEND))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDestinationAccess", "not authorized to produce to this destination");
// Thrown if user denied access to destination
SIMPNotAuthorizedException e = new SIMPNotAuthorizedException(
nls_cwsik.getFormattedMessage(
"DELIVERY_ERROR_SIRC_18", // USER_NOT_AUTH_SEND_ERROR_CWSIP0306
new Object[] { destinationName,
secContext.getUserName(false) },
null));
e.setExceptionReason(SIRCConstants.SIRC0018_USER_NOT_AUTH_SEND_ERROR);
e.setExceptionInserts(new String[] { destinationName, secContext.getUserName(false) });
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDestinationAccess");
} | java | private void checkDestinationAccess(DestinationHandler destination,
String destinationName,
String busName,
SecurityContext secContext)
throws SINotAuthorizedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkDestinationAccess",
new Object[] { destination,
destinationName,
busName,
secContext });
// Check authority to produce to destination
if (!destination.checkDestinationAccess(secContext,
OperationType.SEND))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDestinationAccess", "not authorized to produce to this destination");
// Thrown if user denied access to destination
SIMPNotAuthorizedException e = new SIMPNotAuthorizedException(
nls_cwsik.getFormattedMessage(
"DELIVERY_ERROR_SIRC_18", // USER_NOT_AUTH_SEND_ERROR_CWSIP0306
new Object[] { destinationName,
secContext.getUserName(false) },
null));
e.setExceptionReason(SIRCConstants.SIRC0018_USER_NOT_AUTH_SEND_ERROR);
e.setExceptionInserts(new String[] { destinationName, secContext.getUserName(false) });
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDestinationAccess");
} | [
"private",
"void",
"checkDestinationAccess",
"(",
"DestinationHandler",
"destination",
",",
"String",
"destinationName",
",",
"String",
"busName",
",",
"SecurityContext",
"secContext",
")",
"throws",
"SINotAuthorizedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"checkDestinationAccess\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destination",
",",
"destinationName",
",",
"busName",
",",
"secContext",
"}",
")",
";",
"// Check authority to produce to destination",
"if",
"(",
"!",
"destination",
".",
"checkDestinationAccess",
"(",
"secContext",
",",
"OperationType",
".",
"SEND",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkDestinationAccess\"",
",",
"\"not authorized to produce to this destination\"",
")",
";",
"// Thrown if user denied access to destination",
"SIMPNotAuthorizedException",
"e",
"=",
"new",
"SIMPNotAuthorizedException",
"(",
"nls_cwsik",
".",
"getFormattedMessage",
"(",
"\"DELIVERY_ERROR_SIRC_18\"",
",",
"// USER_NOT_AUTH_SEND_ERROR_CWSIP0306",
"new",
"Object",
"[",
"]",
"{",
"destinationName",
",",
"secContext",
".",
"getUserName",
"(",
"false",
")",
"}",
",",
"null",
")",
")",
";",
"e",
".",
"setExceptionReason",
"(",
"SIRCConstants",
".",
"SIRC0018_USER_NOT_AUTH_SEND_ERROR",
")",
";",
"e",
".",
"setExceptionInserts",
"(",
"new",
"String",
"[",
"]",
"{",
"destinationName",
",",
"secContext",
".",
"getUserName",
"(",
"false",
")",
"}",
")",
";",
"throw",
"e",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkDestinationAccess\"",
")",
";",
"}"
] | Checks the authority of a producer to produce to a destination | [
"Checks",
"the",
"authority",
"of",
"a",
"producer",
"to",
"produce",
"to",
"a",
"destination"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L7331-L7369 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.getSubscription | @Override
public MPSubscription getSubscription(String subscriptionName)
throws SIDurableSubscriptionNotFoundException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"getSubscription",
subscriptionName);
HashMap durableSubs = _destinationManager.getDurableSubscriptionsTable();
ConsumerDispatcher cd = null;
synchronized (durableSubs)
{
//Look up the consumer dispatcher for this subId in the system durable subs list
cd =
(ConsumerDispatcher) durableSubs.get(subscriptionName);
// Check that the durable subscription exists
if (cd == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getSubscription", "Durable sub not found");
throw new SIDurableSubscriptionNotFoundException(
nls.getFormattedMessage(
"SUBSCRIPTION_DOESNT_EXIST_ERROR_CWSIP0072",
new Object[] { subscriptionName,
_messageProcessor.getMessagingEngineName() },
null));
}
}
MPSubscription mpSubscription = cd.getMPSubscription();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getSubscription", mpSubscription);
return mpSubscription;
} | java | @Override
public MPSubscription getSubscription(String subscriptionName)
throws SIDurableSubscriptionNotFoundException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"getSubscription",
subscriptionName);
HashMap durableSubs = _destinationManager.getDurableSubscriptionsTable();
ConsumerDispatcher cd = null;
synchronized (durableSubs)
{
//Look up the consumer dispatcher for this subId in the system durable subs list
cd =
(ConsumerDispatcher) durableSubs.get(subscriptionName);
// Check that the durable subscription exists
if (cd == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getSubscription", "Durable sub not found");
throw new SIDurableSubscriptionNotFoundException(
nls.getFormattedMessage(
"SUBSCRIPTION_DOESNT_EXIST_ERROR_CWSIP0072",
new Object[] { subscriptionName,
_messageProcessor.getMessagingEngineName() },
null));
}
}
MPSubscription mpSubscription = cd.getMPSubscription();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getSubscription", mpSubscription);
return mpSubscription;
} | [
"@",
"Override",
"public",
"MPSubscription",
"getSubscription",
"(",
"String",
"subscriptionName",
")",
"throws",
"SIDurableSubscriptionNotFoundException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getSubscription\"",
",",
"subscriptionName",
")",
";",
"HashMap",
"durableSubs",
"=",
"_destinationManager",
".",
"getDurableSubscriptionsTable",
"(",
")",
";",
"ConsumerDispatcher",
"cd",
"=",
"null",
";",
"synchronized",
"(",
"durableSubs",
")",
"{",
"//Look up the consumer dispatcher for this subId in the system durable subs list",
"cd",
"=",
"(",
"ConsumerDispatcher",
")",
"durableSubs",
".",
"get",
"(",
"subscriptionName",
")",
";",
"// Check that the durable subscription exists",
"if",
"(",
"cd",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getSubscription\"",
",",
"\"Durable sub not found\"",
")",
";",
"throw",
"new",
"SIDurableSubscriptionNotFoundException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"SUBSCRIPTION_DOESNT_EXIST_ERROR_CWSIP0072\"",
",",
"new",
"Object",
"[",
"]",
"{",
"subscriptionName",
",",
"_messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"}",
"}",
"MPSubscription",
"mpSubscription",
"=",
"cd",
".",
"getMPSubscription",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getSubscription\"",
",",
"mpSubscription",
")",
";",
"return",
"mpSubscription",
";",
"}"
] | Retrieve the MPSubscription object that represents the named durable subscription
This function is only available on locally homed subscriptions | [
"Retrieve",
"the",
"MPSubscription",
"object",
"that",
"represents",
"the",
"named",
"durable",
"subscription"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L7376-L7415 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.deregisterConsumerSetMonitor | @Override
public void deregisterConsumerSetMonitor(
ConsumerSetChangeCallback callback)
throws SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"deregisterConsumerSetMonitor",
new Object[] { callback });
_messageProcessor.
getMessageProcessorMatching().
deregisterConsumerSetMonitor(this, callback);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deregisterConsumerSetMonitor");
} | java | @Override
public void deregisterConsumerSetMonitor(
ConsumerSetChangeCallback callback)
throws SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"deregisterConsumerSetMonitor",
new Object[] { callback });
_messageProcessor.
getMessageProcessorMatching().
deregisterConsumerSetMonitor(this, callback);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deregisterConsumerSetMonitor");
} | [
"@",
"Override",
"public",
"void",
"deregisterConsumerSetMonitor",
"(",
"ConsumerSetChangeCallback",
"callback",
")",
"throws",
"SINotPossibleInCurrentConfigurationException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"deregisterConsumerSetMonitor\"",
",",
"new",
"Object",
"[",
"]",
"{",
"callback",
"}",
")",
";",
"_messageProcessor",
".",
"getMessageProcessorMatching",
"(",
")",
".",
"deregisterConsumerSetMonitor",
"(",
"this",
",",
"callback",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"deregisterConsumerSetMonitor\"",
")",
";",
"}"
] | Deregisters a previously registered callback. | [
"Deregisters",
"a",
"previously",
"registered",
"callback",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L7744-L7761 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.getConnectionProperties | public Map getConnectionProperties()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getConnectionProperties");
SibTr.exit(tc, "getConnectionProperties", _connectionProperties);
}
return _connectionProperties;
} | java | public Map getConnectionProperties()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getConnectionProperties");
SibTr.exit(tc, "getConnectionProperties", _connectionProperties);
}
return _connectionProperties;
} | [
"public",
"Map",
"getConnectionProperties",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getConnectionProperties\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getConnectionProperties\"",
",",
"_connectionProperties",
")",
";",
"}",
"return",
"_connectionProperties",
";",
"}"
] | Retrieve the properties associated with this connection. | [
"Retrieve",
"the",
"properties",
"associated",
"with",
"this",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L7789-L7797 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java | ConnectionImpl.setConnectionProperties | public void setConnectionProperties(Map connectionProperties)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getConnectionProperties", connectionProperties);
SibTr.exit(tc, "getConnectionProperties");
}
_connectionProperties = connectionProperties;
} | java | public void setConnectionProperties(Map connectionProperties)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getConnectionProperties", connectionProperties);
SibTr.exit(tc, "getConnectionProperties");
}
_connectionProperties = connectionProperties;
} | [
"public",
"void",
"setConnectionProperties",
"(",
"Map",
"connectionProperties",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getConnectionProperties\"",
",",
"connectionProperties",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getConnectionProperties\"",
")",
";",
"}",
"_connectionProperties",
"=",
"connectionProperties",
";",
"}"
] | Set the properties associated with this connection. Supports Unittest environment. | [
"Set",
"the",
"properties",
"associated",
"with",
"this",
"connection",
".",
"Supports",
"Unittest",
"environment",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java#L7802-L7810 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/CHFWEventHandler.java | CHFWEventHandler.stopChain | private void stopChain(String name, Event event) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Stop chain event; chain=" + name);
}
ChannelFramework cf = ChannelFrameworkFactory.getChannelFramework();
try {
if (cf.isChainRunning(name)) {
// stop the chain now..
cf.stopChain(name, 0L);
}
} catch (Exception e) {
FFDCFilter.processException(e, getClass().getName(), "stopChain", new Object[] { event, cf });
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Error stopping chain; " + e);
}
}
} | java | private void stopChain(String name, Event event) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Stop chain event; chain=" + name);
}
ChannelFramework cf = ChannelFrameworkFactory.getChannelFramework();
try {
if (cf.isChainRunning(name)) {
// stop the chain now..
cf.stopChain(name, 0L);
}
} catch (Exception e) {
FFDCFilter.processException(e, getClass().getName(), "stopChain", new Object[] { event, cf });
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Error stopping chain; " + e);
}
}
} | [
"private",
"void",
"stopChain",
"(",
"String",
"name",
",",
"Event",
"event",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Stop chain event; chain=\"",
"+",
"name",
")",
";",
"}",
"ChannelFramework",
"cf",
"=",
"ChannelFrameworkFactory",
".",
"getChannelFramework",
"(",
")",
";",
"try",
"{",
"if",
"(",
"cf",
".",
"isChainRunning",
"(",
"name",
")",
")",
"{",
"// stop the chain now.. ",
"cf",
".",
"stopChain",
"(",
"name",
",",
"0L",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"stopChain\"",
",",
"new",
"Object",
"[",
"]",
"{",
"event",
",",
"cf",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Error stopping chain; \"",
"+",
"e",
")",
";",
"}",
"}",
"}"
] | Stop the explicit chain provided.
@param name
@param event | [
"Stop",
"the",
"explicit",
"chain",
"provided",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/CHFWEventHandler.java#L90-L106 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/builder/WebServiceRefInfoBuilder.java | WebServiceRefInfoBuilder.buildPartialInfoFromWebServiceClient | private static WebServiceRefPartialInfo buildPartialInfoFromWebServiceClient(Class<?> serviceInterfaceClass) {
WebServiceClient webServiceClient = serviceInterfaceClass.getAnnotation(WebServiceClient.class);
if (webServiceClient == null) {
return null;
}
String className = serviceInterfaceClass.getName();
String wsdlLocation = webServiceClient.wsdlLocation();
QName serviceQName = null;
String localPart = webServiceClient.name();
if (localPart != null) {
serviceQName = new QName(webServiceClient.targetNamespace(), localPart);
}
String handlerChainDeclaringClassName = null;
javax.jws.HandlerChain handlerChainAnnotation = serviceInterfaceClass.getAnnotation(javax.jws.HandlerChain.class);
if (handlerChainAnnotation != null)
handlerChainDeclaringClassName = serviceInterfaceClass.getName();
WebServiceRefPartialInfo partialInfo = new WebServiceRefPartialInfo(className, wsdlLocation, serviceQName, null, handlerChainDeclaringClassName, handlerChainAnnotation);
return partialInfo;
} | java | private static WebServiceRefPartialInfo buildPartialInfoFromWebServiceClient(Class<?> serviceInterfaceClass) {
WebServiceClient webServiceClient = serviceInterfaceClass.getAnnotation(WebServiceClient.class);
if (webServiceClient == null) {
return null;
}
String className = serviceInterfaceClass.getName();
String wsdlLocation = webServiceClient.wsdlLocation();
QName serviceQName = null;
String localPart = webServiceClient.name();
if (localPart != null) {
serviceQName = new QName(webServiceClient.targetNamespace(), localPart);
}
String handlerChainDeclaringClassName = null;
javax.jws.HandlerChain handlerChainAnnotation = serviceInterfaceClass.getAnnotation(javax.jws.HandlerChain.class);
if (handlerChainAnnotation != null)
handlerChainDeclaringClassName = serviceInterfaceClass.getName();
WebServiceRefPartialInfo partialInfo = new WebServiceRefPartialInfo(className, wsdlLocation, serviceQName, null, handlerChainDeclaringClassName, handlerChainAnnotation);
return partialInfo;
} | [
"private",
"static",
"WebServiceRefPartialInfo",
"buildPartialInfoFromWebServiceClient",
"(",
"Class",
"<",
"?",
">",
"serviceInterfaceClass",
")",
"{",
"WebServiceClient",
"webServiceClient",
"=",
"serviceInterfaceClass",
".",
"getAnnotation",
"(",
"WebServiceClient",
".",
"class",
")",
";",
"if",
"(",
"webServiceClient",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"className",
"=",
"serviceInterfaceClass",
".",
"getName",
"(",
")",
";",
"String",
"wsdlLocation",
"=",
"webServiceClient",
".",
"wsdlLocation",
"(",
")",
";",
"QName",
"serviceQName",
"=",
"null",
";",
"String",
"localPart",
"=",
"webServiceClient",
".",
"name",
"(",
")",
";",
"if",
"(",
"localPart",
"!=",
"null",
")",
"{",
"serviceQName",
"=",
"new",
"QName",
"(",
"webServiceClient",
".",
"targetNamespace",
"(",
")",
",",
"localPart",
")",
";",
"}",
"String",
"handlerChainDeclaringClassName",
"=",
"null",
";",
"javax",
".",
"jws",
".",
"HandlerChain",
"handlerChainAnnotation",
"=",
"serviceInterfaceClass",
".",
"getAnnotation",
"(",
"javax",
".",
"jws",
".",
"HandlerChain",
".",
"class",
")",
";",
"if",
"(",
"handlerChainAnnotation",
"!=",
"null",
")",
"handlerChainDeclaringClassName",
"=",
"serviceInterfaceClass",
".",
"getName",
"(",
")",
";",
"WebServiceRefPartialInfo",
"partialInfo",
"=",
"new",
"WebServiceRefPartialInfo",
"(",
"className",
",",
"wsdlLocation",
",",
"serviceQName",
",",
"null",
",",
"handlerChainDeclaringClassName",
",",
"handlerChainAnnotation",
")",
";",
"return",
"partialInfo",
";",
"}"
] | This method will build a ServiceRefPartialInfo object from a class with an
@WebServiceClient annotation. | [
"This",
"method",
"will",
"build",
"a",
"ServiceRefPartialInfo",
"object",
"from",
"a",
"class",
"with",
"an"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/builder/WebServiceRefInfoBuilder.java#L238-L258 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigurationList.java | ConfigurationList.collectElementsById | public Map<ConfigID, List<T>> collectElementsById(Map<ConfigID, List<T>> map, String defaultId, String pid) {
if (map == null) {
map = new HashMap<ConfigID, List<T>>();
}
int index = 0;
for (T configElement : configElements) {
String id = configElement.getId();
if (id == null) {
if (defaultId != null) {
id = defaultId;
} else {
id = generateId(index++);
}
}
// Create a new config ID based on the old one, but using the generated ID if necessary
ConfigID configID = configElement.getConfigID();
configID = new ConfigID(configID.getParent(), pid, id, configID.getChildAttribute());
List<T> elements = map.get(configID);
if (elements == null) {
elements = new ArrayList<T>();
map.put(configID, elements);
}
elements.add(configElement);
}
return map;
} | java | public Map<ConfigID, List<T>> collectElementsById(Map<ConfigID, List<T>> map, String defaultId, String pid) {
if (map == null) {
map = new HashMap<ConfigID, List<T>>();
}
int index = 0;
for (T configElement : configElements) {
String id = configElement.getId();
if (id == null) {
if (defaultId != null) {
id = defaultId;
} else {
id = generateId(index++);
}
}
// Create a new config ID based on the old one, but using the generated ID if necessary
ConfigID configID = configElement.getConfigID();
configID = new ConfigID(configID.getParent(), pid, id, configID.getChildAttribute());
List<T> elements = map.get(configID);
if (elements == null) {
elements = new ArrayList<T>();
map.put(configID, elements);
}
elements.add(configElement);
}
return map;
} | [
"public",
"Map",
"<",
"ConfigID",
",",
"List",
"<",
"T",
">",
">",
"collectElementsById",
"(",
"Map",
"<",
"ConfigID",
",",
"List",
"<",
"T",
">",
">",
"map",
",",
"String",
"defaultId",
",",
"String",
"pid",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"map",
"=",
"new",
"HashMap",
"<",
"ConfigID",
",",
"List",
"<",
"T",
">",
">",
"(",
")",
";",
"}",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"T",
"configElement",
":",
"configElements",
")",
"{",
"String",
"id",
"=",
"configElement",
".",
"getId",
"(",
")",
";",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"if",
"(",
"defaultId",
"!=",
"null",
")",
"{",
"id",
"=",
"defaultId",
";",
"}",
"else",
"{",
"id",
"=",
"generateId",
"(",
"index",
"++",
")",
";",
"}",
"}",
"// Create a new config ID based on the old one, but using the generated ID if necessary",
"ConfigID",
"configID",
"=",
"configElement",
".",
"getConfigID",
"(",
")",
";",
"configID",
"=",
"new",
"ConfigID",
"(",
"configID",
".",
"getParent",
"(",
")",
",",
"pid",
",",
"id",
",",
"configID",
".",
"getChildAttribute",
"(",
")",
")",
";",
"List",
"<",
"T",
">",
"elements",
"=",
"map",
".",
"get",
"(",
"configID",
")",
";",
"if",
"(",
"elements",
"==",
"null",
")",
"{",
"elements",
"=",
"new",
"ArrayList",
"<",
"T",
">",
"(",
")",
";",
"map",
".",
"put",
"(",
"configID",
",",
"elements",
")",
";",
"}",
"elements",
".",
"add",
"(",
"configElement",
")",
";",
"}",
"return",
"map",
";",
"}"
] | Collects elements into Lists based on their ID. If an ID is not specified, the defaultId will be used.
If the defaultId is null, an id will be generated.
@param map
@param defaultId
@return | [
"Collects",
"elements",
"into",
"Lists",
"based",
"on",
"their",
"ID",
".",
"If",
"an",
"ID",
"is",
"not",
"specified",
"the",
"defaultId",
"will",
"be",
"used",
".",
"If",
"the",
"defaultId",
"is",
"null",
"an",
"id",
"will",
"be",
"generated",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigurationList.java#L107-L135 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java | ArrayUtil.readLong | public static long readLong(byte b[], int offset) {
long retValue;
retValue = ((long)b[offset++]) << 56;
retValue |= ((long)b[offset++] & 0xff) << 48;
retValue |= ((long)b[offset++] & 0xff) << 40;
retValue |= ((long)b[offset++] & 0xff) << 32;
retValue |= ((long)b[offset++] & 0xff) << 24;
retValue |= ((long)b[offset++] & 0xff) << 16;
retValue |= ((long)b[offset++] & 0xff) << 8;
retValue |= (long)b[offset] & 0xff;
return retValue;
} | java | public static long readLong(byte b[], int offset) {
long retValue;
retValue = ((long)b[offset++]) << 56;
retValue |= ((long)b[offset++] & 0xff) << 48;
retValue |= ((long)b[offset++] & 0xff) << 40;
retValue |= ((long)b[offset++] & 0xff) << 32;
retValue |= ((long)b[offset++] & 0xff) << 24;
retValue |= ((long)b[offset++] & 0xff) << 16;
retValue |= ((long)b[offset++] & 0xff) << 8;
retValue |= (long)b[offset] & 0xff;
return retValue;
} | [
"public",
"static",
"long",
"readLong",
"(",
"byte",
"b",
"[",
"]",
",",
"int",
"offset",
")",
"{",
"long",
"retValue",
";",
"retValue",
"=",
"(",
"(",
"long",
")",
"b",
"[",
"offset",
"++",
"]",
")",
"<<",
"56",
";",
"retValue",
"|=",
"(",
"(",
"long",
")",
"b",
"[",
"offset",
"++",
"]",
"&",
"0xff",
")",
"<<",
"48",
";",
"retValue",
"|=",
"(",
"(",
"long",
")",
"b",
"[",
"offset",
"++",
"]",
"&",
"0xff",
")",
"<<",
"40",
";",
"retValue",
"|=",
"(",
"(",
"long",
")",
"b",
"[",
"offset",
"++",
"]",
"&",
"0xff",
")",
"<<",
"32",
";",
"retValue",
"|=",
"(",
"(",
"long",
")",
"b",
"[",
"offset",
"++",
"]",
"&",
"0xff",
")",
"<<",
"24",
";",
"retValue",
"|=",
"(",
"(",
"long",
")",
"b",
"[",
"offset",
"++",
"]",
"&",
"0xff",
")",
"<<",
"16",
";",
"retValue",
"|=",
"(",
"(",
"long",
")",
"b",
"[",
"offset",
"++",
"]",
"&",
"0xff",
")",
"<<",
"8",
";",
"retValue",
"|=",
"(",
"long",
")",
"b",
"[",
"offset",
"]",
"&",
"0xff",
";",
"return",
"retValue",
";",
"}"
] | Unserializes a long from a byte array at a specific offset in big-endian order
@param b byte array from which to read a long value.
@param offset offset within byte array to start reading.
@return long read from byte array. | [
"Unserializes",
"a",
"long",
"from",
"a",
"byte",
"array",
"at",
"a",
"specific",
"offset",
"in",
"big",
"-",
"endian",
"order"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java#L46-L59 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java | ArrayUtil.writeLong | public static void writeLong(byte b[], int offset, long value) {
b[offset++] = (byte) (value >>> 56);
b[offset++] = (byte) (value >>> 48);
b[offset++] = (byte) (value >>> 40);
b[offset++] = (byte) (value >>> 32);
b[offset++] = (byte) (value >>> 24);
b[offset++] = (byte) (value >>> 16);
b[offset++] = (byte) (value >>> 8);
b[offset] = (byte)value;
} | java | public static void writeLong(byte b[], int offset, long value) {
b[offset++] = (byte) (value >>> 56);
b[offset++] = (byte) (value >>> 48);
b[offset++] = (byte) (value >>> 40);
b[offset++] = (byte) (value >>> 32);
b[offset++] = (byte) (value >>> 24);
b[offset++] = (byte) (value >>> 16);
b[offset++] = (byte) (value >>> 8);
b[offset] = (byte)value;
} | [
"public",
"static",
"void",
"writeLong",
"(",
"byte",
"b",
"[",
"]",
",",
"int",
"offset",
",",
"long",
"value",
")",
"{",
"b",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"56",
")",
";",
"b",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"48",
")",
";",
"b",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"40",
")",
";",
"b",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"32",
")",
";",
"b",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"24",
")",
";",
"b",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"16",
")",
";",
"b",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"8",
")",
";",
"b",
"[",
"offset",
"]",
"=",
"(",
"byte",
")",
"value",
";",
"}"
] | Serializes a long into a byte array at a specific offset in big-endian order
@param b byte array in which to write a long value.
@param offset offset within byte array to start writing.
@param value long to write to byte array. | [
"Serializes",
"a",
"long",
"into",
"a",
"byte",
"array",
"at",
"a",
"specific",
"offset",
"in",
"big",
"-",
"endian",
"order"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java#L68-L77 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java | ArrayUtil.readInt | public static int readInt(byte b[], int offset) {
int retValue;
retValue = ((int)b[offset++]) << 24;
retValue |= ((int)b[offset++] & 0xff) << 16;
retValue |= ((int)b[offset++] & 0xff) << 8;
retValue |= (int)b[offset] & 0xff;
return retValue;
} | java | public static int readInt(byte b[], int offset) {
int retValue;
retValue = ((int)b[offset++]) << 24;
retValue |= ((int)b[offset++] & 0xff) << 16;
retValue |= ((int)b[offset++] & 0xff) << 8;
retValue |= (int)b[offset] & 0xff;
return retValue;
} | [
"public",
"static",
"int",
"readInt",
"(",
"byte",
"b",
"[",
"]",
",",
"int",
"offset",
")",
"{",
"int",
"retValue",
";",
"retValue",
"=",
"(",
"(",
"int",
")",
"b",
"[",
"offset",
"++",
"]",
")",
"<<",
"24",
";",
"retValue",
"|=",
"(",
"(",
"int",
")",
"b",
"[",
"offset",
"++",
"]",
"&",
"0xff",
")",
"<<",
"16",
";",
"retValue",
"|=",
"(",
"(",
"int",
")",
"b",
"[",
"offset",
"++",
"]",
"&",
"0xff",
")",
"<<",
"8",
";",
"retValue",
"|=",
"(",
"int",
")",
"b",
"[",
"offset",
"]",
"&",
"0xff",
";",
"return",
"retValue",
";",
"}"
] | Unserializes an int from a byte array at a specific offset in big-endian order
@param b byte array from which to read an int value.
@param offset offset within byte array to start reading.
@return int read from byte array. | [
"Unserializes",
"an",
"int",
"from",
"a",
"byte",
"array",
"at",
"a",
"specific",
"offset",
"in",
"big",
"-",
"endian",
"order"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java#L86-L95 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java | ArrayUtil.writeInt | public static void writeInt(byte[] b, int offset, int value) {
b[offset++] = (byte) (value >>> 24);
b[offset++] = (byte) (value >>> 16);
b[offset++] = (byte) (value >>> 8);
b[offset] = (byte)value;
} | java | public static void writeInt(byte[] b, int offset, int value) {
b[offset++] = (byte) (value >>> 24);
b[offset++] = (byte) (value >>> 16);
b[offset++] = (byte) (value >>> 8);
b[offset] = (byte)value;
} | [
"public",
"static",
"void",
"writeInt",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"offset",
",",
"int",
"value",
")",
"{",
"b",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"24",
")",
";",
"b",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"16",
")",
";",
"b",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"8",
")",
";",
"b",
"[",
"offset",
"]",
"=",
"(",
"byte",
")",
"value",
";",
"}"
] | Serializes an int into a byte array at a specific offset in big-endian order
@param b byte array in which to write an int value.
@param offset offset within byte array to start writing.
@param value int to write to byte array. | [
"Serializes",
"an",
"int",
"into",
"a",
"byte",
"array",
"at",
"a",
"specific",
"offset",
"in",
"big",
"-",
"endian",
"order"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java#L104-L109 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java | ArrayUtil.readShort | public static short readShort(byte b[], int offset) {
int retValue;
retValue = b[offset++] << 8;
retValue |= b[offset] & 0xff;
return (short)retValue;
} | java | public static short readShort(byte b[], int offset) {
int retValue;
retValue = b[offset++] << 8;
retValue |= b[offset] & 0xff;
return (short)retValue;
} | [
"public",
"static",
"short",
"readShort",
"(",
"byte",
"b",
"[",
"]",
",",
"int",
"offset",
")",
"{",
"int",
"retValue",
";",
"retValue",
"=",
"b",
"[",
"offset",
"++",
"]",
"<<",
"8",
";",
"retValue",
"|=",
"b",
"[",
"offset",
"]",
"&",
"0xff",
";",
"return",
"(",
"short",
")",
"retValue",
";",
"}"
] | Unserializes a short from a byte array at a specific offset in big-endian order
@param b byte array from which to read a short value.
@param offset offset within byte array to start reading.
@return short read from byte array. | [
"Unserializes",
"a",
"short",
"from",
"a",
"byte",
"array",
"at",
"a",
"specific",
"offset",
"in",
"big",
"-",
"endian",
"order"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java#L118-L125 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java | ArrayUtil.writeShort | public static void writeShort(byte b[], int offset, short value) {
b[offset++] = (byte) (value >>> 8);
b[offset] = (byte)value;
} | java | public static void writeShort(byte b[], int offset, short value) {
b[offset++] = (byte) (value >>> 8);
b[offset] = (byte)value;
} | [
"public",
"static",
"void",
"writeShort",
"(",
"byte",
"b",
"[",
"]",
",",
"int",
"offset",
",",
"short",
"value",
")",
"{",
"b",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"8",
")",
";",
"b",
"[",
"offset",
"]",
"=",
"(",
"byte",
")",
"value",
";",
"}"
] | Serializes a short into a byte array at a specific offset in big-endian order
@param b byte array in which to write a short value.
@param offset offset within byte array to start writing.
@param value short to write to byte array. | [
"Serializes",
"a",
"short",
"into",
"a",
"byte",
"array",
"at",
"a",
"specific",
"offset",
"in",
"big",
"-",
"endian",
"order"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java#L134-L137 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/SSLHelper.java | SSLHelper.establishSSLContext | public static void establishSSLContext(HttpClient client, int port, LibertyServer server) {
establishSSLContext(client, port, server, null, null, null, null, "TLSv1.2");
} | java | public static void establishSSLContext(HttpClient client, int port, LibertyServer server) {
establishSSLContext(client, port, server, null, null, null, null, "TLSv1.2");
} | [
"public",
"static",
"void",
"establishSSLContext",
"(",
"HttpClient",
"client",
",",
"int",
"port",
",",
"LibertyServer",
"server",
")",
"{",
"establishSSLContext",
"(",
"client",
",",
"port",
",",
"server",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"\"TLSv1.2\"",
")",
";",
"}"
] | Adds an SSL context to the HttpClient. No trust or client certificate is
established and a trust-all policy is assumed.
@param client the HttpClient
@param port SSL port
@param server the LibertyServer | [
"Adds",
"an",
"SSL",
"context",
"to",
"the",
"HttpClient",
".",
"No",
"trust",
"or",
"client",
"certificate",
"is",
"established",
"and",
"a",
"trust",
"-",
"all",
"policy",
"is",
"assumed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/SSLHelper.java#L48-L50 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/util/EventListeners.java | EventListeners.fireEvent | public final void fireEvent(EventObject evt, EventListenerV visitor){
EventListener[] list = getListenerArray();
for(int i=0; i<list.length; i++){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"fireEvent", "Use visitor " + visitor + " to fire event to " + list[i] + ", class:" +list[i].getClass());
visitor.fireEvent(evt, list[i]);
}
} | java | public final void fireEvent(EventObject evt, EventListenerV visitor){
EventListener[] list = getListenerArray();
for(int i=0; i<list.length; i++){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"fireEvent", "Use visitor " + visitor + " to fire event to " + list[i] + ", class:" +list[i].getClass());
visitor.fireEvent(evt, list[i]);
}
} | [
"public",
"final",
"void",
"fireEvent",
"(",
"EventObject",
"evt",
",",
"EventListenerV",
"visitor",
")",
"{",
"EventListener",
"[",
"]",
"list",
"=",
"getListenerArray",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"fireEvent\"",
",",
"\"Use visitor \"",
"+",
"visitor",
"+",
"\" to fire event to \"",
"+",
"list",
"[",
"i",
"]",
"+",
"\", class:\"",
"+",
"list",
"[",
"i",
"]",
".",
"getClass",
"(",
")",
")",
";",
"visitor",
".",
"fireEvent",
"(",
"evt",
",",
"list",
"[",
"i",
"]",
")",
";",
"}",
"}"
] | Fire the event to all listeners by allowing the visitor
to visit each listener. The visitor is responsible for
implementing the actual firing of the event to each listener. | [
"Fire",
"the",
"event",
"to",
"all",
"listeners",
"by",
"allowing",
"the",
"visitor",
"to",
"visit",
"each",
"listener",
".",
"The",
"visitor",
"is",
"responsible",
"for",
"implementing",
"the",
"actual",
"firing",
"of",
"the",
"event",
"to",
"each",
"listener",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/util/EventListeners.java#L52-L59 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/util/EventListeners.java | EventListeners.addListener | public final synchronized void addListener(EventListener l) {
if(l ==null) {
throw new IllegalArgumentException("Listener " + l +
" is null");
}
if(listeners == EMPTY_LISTENERS) {
listeners = new EventListener[1];
listeners[0] = l;
}
else {
int i = listeners.length;
EventListener[] tmp = new EventListener[i+1];
System.arraycopy(listeners, 0, tmp, 0, i);
tmp[i] = l;
listeners = tmp;
}
} | java | public final synchronized void addListener(EventListener l) {
if(l ==null) {
throw new IllegalArgumentException("Listener " + l +
" is null");
}
if(listeners == EMPTY_LISTENERS) {
listeners = new EventListener[1];
listeners[0] = l;
}
else {
int i = listeners.length;
EventListener[] tmp = new EventListener[i+1];
System.arraycopy(listeners, 0, tmp, 0, i);
tmp[i] = l;
listeners = tmp;
}
} | [
"public",
"final",
"synchronized",
"void",
"addListener",
"(",
"EventListener",
"l",
")",
"{",
"if",
"(",
"l",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Listener \"",
"+",
"l",
"+",
"\" is null\"",
")",
";",
"}",
"if",
"(",
"listeners",
"==",
"EMPTY_LISTENERS",
")",
"{",
"listeners",
"=",
"new",
"EventListener",
"[",
"1",
"]",
";",
"listeners",
"[",
"0",
"]",
"=",
"l",
";",
"}",
"else",
"{",
"int",
"i",
"=",
"listeners",
".",
"length",
";",
"EventListener",
"[",
"]",
"tmp",
"=",
"new",
"EventListener",
"[",
"i",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"listeners",
",",
"0",
",",
"tmp",
",",
"0",
",",
"i",
")",
";",
"tmp",
"[",
"i",
"]",
"=",
"l",
";",
"listeners",
"=",
"tmp",
";",
"}",
"}"
] | Add the listener as a listener to the list.
@param l the listener to be added | [
"Add",
"the",
"listener",
"as",
"a",
"listener",
"to",
"the",
"list",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/util/EventListeners.java#L72-L89 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/util/EventListeners.java | EventListeners.removeListener | public final synchronized void removeListener(EventListener l) {
if(l ==null) {
throw new IllegalArgumentException("Listener " + l +
" is null");
}
// Is l on the list?
int index = -1;
for(int i = listeners.length-1; i>=0; i--) {
if(listeners[i].equals(l) == true) {
index = i;
break;
}
}
// If so, remove it
if(index != -1) {
EventListener[] tmp = new EventListener[listeners.length-1];
// Copy the list up to index
System.arraycopy(listeners, 0, tmp, 0, index);
// Copy from two past the index, up to
// the end of tmp (which is two elements
// shorter than the old list)
if(index < tmp.length)
System.arraycopy(listeners, index+1, tmp, index,
tmp.length - index);
// set the listener array to the new array or null
listeners = (tmp.length == 0) ? EMPTY_LISTENERS : tmp;
}
} | java | public final synchronized void removeListener(EventListener l) {
if(l ==null) {
throw new IllegalArgumentException("Listener " + l +
" is null");
}
// Is l on the list?
int index = -1;
for(int i = listeners.length-1; i>=0; i--) {
if(listeners[i].equals(l) == true) {
index = i;
break;
}
}
// If so, remove it
if(index != -1) {
EventListener[] tmp = new EventListener[listeners.length-1];
// Copy the list up to index
System.arraycopy(listeners, 0, tmp, 0, index);
// Copy from two past the index, up to
// the end of tmp (which is two elements
// shorter than the old list)
if(index < tmp.length)
System.arraycopy(listeners, index+1, tmp, index,
tmp.length - index);
// set the listener array to the new array or null
listeners = (tmp.length == 0) ? EMPTY_LISTENERS : tmp;
}
} | [
"public",
"final",
"synchronized",
"void",
"removeListener",
"(",
"EventListener",
"l",
")",
"{",
"if",
"(",
"l",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Listener \"",
"+",
"l",
"+",
"\" is null\"",
")",
";",
"}",
"// Is l on the list?",
"int",
"index",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"listeners",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"listeners",
"[",
"i",
"]",
".",
"equals",
"(",
"l",
")",
"==",
"true",
")",
"{",
"index",
"=",
"i",
";",
"break",
";",
"}",
"}",
"// If so, remove it",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"EventListener",
"[",
"]",
"tmp",
"=",
"new",
"EventListener",
"[",
"listeners",
".",
"length",
"-",
"1",
"]",
";",
"// Copy the list up to index",
"System",
".",
"arraycopy",
"(",
"listeners",
",",
"0",
",",
"tmp",
",",
"0",
",",
"index",
")",
";",
"// Copy from two past the index, up to",
"// the end of tmp (which is two elements",
"// shorter than the old list)",
"if",
"(",
"index",
"<",
"tmp",
".",
"length",
")",
"System",
".",
"arraycopy",
"(",
"listeners",
",",
"index",
"+",
"1",
",",
"tmp",
",",
"index",
",",
"tmp",
".",
"length",
"-",
"index",
")",
";",
"// set the listener array to the new array or null",
"listeners",
"=",
"(",
"tmp",
".",
"length",
"==",
"0",
")",
"?",
"EMPTY_LISTENERS",
":",
"tmp",
";",
"}",
"}"
] | Remove the listener.
@param l the listener to be removed | [
"Remove",
"the",
"listener",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/util/EventListeners.java#L95-L124 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/common/util/ProxyHelper.java | ProxyHelper.getClassLoaderForInterfaces | private ClassLoader getClassLoaderForInterfaces(final ClassLoader loader, final Class<?>[] interfaces) {
if (canSeeAllInterfaces(loader, interfaces)) {
LOG.log(Level.FINE, "current classloader " + loader + " can see all interface");
return loader;
}
String sortedNameFromInterfaceArray = getSortedNameFromInterfaceArray(interfaces);
ClassLoader cachedLoader = proxyClassLoaderCache.getProxyClassLoader(loader, interfaces);
if (canSeeAllInterfaces(cachedLoader, interfaces)) {
LOG.log(Level.FINE, "find required loader from ProxyClassLoader cache with key"
+ sortedNameFromInterfaceArray);
return cachedLoader;
} else {
LOG.log(Level.FINE, "find a loader from ProxyClassLoader cache with interfaces "
+ sortedNameFromInterfaceArray
+ " but can't see all interfaces");
for (Class<?> currentInterface : interfaces) {
String ifName = currentInterface.getName();
if (!ifName.startsWith("org.apache.cxf") && !ifName.startsWith("java")) {
// remove the stale ProxyClassLoader and recreate one
proxyClassLoaderCache.removeStaleProxyClassLoader(currentInterface);
cachedLoader = proxyClassLoaderCache.getProxyClassLoader(loader, interfaces);
}
}
}
return cachedLoader;
} | java | private ClassLoader getClassLoaderForInterfaces(final ClassLoader loader, final Class<?>[] interfaces) {
if (canSeeAllInterfaces(loader, interfaces)) {
LOG.log(Level.FINE, "current classloader " + loader + " can see all interface");
return loader;
}
String sortedNameFromInterfaceArray = getSortedNameFromInterfaceArray(interfaces);
ClassLoader cachedLoader = proxyClassLoaderCache.getProxyClassLoader(loader, interfaces);
if (canSeeAllInterfaces(cachedLoader, interfaces)) {
LOG.log(Level.FINE, "find required loader from ProxyClassLoader cache with key"
+ sortedNameFromInterfaceArray);
return cachedLoader;
} else {
LOG.log(Level.FINE, "find a loader from ProxyClassLoader cache with interfaces "
+ sortedNameFromInterfaceArray
+ " but can't see all interfaces");
for (Class<?> currentInterface : interfaces) {
String ifName = currentInterface.getName();
if (!ifName.startsWith("org.apache.cxf") && !ifName.startsWith("java")) {
// remove the stale ProxyClassLoader and recreate one
proxyClassLoaderCache.removeStaleProxyClassLoader(currentInterface);
cachedLoader = proxyClassLoaderCache.getProxyClassLoader(loader, interfaces);
}
}
}
return cachedLoader;
} | [
"private",
"ClassLoader",
"getClassLoaderForInterfaces",
"(",
"final",
"ClassLoader",
"loader",
",",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"interfaces",
")",
"{",
"if",
"(",
"canSeeAllInterfaces",
"(",
"loader",
",",
"interfaces",
")",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"current classloader \"",
"+",
"loader",
"+",
"\" can see all interface\"",
")",
";",
"return",
"loader",
";",
"}",
"String",
"sortedNameFromInterfaceArray",
"=",
"getSortedNameFromInterfaceArray",
"(",
"interfaces",
")",
";",
"ClassLoader",
"cachedLoader",
"=",
"proxyClassLoaderCache",
".",
"getProxyClassLoader",
"(",
"loader",
",",
"interfaces",
")",
";",
"if",
"(",
"canSeeAllInterfaces",
"(",
"cachedLoader",
",",
"interfaces",
")",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"find required loader from ProxyClassLoader cache with key\"",
"+",
"sortedNameFromInterfaceArray",
")",
";",
"return",
"cachedLoader",
";",
"}",
"else",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"find a loader from ProxyClassLoader cache with interfaces \"",
"+",
"sortedNameFromInterfaceArray",
"+",
"\" but can't see all interfaces\"",
")",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"currentInterface",
":",
"interfaces",
")",
"{",
"String",
"ifName",
"=",
"currentInterface",
".",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"ifName",
".",
"startsWith",
"(",
"\"org.apache.cxf\"",
")",
"&&",
"!",
"ifName",
".",
"startsWith",
"(",
"\"java\"",
")",
")",
"{",
"// remove the stale ProxyClassLoader and recreate one",
"proxyClassLoaderCache",
".",
"removeStaleProxyClassLoader",
"(",
"currentInterface",
")",
";",
"cachedLoader",
"=",
"proxyClassLoaderCache",
".",
"getProxyClassLoader",
"(",
"loader",
",",
"interfaces",
")",
";",
"}",
"}",
"}",
"return",
"cachedLoader",
";",
"}"
] | Return a classloader that can see all the given interfaces If the given loader can see all interfaces
then it is used. If not then a combined classloader of all interface classloaders is returned.
@param loader use supplied class loader
@param interfaces
@return classloader that sees all interfaces | [
"Return",
"a",
"classloader",
"that",
"can",
"see",
"all",
"the",
"given",
"interfaces",
"If",
"the",
"given",
"loader",
"can",
"see",
"all",
"interfaces",
"then",
"it",
"is",
"used",
".",
"If",
"not",
"then",
"a",
"combined",
"classloader",
"of",
"all",
"interface",
"classloaders",
"is",
"returned",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/common/util/ProxyHelper.java#L61-L89 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.3/src/javax/faces/application/Application.java | Application.getMyfacesApplicationInstance | private Application getMyfacesApplicationInstance()
{
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext != null)
{
ExternalContext externalContext = facesContext.getExternalContext();
if (externalContext != null)
{
return (Application) externalContext.getApplicationMap().get(
"org.apache.myfaces.application.ApplicationImpl");
}
}
return null;
} | java | private Application getMyfacesApplicationInstance()
{
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext != null)
{
ExternalContext externalContext = facesContext.getExternalContext();
if (externalContext != null)
{
return (Application) externalContext.getApplicationMap().get(
"org.apache.myfaces.application.ApplicationImpl");
}
}
return null;
} | [
"private",
"Application",
"getMyfacesApplicationInstance",
"(",
")",
"{",
"FacesContext",
"facesContext",
"=",
"FacesContext",
".",
"getCurrentInstance",
"(",
")",
";",
"if",
"(",
"facesContext",
"!=",
"null",
")",
"{",
"ExternalContext",
"externalContext",
"=",
"facesContext",
".",
"getExternalContext",
"(",
")",
";",
"if",
"(",
"externalContext",
"!=",
"null",
")",
"{",
"return",
"(",
"Application",
")",
"externalContext",
".",
"getApplicationMap",
"(",
")",
".",
"get",
"(",
"\"org.apache.myfaces.application.ApplicationImpl\"",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Retrieve the current Myfaces Application Instance, lookup
on the application map. All methods introduced on jsf 1.2
for Application interface should thrown by default
UnsupportedOperationException, but the ri scan and find the
original Application impl, and redirect the call to that
method instead throwing it, allowing application implementations
created before jsf 1.2 continue working.
Note: every method, which uses getMyfacesApplicationInstance() to
delegate itself to the current ApplicationImpl MUST be
overriden by the current ApplicationImpl to prevent infinite loops. | [
"Retrieve",
"the",
"current",
"Myfaces",
"Application",
"Instance",
"lookup",
"on",
"the",
"application",
"map",
".",
"All",
"methods",
"introduced",
"on",
"jsf",
"1",
".",
"2",
"for",
"Application",
"interface",
"should",
"thrown",
"by",
"default",
"UnsupportedOperationException",
"but",
"the",
"ri",
"scan",
"and",
"find",
"the",
"original",
"Application",
"impl",
"and",
"redirect",
"the",
"call",
"to",
"that",
"method",
"instead",
"throwing",
"it",
"allowing",
"application",
"implementations",
"created",
"before",
"jsf",
"1",
".",
"2",
"continue",
"working",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.3/src/javax/faces/application/Application.java#L94-L107 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelBootstrap.java | KernelBootstrap.buildClassLoader | protected ClassLoader buildClassLoader(final List<URL> urlList, String verifyJarProperty) {
if (libertyBoot) {
// for liberty boot we just use the class loader that loaded this class
return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
@Override
public ClassLoader run() {
return getClass().getClassLoader();
}
});
}
final boolean verifyJar;
if (System.getSecurityManager() == null) {
// do not perform verification if SecurityManager is not installed
// unless explicitly enabled.
verifyJar = "true".equalsIgnoreCase(verifyJarProperty);
} else {
// always perform verification if SecurityManager is installed.
verifyJar = true;
}
enableJava2SecurityIfSet(this.bootProps, urlList);
ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
@Override
public ClassLoader run() {
ClassLoader parent = getClass().getClassLoader();
URL[] urls = urlList.toArray(new URL[urlList.size()]);
if (verifyJar) {
return new BootstrapChildFirstURLClassloader(urls, parent);
} else {
try {
return new BootstrapChildFirstJarClassloader(urls, parent);
} catch (RuntimeException e) {
// fall back to URLClassLoader in case something went wrong
return new BootstrapChildFirstURLClassloader(urls, parent);
}
}
}
});
return loader;
} | java | protected ClassLoader buildClassLoader(final List<URL> urlList, String verifyJarProperty) {
if (libertyBoot) {
// for liberty boot we just use the class loader that loaded this class
return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
@Override
public ClassLoader run() {
return getClass().getClassLoader();
}
});
}
final boolean verifyJar;
if (System.getSecurityManager() == null) {
// do not perform verification if SecurityManager is not installed
// unless explicitly enabled.
verifyJar = "true".equalsIgnoreCase(verifyJarProperty);
} else {
// always perform verification if SecurityManager is installed.
verifyJar = true;
}
enableJava2SecurityIfSet(this.bootProps, urlList);
ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
@Override
public ClassLoader run() {
ClassLoader parent = getClass().getClassLoader();
URL[] urls = urlList.toArray(new URL[urlList.size()]);
if (verifyJar) {
return new BootstrapChildFirstURLClassloader(urls, parent);
} else {
try {
return new BootstrapChildFirstJarClassloader(urls, parent);
} catch (RuntimeException e) {
// fall back to URLClassLoader in case something went wrong
return new BootstrapChildFirstURLClassloader(urls, parent);
}
}
}
});
return loader;
} | [
"protected",
"ClassLoader",
"buildClassLoader",
"(",
"final",
"List",
"<",
"URL",
">",
"urlList",
",",
"String",
"verifyJarProperty",
")",
"{",
"if",
"(",
"libertyBoot",
")",
"{",
"// for liberty boot we just use the class loader that loaded this class",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"ClassLoader",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ClassLoader",
"run",
"(",
")",
"{",
"return",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"final",
"boolean",
"verifyJar",
";",
"if",
"(",
"System",
".",
"getSecurityManager",
"(",
")",
"==",
"null",
")",
"{",
"// do not perform verification if SecurityManager is not installed",
"// unless explicitly enabled.",
"verifyJar",
"=",
"\"true\"",
".",
"equalsIgnoreCase",
"(",
"verifyJarProperty",
")",
";",
"}",
"else",
"{",
"// always perform verification if SecurityManager is installed.",
"verifyJar",
"=",
"true",
";",
"}",
"enableJava2SecurityIfSet",
"(",
"this",
".",
"bootProps",
",",
"urlList",
")",
";",
"ClassLoader",
"loader",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"ClassLoader",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ClassLoader",
"run",
"(",
")",
"{",
"ClassLoader",
"parent",
"=",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
";",
"URL",
"[",
"]",
"urls",
"=",
"urlList",
".",
"toArray",
"(",
"new",
"URL",
"[",
"urlList",
".",
"size",
"(",
")",
"]",
")",
";",
"if",
"(",
"verifyJar",
")",
"{",
"return",
"new",
"BootstrapChildFirstURLClassloader",
"(",
"urls",
",",
"parent",
")",
";",
"}",
"else",
"{",
"try",
"{",
"return",
"new",
"BootstrapChildFirstJarClassloader",
"(",
"urls",
",",
"parent",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"// fall back to URLClassLoader in case something went wrong",
"return",
"new",
"BootstrapChildFirstURLClassloader",
"(",
"urls",
",",
"parent",
")",
";",
"}",
"}",
"}",
"}",
")",
";",
"return",
"loader",
";",
"}"
] | Build the nested classloader containing the OSGi framework, and the log provider.
@param urlList
@param verifyJarProperty
@return | [
"Build",
"the",
"nested",
"classloader",
"containing",
"the",
"OSGi",
"framework",
"and",
"the",
"log",
"provider",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelBootstrap.java#L379-L422 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelBootstrap.java | KernelBootstrap.enableJava2SecurityIfSet | public static void enableJava2SecurityIfSet(BootstrapConfig bootProps, List<URL> urlList) {
if (bootProps.get(BootstrapConstants.JAVA_2_SECURITY_PROPERTY) != null) {
NameBasedLocalBundleRepository repo = new NameBasedLocalBundleRepository(bootProps.getInstallRoot());
urlList.add(getJarFileFromBundleName(repo, "com.ibm.ws.org.eclipse.equinox.region", "[1.0,1.0.100)"));
// the following three jar files are for serialfilter which are loaded by URLClassloader by bootstrap agent.
urlList.add(getJarFileFromBundleName(repo, "com.ibm.ws.kernel.instrument.serialfilter", "[1.0,1.0.100)"));
addJarFileIfExist(urlList, bootProps.getInstallRoot() + "/bin/tools/ws-javaagent.jar");
addJarFileIfExist(urlList, bootProps.getInstallRoot() + "/lib/bootstrap-agent.jar");
Policy wlpPolicy = new WLPDynamicPolicy(Policy.getPolicy(), urlList);
Policy.setPolicy(wlpPolicy);
}
} | java | public static void enableJava2SecurityIfSet(BootstrapConfig bootProps, List<URL> urlList) {
if (bootProps.get(BootstrapConstants.JAVA_2_SECURITY_PROPERTY) != null) {
NameBasedLocalBundleRepository repo = new NameBasedLocalBundleRepository(bootProps.getInstallRoot());
urlList.add(getJarFileFromBundleName(repo, "com.ibm.ws.org.eclipse.equinox.region", "[1.0,1.0.100)"));
// the following three jar files are for serialfilter which are loaded by URLClassloader by bootstrap agent.
urlList.add(getJarFileFromBundleName(repo, "com.ibm.ws.kernel.instrument.serialfilter", "[1.0,1.0.100)"));
addJarFileIfExist(urlList, bootProps.getInstallRoot() + "/bin/tools/ws-javaagent.jar");
addJarFileIfExist(urlList, bootProps.getInstallRoot() + "/lib/bootstrap-agent.jar");
Policy wlpPolicy = new WLPDynamicPolicy(Policy.getPolicy(), urlList);
Policy.setPolicy(wlpPolicy);
}
} | [
"public",
"static",
"void",
"enableJava2SecurityIfSet",
"(",
"BootstrapConfig",
"bootProps",
",",
"List",
"<",
"URL",
">",
"urlList",
")",
"{",
"if",
"(",
"bootProps",
".",
"get",
"(",
"BootstrapConstants",
".",
"JAVA_2_SECURITY_PROPERTY",
")",
"!=",
"null",
")",
"{",
"NameBasedLocalBundleRepository",
"repo",
"=",
"new",
"NameBasedLocalBundleRepository",
"(",
"bootProps",
".",
"getInstallRoot",
"(",
")",
")",
";",
"urlList",
".",
"add",
"(",
"getJarFileFromBundleName",
"(",
"repo",
",",
"\"com.ibm.ws.org.eclipse.equinox.region\"",
",",
"\"[1.0,1.0.100)\"",
")",
")",
";",
"// the following three jar files are for serialfilter which are loaded by URLClassloader by bootstrap agent.",
"urlList",
".",
"add",
"(",
"getJarFileFromBundleName",
"(",
"repo",
",",
"\"com.ibm.ws.kernel.instrument.serialfilter\"",
",",
"\"[1.0,1.0.100)\"",
")",
")",
";",
"addJarFileIfExist",
"(",
"urlList",
",",
"bootProps",
".",
"getInstallRoot",
"(",
")",
"+",
"\"/bin/tools/ws-javaagent.jar\"",
")",
";",
"addJarFileIfExist",
"(",
"urlList",
",",
"bootProps",
".",
"getInstallRoot",
"(",
")",
"+",
"\"/lib/bootstrap-agent.jar\"",
")",
";",
"Policy",
"wlpPolicy",
"=",
"new",
"WLPDynamicPolicy",
"(",
"Policy",
".",
"getPolicy",
"(",
")",
",",
"urlList",
")",
";",
"Policy",
".",
"setPolicy",
"(",
"wlpPolicy",
")",
";",
"}",
"}"
] | Set Java 2 Security if enabled | [
"Set",
"Java",
"2",
"Security",
"if",
"enabled"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelBootstrap.java#L427-L440 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelBootstrap.java | KernelBootstrap.getProductInfoDisplayName | protected static String getProductInfoDisplayName() {
String result = null;
try {
Map<String, ProductInfo> products = ProductInfo.getAllProductInfo();
StringBuilder builder = new StringBuilder();
for (ProductInfo productInfo : products.values()) {
ProductInfo replaced = productInfo.getReplacedBy();
if (productInfo.getReplacedBy() == null || replaced.isReplacedProductLogged()) {
if (builder.length() != 0) {
builder.append(", ");
}
builder.append(productInfo.getDisplayName());
}
}
result = builder.toString();
} catch (ProductInfoParseException e) {
// ignore exceptions-- best effort to get a pretty string
} catch (DuplicateProductInfoException e) {
// ignore exceptions-- best effort to get a pretty string
} catch (ProductInfoReplaceException e) {
// ignore exceptions-- best effort to get a pretty string
}
return result;
} | java | protected static String getProductInfoDisplayName() {
String result = null;
try {
Map<String, ProductInfo> products = ProductInfo.getAllProductInfo();
StringBuilder builder = new StringBuilder();
for (ProductInfo productInfo : products.values()) {
ProductInfo replaced = productInfo.getReplacedBy();
if (productInfo.getReplacedBy() == null || replaced.isReplacedProductLogged()) {
if (builder.length() != 0) {
builder.append(", ");
}
builder.append(productInfo.getDisplayName());
}
}
result = builder.toString();
} catch (ProductInfoParseException e) {
// ignore exceptions-- best effort to get a pretty string
} catch (DuplicateProductInfoException e) {
// ignore exceptions-- best effort to get a pretty string
} catch (ProductInfoReplaceException e) {
// ignore exceptions-- best effort to get a pretty string
}
return result;
} | [
"protected",
"static",
"String",
"getProductInfoDisplayName",
"(",
")",
"{",
"String",
"result",
"=",
"null",
";",
"try",
"{",
"Map",
"<",
"String",
",",
"ProductInfo",
">",
"products",
"=",
"ProductInfo",
".",
"getAllProductInfo",
"(",
")",
";",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"ProductInfo",
"productInfo",
":",
"products",
".",
"values",
"(",
")",
")",
"{",
"ProductInfo",
"replaced",
"=",
"productInfo",
".",
"getReplacedBy",
"(",
")",
";",
"if",
"(",
"productInfo",
".",
"getReplacedBy",
"(",
")",
"==",
"null",
"||",
"replaced",
".",
"isReplacedProductLogged",
"(",
")",
")",
"{",
"if",
"(",
"builder",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"builder",
".",
"append",
"(",
"\", \"",
")",
";",
"}",
"builder",
".",
"append",
"(",
"productInfo",
".",
"getDisplayName",
"(",
")",
")",
";",
"}",
"}",
"result",
"=",
"builder",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"ProductInfoParseException",
"e",
")",
"{",
"// ignore exceptions-- best effort to get a pretty string",
"}",
"catch",
"(",
"DuplicateProductInfoException",
"e",
")",
"{",
"// ignore exceptions-- best effort to get a pretty string",
"}",
"catch",
"(",
"ProductInfoReplaceException",
"e",
")",
"{",
"// ignore exceptions-- best effort to get a pretty string",
"}",
"return",
"result",
";",
"}"
] | Return a display name for the currently running server. | [
"Return",
"a",
"display",
"name",
"for",
"the",
"currently",
"running",
"server",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelBootstrap.java#L641-L664 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelBootstrap.java | KernelBootstrap.getInstrumentation | protected Instrumentation getInstrumentation() {
ClassLoader cl = ClassLoader.getSystemClassLoader();
Instrumentation i = findInstrumentation(cl, "com.ibm.ws.kernel.instrument.BootstrapAgent");
if (i == null)
i = findInstrumentation(cl, "wlp.lib.extract.agent.BootstrapAgent");
return i;
} | java | protected Instrumentation getInstrumentation() {
ClassLoader cl = ClassLoader.getSystemClassLoader();
Instrumentation i = findInstrumentation(cl, "com.ibm.ws.kernel.instrument.BootstrapAgent");
if (i == null)
i = findInstrumentation(cl, "wlp.lib.extract.agent.BootstrapAgent");
return i;
} | [
"protected",
"Instrumentation",
"getInstrumentation",
"(",
")",
"{",
"ClassLoader",
"cl",
"=",
"ClassLoader",
".",
"getSystemClassLoader",
"(",
")",
";",
"Instrumentation",
"i",
"=",
"findInstrumentation",
"(",
"cl",
",",
"\"com.ibm.ws.kernel.instrument.BootstrapAgent\"",
")",
";",
"if",
"(",
"i",
"==",
"null",
")",
"i",
"=",
"findInstrumentation",
"(",
"cl",
",",
"\"wlp.lib.extract.agent.BootstrapAgent\"",
")",
";",
"return",
"i",
";",
"}"
] | Fetch the BootstrapAgent instrumentation instance from the BootstrapAgent
in the system classloader.
@return Instrumentation instance initialized by the Launcher, may be null. | [
"Fetch",
"the",
"BootstrapAgent",
"instrumentation",
"instance",
"from",
"the",
"BootstrapAgent",
"in",
"the",
"system",
"classloader",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelBootstrap.java#L679-L685 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/configuration/JspConfiguration.java | JspConfiguration.createClonedJspConfiguration | public JspConfiguration createClonedJspConfiguration() {
return new JspConfiguration(configManager, this.getServletVersion(), this.jspVersion, this.isXml, this.isXmlSpecified, this.elIgnored, this.scriptingInvalid(), this.isTrimDirectiveWhitespaces(), this.isDeferredSyntaxAllowedAsLiteral(), this.getTrimDirectiveWhitespaces(), this.getDeferredSyntaxAllowedAsLiteral(), this.elIgnoredSetTrueInPropGrp(), this.elIgnoredSetTrueInPage(), this.getDefaultContentType(), this.getBuffer(), this.isErrorOnUndeclaredNamespace());
} | java | public JspConfiguration createClonedJspConfiguration() {
return new JspConfiguration(configManager, this.getServletVersion(), this.jspVersion, this.isXml, this.isXmlSpecified, this.elIgnored, this.scriptingInvalid(), this.isTrimDirectiveWhitespaces(), this.isDeferredSyntaxAllowedAsLiteral(), this.getTrimDirectiveWhitespaces(), this.getDeferredSyntaxAllowedAsLiteral(), this.elIgnoredSetTrueInPropGrp(), this.elIgnoredSetTrueInPage(), this.getDefaultContentType(), this.getBuffer(), this.isErrorOnUndeclaredNamespace());
} | [
"public",
"JspConfiguration",
"createClonedJspConfiguration",
"(",
")",
"{",
"return",
"new",
"JspConfiguration",
"(",
"configManager",
",",
"this",
".",
"getServletVersion",
"(",
")",
",",
"this",
".",
"jspVersion",
",",
"this",
".",
"isXml",
",",
"this",
".",
"isXmlSpecified",
",",
"this",
".",
"elIgnored",
",",
"this",
".",
"scriptingInvalid",
"(",
")",
",",
"this",
".",
"isTrimDirectiveWhitespaces",
"(",
")",
",",
"this",
".",
"isDeferredSyntaxAllowedAsLiteral",
"(",
")",
",",
"this",
".",
"getTrimDirectiveWhitespaces",
"(",
")",
",",
"this",
".",
"getDeferredSyntaxAllowedAsLiteral",
"(",
")",
",",
"this",
".",
"elIgnoredSetTrueInPropGrp",
"(",
")",
",",
"this",
".",
"elIgnoredSetTrueInPage",
"(",
")",
",",
"this",
".",
"getDefaultContentType",
"(",
")",
",",
"this",
".",
"getBuffer",
"(",
")",
",",
"this",
".",
"isErrorOnUndeclaredNamespace",
"(",
")",
")",
";",
"}"
] | This method is used for creating a configuration for a tag file. The tag file may want to override some properties if it's jsp version in the tld is different than the server version | [
"This",
"method",
"is",
"used",
"for",
"creating",
"a",
"configuration",
"for",
"a",
"tag",
"file",
".",
"The",
"tag",
"file",
"may",
"want",
"to",
"override",
"some",
"properties",
"if",
"it",
"s",
"jsp",
"version",
"in",
"the",
"tld",
"is",
"different",
"than",
"the",
"server",
"version"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/configuration/JspConfiguration.java#L118-L120 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/configuration/JspConfiguration.java | JspConfiguration.getExpressionFactory | public ExpressionFactory getExpressionFactory() {
// lazy init here, sync to avoid race condition
synchronized(this) {
if (expressionFactory == null) {
expressionFactory = ExpressionFactory.newInstance();
}
}
//allow JCDI to wrap our expression factory so they can clean up objects after the expressions are through
if (configManager.isJCDIEnabled()) {
if (jcdiWrappedExpressionFactory==null) {
//wrap expressionFactory
ELFactoryWrapperForCDI wrapperExpressionFactory =JSPExtensionFactory.getWrapperExpressionFactory();
if (wrapperExpressionFactory!=null) {
jcdiWrappedExpressionFactory = (ExpressionFactory)wrapperExpressionFactory;
return jcdiWrappedExpressionFactory;
}
// this code is left here for historic purposes, not because we will want to do this in this way anymore
//jcdiWrappedExpressionFactory = JspShim.createWrappedExpressionFactory(expressionFactory);
} else {
return jcdiWrappedExpressionFactory;
}
}
return expressionFactory;
} | java | public ExpressionFactory getExpressionFactory() {
// lazy init here, sync to avoid race condition
synchronized(this) {
if (expressionFactory == null) {
expressionFactory = ExpressionFactory.newInstance();
}
}
//allow JCDI to wrap our expression factory so they can clean up objects after the expressions are through
if (configManager.isJCDIEnabled()) {
if (jcdiWrappedExpressionFactory==null) {
//wrap expressionFactory
ELFactoryWrapperForCDI wrapperExpressionFactory =JSPExtensionFactory.getWrapperExpressionFactory();
if (wrapperExpressionFactory!=null) {
jcdiWrappedExpressionFactory = (ExpressionFactory)wrapperExpressionFactory;
return jcdiWrappedExpressionFactory;
}
// this code is left here for historic purposes, not because we will want to do this in this way anymore
//jcdiWrappedExpressionFactory = JspShim.createWrappedExpressionFactory(expressionFactory);
} else {
return jcdiWrappedExpressionFactory;
}
}
return expressionFactory;
} | [
"public",
"ExpressionFactory",
"getExpressionFactory",
"(",
")",
"{",
"// lazy init here, sync to avoid race condition",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"expressionFactory",
"==",
"null",
")",
"{",
"expressionFactory",
"=",
"ExpressionFactory",
".",
"newInstance",
"(",
")",
";",
"}",
"}",
"//allow JCDI to wrap our expression factory so they can clean up objects after the expressions are through",
"if",
"(",
"configManager",
".",
"isJCDIEnabled",
"(",
")",
")",
"{",
"if",
"(",
"jcdiWrappedExpressionFactory",
"==",
"null",
")",
"{",
"//wrap expressionFactory",
"ELFactoryWrapperForCDI",
"wrapperExpressionFactory",
"=",
"JSPExtensionFactory",
".",
"getWrapperExpressionFactory",
"(",
")",
";",
"if",
"(",
"wrapperExpressionFactory",
"!=",
"null",
")",
"{",
"jcdiWrappedExpressionFactory",
"=",
"(",
"ExpressionFactory",
")",
"wrapperExpressionFactory",
";",
"return",
"jcdiWrappedExpressionFactory",
";",
"}",
"// this code is left here for historic purposes, not because we will want to do this in this way anymore",
"//jcdiWrappedExpressionFactory = JspShim.createWrappedExpressionFactory(expressionFactory);",
"}",
"else",
"{",
"return",
"jcdiWrappedExpressionFactory",
";",
"}",
"}",
"return",
"expressionFactory",
";",
"}"
] | LIDB4147-9 Begin | [
"LIDB4147",
"-",
"9",
"Begin"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/configuration/JspConfiguration.java#L283-L308 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/ClassInfoCache.java | ClassInfoCache.getDelayableClassInfo | protected ClassInfoImpl getDelayableClassInfo(Type type) {
String typeClassName = type.getClassName();
if (tc.isDebugEnabled()) {
// Type 'toString' answers the descriptor;
// show the type class name, too, for clarity.
Tr.debug(tc, MessageFormat.format("[ {0} ] ENTER [ {1} ] [ {2} ]",
new Object[] { getHashText(), type, typeClassName }));
}
// Now that we have the type class name, pass it along instead
// of recomputing when needed.
ClassInfoImpl classInfo;
String classInfoCase;
int sort = type.getSort();
if (sort == Type.ARRAY) {
classInfo = getArrayClassInfo(typeClassName, type);
classInfoCase = "array class";
} else if (sort == Type.OBJECT) {
classInfo = getDelayableClassInfo(typeClassName, DO_NOT_ALLOW_PRIMITIVE);
if (classInfo.isJavaClass()) {
if (classInfo.isDelayedClass()) {
classInfoCase = "java delayed";
} else {
classInfoCase = "java non-delayed";
}
} else {
if (classInfo.isDelayedClass()) {
classInfoCase = "non-java delayed";
} else {
classInfoCase = "non-java non-delayed";
}
}
} else {
classInfo = getPrimitiveClassInfo(typeClassName, type);
classInfoCase = "primitive class";
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, MessageFormat.format("[ {0} ] RETURN [ {1} ] [ {2} ]",
new Object[] { getHashText(),
classInfo.getHashText(),
classInfoCase }));
}
return classInfo;
} | java | protected ClassInfoImpl getDelayableClassInfo(Type type) {
String typeClassName = type.getClassName();
if (tc.isDebugEnabled()) {
// Type 'toString' answers the descriptor;
// show the type class name, too, for clarity.
Tr.debug(tc, MessageFormat.format("[ {0} ] ENTER [ {1} ] [ {2} ]",
new Object[] { getHashText(), type, typeClassName }));
}
// Now that we have the type class name, pass it along instead
// of recomputing when needed.
ClassInfoImpl classInfo;
String classInfoCase;
int sort = type.getSort();
if (sort == Type.ARRAY) {
classInfo = getArrayClassInfo(typeClassName, type);
classInfoCase = "array class";
} else if (sort == Type.OBJECT) {
classInfo = getDelayableClassInfo(typeClassName, DO_NOT_ALLOW_PRIMITIVE);
if (classInfo.isJavaClass()) {
if (classInfo.isDelayedClass()) {
classInfoCase = "java delayed";
} else {
classInfoCase = "java non-delayed";
}
} else {
if (classInfo.isDelayedClass()) {
classInfoCase = "non-java delayed";
} else {
classInfoCase = "non-java non-delayed";
}
}
} else {
classInfo = getPrimitiveClassInfo(typeClassName, type);
classInfoCase = "primitive class";
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, MessageFormat.format("[ {0} ] RETURN [ {1} ] [ {2} ]",
new Object[] { getHashText(),
classInfo.getHashText(),
classInfoCase }));
}
return classInfo;
} | [
"protected",
"ClassInfoImpl",
"getDelayableClassInfo",
"(",
"Type",
"type",
")",
"{",
"String",
"typeClassName",
"=",
"type",
".",
"getClassName",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"// Type 'toString' answers the descriptor;",
"// show the type class name, too, for clarity.",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] ENTER [ {1} ] [ {2} ]\"",
",",
"new",
"Object",
"[",
"]",
"{",
"getHashText",
"(",
")",
",",
"type",
",",
"typeClassName",
"}",
")",
")",
";",
"}",
"// Now that we have the type class name, pass it along instead",
"// of recomputing when needed.",
"ClassInfoImpl",
"classInfo",
";",
"String",
"classInfoCase",
";",
"int",
"sort",
"=",
"type",
".",
"getSort",
"(",
")",
";",
"if",
"(",
"sort",
"==",
"Type",
".",
"ARRAY",
")",
"{",
"classInfo",
"=",
"getArrayClassInfo",
"(",
"typeClassName",
",",
"type",
")",
";",
"classInfoCase",
"=",
"\"array class\"",
";",
"}",
"else",
"if",
"(",
"sort",
"==",
"Type",
".",
"OBJECT",
")",
"{",
"classInfo",
"=",
"getDelayableClassInfo",
"(",
"typeClassName",
",",
"DO_NOT_ALLOW_PRIMITIVE",
")",
";",
"if",
"(",
"classInfo",
".",
"isJavaClass",
"(",
")",
")",
"{",
"if",
"(",
"classInfo",
".",
"isDelayedClass",
"(",
")",
")",
"{",
"classInfoCase",
"=",
"\"java delayed\"",
";",
"}",
"else",
"{",
"classInfoCase",
"=",
"\"java non-delayed\"",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"classInfo",
".",
"isDelayedClass",
"(",
")",
")",
"{",
"classInfoCase",
"=",
"\"non-java delayed\"",
";",
"}",
"else",
"{",
"classInfoCase",
"=",
"\"non-java non-delayed\"",
";",
"}",
"}",
"}",
"else",
"{",
"classInfo",
"=",
"getPrimitiveClassInfo",
"(",
"typeClassName",
",",
"type",
")",
";",
"classInfoCase",
"=",
"\"primitive class\"",
";",
"}",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] RETURN [ {1} ] [ {2} ]\"",
",",
"new",
"Object",
"[",
"]",
"{",
"getHashText",
"(",
")",
",",
"classInfo",
".",
"getHashText",
"(",
")",
",",
"classInfoCase",
"}",
")",
")",
";",
"}",
"return",
"classInfo",
";",
"}"
] | For array types, the previous implementation used the element name. | [
"For",
"array",
"types",
"the",
"previous",
"implementation",
"used",
"the",
"element",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/ClassInfoCache.java#L335-L386 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/ClassInfoCache.java | ClassInfoCache.getArrayClassInfo | public ArrayClassInfo getArrayClassInfo(String typeClassName, Type arrayType) {
ClassInfoImpl elementClassInfo = getDelayableClassInfo(arrayType.getElementType());
return new ArrayClassInfo(typeClassName, elementClassInfo);
} | java | public ArrayClassInfo getArrayClassInfo(String typeClassName, Type arrayType) {
ClassInfoImpl elementClassInfo = getDelayableClassInfo(arrayType.getElementType());
return new ArrayClassInfo(typeClassName, elementClassInfo);
} | [
"public",
"ArrayClassInfo",
"getArrayClassInfo",
"(",
"String",
"typeClassName",
",",
"Type",
"arrayType",
")",
"{",
"ClassInfoImpl",
"elementClassInfo",
"=",
"getDelayableClassInfo",
"(",
"arrayType",
".",
"getElementType",
"(",
")",
")",
";",
"return",
"new",
"ArrayClassInfo",
"(",
"typeClassName",
",",
"elementClassInfo",
")",
";",
"}"
] | Note that this will recurse as long as the element type is still an array type. | [
"Note",
"that",
"this",
"will",
"recurse",
"as",
"long",
"as",
"the",
"element",
"type",
"is",
"still",
"an",
"array",
"type",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/ClassInfoCache.java#L394-L398 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/ClassInfoCache.java | ClassInfoCache.addClassInfo | protected boolean addClassInfo(NonDelayedClassInfo classInfo) {
boolean didAdd;
if (classInfo.isJavaClass()) {
didAdd = basicPutJavaClassInfo(classInfo);
} else if (classInfo.isAnnotationPresent() ||
classInfo.isFieldAnnotationPresent() ||
classInfo.isMethodAnnotationPresent()) {
didAdd = basicPutAnnotatedClassInfo(classInfo);
} else {
didAdd = basicPutClassInfo(classInfo);
// Note: 'addAsFirst' must only be performed for non-java, non-annotated
// classes. Both java and annotated classes are put in separate
// storage which is never swapped. Non-java, non-annotated classes
// are swappable, and are maintained in a last-access ordered
// linked list.
//
// The current addition counts as an access, meaning, the class
// info is placed into the last-access list as the first element.
if (didAdd) {
addAsFirst(classInfo);
}
}
if (didAdd) {
ClassInfoImpl delayedClassInfo = associate(classInfo);
discardRef(delayedClassInfo); // No current use for the return value; discard it.
}
return didAdd;
} | java | protected boolean addClassInfo(NonDelayedClassInfo classInfo) {
boolean didAdd;
if (classInfo.isJavaClass()) {
didAdd = basicPutJavaClassInfo(classInfo);
} else if (classInfo.isAnnotationPresent() ||
classInfo.isFieldAnnotationPresent() ||
classInfo.isMethodAnnotationPresent()) {
didAdd = basicPutAnnotatedClassInfo(classInfo);
} else {
didAdd = basicPutClassInfo(classInfo);
// Note: 'addAsFirst' must only be performed for non-java, non-annotated
// classes. Both java and annotated classes are put in separate
// storage which is never swapped. Non-java, non-annotated classes
// are swappable, and are maintained in a last-access ordered
// linked list.
//
// The current addition counts as an access, meaning, the class
// info is placed into the last-access list as the first element.
if (didAdd) {
addAsFirst(classInfo);
}
}
if (didAdd) {
ClassInfoImpl delayedClassInfo = associate(classInfo);
discardRef(delayedClassInfo); // No current use for the return value; discard it.
}
return didAdd;
} | [
"protected",
"boolean",
"addClassInfo",
"(",
"NonDelayedClassInfo",
"classInfo",
")",
"{",
"boolean",
"didAdd",
";",
"if",
"(",
"classInfo",
".",
"isJavaClass",
"(",
")",
")",
"{",
"didAdd",
"=",
"basicPutJavaClassInfo",
"(",
"classInfo",
")",
";",
"}",
"else",
"if",
"(",
"classInfo",
".",
"isAnnotationPresent",
"(",
")",
"||",
"classInfo",
".",
"isFieldAnnotationPresent",
"(",
")",
"||",
"classInfo",
".",
"isMethodAnnotationPresent",
"(",
")",
")",
"{",
"didAdd",
"=",
"basicPutAnnotatedClassInfo",
"(",
"classInfo",
")",
";",
"}",
"else",
"{",
"didAdd",
"=",
"basicPutClassInfo",
"(",
"classInfo",
")",
";",
"// Note: 'addAsFirst' must only be performed for non-java, non-annotated",
"// classes. Both java and annotated classes are put in separate",
"// storage which is never swapped. Non-java, non-annotated classes",
"// are swappable, and are maintained in a last-access ordered",
"// linked list.",
"//",
"// The current addition counts as an access, meaning, the class",
"// info is placed into the last-access list as the first element.",
"if",
"(",
"didAdd",
")",
"{",
"addAsFirst",
"(",
"classInfo",
")",
";",
"}",
"}",
"if",
"(",
"didAdd",
")",
"{",
"ClassInfoImpl",
"delayedClassInfo",
"=",
"associate",
"(",
"classInfo",
")",
";",
"discardRef",
"(",
"delayedClassInfo",
")",
";",
"// No current use for the return value; discard it.",
"}",
"return",
"didAdd",
";",
"}"
] | Do update the LRU state. | [
"Do",
"update",
"the",
"LRU",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/ClassInfoCache.java#L943-L977 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/ClassInfoCache.java | ClassInfoCache.addAsFirst | protected void addAsFirst(NonDelayedClassInfo classInfo) {
String methodName = "addAsFirst";
boolean doLog = tc.isDebugEnabled();
String useHashText = (doLog ? getHashText() : null);
String useClassHashText = (doLog ? classInfo.getHashText() : null);
if (doLog) {
logLinks(methodName, classInfo);
}
if (firstClassInfo == null) {
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Adding [ {1} ] to empty",
new Object[] { useHashText, useClassHashText }));
}
firstClassInfo = classInfo;
lastClassInfo = classInfo;
// last == first
// lastClassInfoName == firstClassInfoName
// first.next remains null
// first.prev remains null
} else if (firstClassInfo == lastClassInfo) {
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Adding [ {1} ] to singleton [ {2} ]",
new Object[] { useHashText, useClassHashText, firstClassInfo.getHashText() }));
}
firstClassInfo = classInfo;
firstClassInfo.setNextClassInfo(lastClassInfo);
lastClassInfo.setPriorClassInfo(classInfo);
// last != first
// lastClassInfoName != firstClassInfoName
// first.prev == null
// first.next == last
// last.prev == first
// last.next == null
} else {
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Adding [ {1} ] to multitude [ {2} ]",
new Object[] { useHashText,
useClassHashText,
firstClassInfo.getHashText() }));
}
classInfo.setNextClassInfo(firstClassInfo);
firstClassInfo.setPriorClassInfo(classInfo);
firstClassInfo = classInfo;
if (classInfos.size() > ClassInfoCache.classInfoCacheLimit) {
NonDelayedClassInfo oldLastClassInfo = lastClassInfo;
String lastClassName = lastClassInfo.getName();
classInfos.remove(lastClassName);
discardRef(lastClassName); // No current use for the old last class name; discard it.
lastClassInfo = oldLastClassInfo.getPriorClassInfo();
lastClassInfo.setNextClassInfo(null);
// oldLastClassInfo.setNextClassInfo(null);
oldLastClassInfo.setPriorClassInfo(null);
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] new last [ {1} ] displaces [ {2} ]",
new Object[] { useHashText,
lastClassInfo.getHashText(),
oldLastClassInfo.getHashText() }));
}
DelayedClassInfo delayedClassInfo = oldLastClassInfo.getDelayedClassInfo();
if (delayedClassInfo != null) {
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Clearing link on displaced [ {1} ]",
new Object[] { useHashText, oldLastClassInfo.getHashText() }));
}
delayedClassInfo.setClassInfo(null);
oldLastClassInfo.setDelayedClassInfo(null);
}
}
}
} | java | protected void addAsFirst(NonDelayedClassInfo classInfo) {
String methodName = "addAsFirst";
boolean doLog = tc.isDebugEnabled();
String useHashText = (doLog ? getHashText() : null);
String useClassHashText = (doLog ? classInfo.getHashText() : null);
if (doLog) {
logLinks(methodName, classInfo);
}
if (firstClassInfo == null) {
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Adding [ {1} ] to empty",
new Object[] { useHashText, useClassHashText }));
}
firstClassInfo = classInfo;
lastClassInfo = classInfo;
// last == first
// lastClassInfoName == firstClassInfoName
// first.next remains null
// first.prev remains null
} else if (firstClassInfo == lastClassInfo) {
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Adding [ {1} ] to singleton [ {2} ]",
new Object[] { useHashText, useClassHashText, firstClassInfo.getHashText() }));
}
firstClassInfo = classInfo;
firstClassInfo.setNextClassInfo(lastClassInfo);
lastClassInfo.setPriorClassInfo(classInfo);
// last != first
// lastClassInfoName != firstClassInfoName
// first.prev == null
// first.next == last
// last.prev == first
// last.next == null
} else {
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Adding [ {1} ] to multitude [ {2} ]",
new Object[] { useHashText,
useClassHashText,
firstClassInfo.getHashText() }));
}
classInfo.setNextClassInfo(firstClassInfo);
firstClassInfo.setPriorClassInfo(classInfo);
firstClassInfo = classInfo;
if (classInfos.size() > ClassInfoCache.classInfoCacheLimit) {
NonDelayedClassInfo oldLastClassInfo = lastClassInfo;
String lastClassName = lastClassInfo.getName();
classInfos.remove(lastClassName);
discardRef(lastClassName); // No current use for the old last class name; discard it.
lastClassInfo = oldLastClassInfo.getPriorClassInfo();
lastClassInfo.setNextClassInfo(null);
// oldLastClassInfo.setNextClassInfo(null);
oldLastClassInfo.setPriorClassInfo(null);
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] new last [ {1} ] displaces [ {2} ]",
new Object[] { useHashText,
lastClassInfo.getHashText(),
oldLastClassInfo.getHashText() }));
}
DelayedClassInfo delayedClassInfo = oldLastClassInfo.getDelayedClassInfo();
if (delayedClassInfo != null) {
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Clearing link on displaced [ {1} ]",
new Object[] { useHashText, oldLastClassInfo.getHashText() }));
}
delayedClassInfo.setClassInfo(null);
oldLastClassInfo.setDelayedClassInfo(null);
}
}
}
} | [
"protected",
"void",
"addAsFirst",
"(",
"NonDelayedClassInfo",
"classInfo",
")",
"{",
"String",
"methodName",
"=",
"\"addAsFirst\"",
";",
"boolean",
"doLog",
"=",
"tc",
".",
"isDebugEnabled",
"(",
")",
";",
"String",
"useHashText",
"=",
"(",
"doLog",
"?",
"getHashText",
"(",
")",
":",
"null",
")",
";",
"String",
"useClassHashText",
"=",
"(",
"doLog",
"?",
"classInfo",
".",
"getHashText",
"(",
")",
":",
"null",
")",
";",
"if",
"(",
"doLog",
")",
"{",
"logLinks",
"(",
"methodName",
",",
"classInfo",
")",
";",
"}",
"if",
"(",
"firstClassInfo",
"==",
"null",
")",
"{",
"if",
"(",
"doLog",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Adding [ {1} ] to empty\"",
",",
"new",
"Object",
"[",
"]",
"{",
"useHashText",
",",
"useClassHashText",
"}",
")",
")",
";",
"}",
"firstClassInfo",
"=",
"classInfo",
";",
"lastClassInfo",
"=",
"classInfo",
";",
"// last == first",
"// lastClassInfoName == firstClassInfoName",
"// first.next remains null",
"// first.prev remains null",
"}",
"else",
"if",
"(",
"firstClassInfo",
"==",
"lastClassInfo",
")",
"{",
"if",
"(",
"doLog",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Adding [ {1} ] to singleton [ {2} ]\"",
",",
"new",
"Object",
"[",
"]",
"{",
"useHashText",
",",
"useClassHashText",
",",
"firstClassInfo",
".",
"getHashText",
"(",
")",
"}",
")",
")",
";",
"}",
"firstClassInfo",
"=",
"classInfo",
";",
"firstClassInfo",
".",
"setNextClassInfo",
"(",
"lastClassInfo",
")",
";",
"lastClassInfo",
".",
"setPriorClassInfo",
"(",
"classInfo",
")",
";",
"// last != first",
"// lastClassInfoName != firstClassInfoName",
"// first.prev == null",
"// first.next == last",
"// last.prev == first",
"// last.next == null",
"}",
"else",
"{",
"if",
"(",
"doLog",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Adding [ {1} ] to multitude [ {2} ]\"",
",",
"new",
"Object",
"[",
"]",
"{",
"useHashText",
",",
"useClassHashText",
",",
"firstClassInfo",
".",
"getHashText",
"(",
")",
"}",
")",
")",
";",
"}",
"classInfo",
".",
"setNextClassInfo",
"(",
"firstClassInfo",
")",
";",
"firstClassInfo",
".",
"setPriorClassInfo",
"(",
"classInfo",
")",
";",
"firstClassInfo",
"=",
"classInfo",
";",
"if",
"(",
"classInfos",
".",
"size",
"(",
")",
">",
"ClassInfoCache",
".",
"classInfoCacheLimit",
")",
"{",
"NonDelayedClassInfo",
"oldLastClassInfo",
"=",
"lastClassInfo",
";",
"String",
"lastClassName",
"=",
"lastClassInfo",
".",
"getName",
"(",
")",
";",
"classInfos",
".",
"remove",
"(",
"lastClassName",
")",
";",
"discardRef",
"(",
"lastClassName",
")",
";",
"// No current use for the old last class name; discard it.",
"lastClassInfo",
"=",
"oldLastClassInfo",
".",
"getPriorClassInfo",
"(",
")",
";",
"lastClassInfo",
".",
"setNextClassInfo",
"(",
"null",
")",
";",
"// oldLastClassInfo.setNextClassInfo(null);",
"oldLastClassInfo",
".",
"setPriorClassInfo",
"(",
"null",
")",
";",
"if",
"(",
"doLog",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] new last [ {1} ] displaces [ {2} ]\"",
",",
"new",
"Object",
"[",
"]",
"{",
"useHashText",
",",
"lastClassInfo",
".",
"getHashText",
"(",
")",
",",
"oldLastClassInfo",
".",
"getHashText",
"(",
")",
"}",
")",
")",
";",
"}",
"DelayedClassInfo",
"delayedClassInfo",
"=",
"oldLastClassInfo",
".",
"getDelayedClassInfo",
"(",
")",
";",
"if",
"(",
"delayedClassInfo",
"!=",
"null",
")",
"{",
"if",
"(",
"doLog",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Clearing link on displaced [ {1} ]\"",
",",
"new",
"Object",
"[",
"]",
"{",
"useHashText",
",",
"oldLastClassInfo",
".",
"getHashText",
"(",
")",
"}",
")",
")",
";",
"}",
"delayedClassInfo",
".",
"setClassInfo",
"(",
"null",
")",
";",
"oldLastClassInfo",
".",
"setDelayedClassInfo",
"(",
"null",
")",
";",
"}",
"}",
"}",
"}"
] | put us over the maximum size, trim off the last element. | [
"put",
"us",
"over",
"the",
"maximum",
"size",
"trim",
"off",
"the",
"last",
"element",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/ClassInfoCache.java#L1154-L1247 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/ClassInfoCache.java | ClassInfoCache.makeFirst | public void makeFirst(NonDelayedClassInfo classInfo) {
String methodName = "makeFirst";
boolean doLog = tc.isDebugEnabled();
String useHashText = (doLog ? getHashText() : null);
String useClassHashText = (doLog ? classInfo.getHashText() : null);
if (doLog) {
logLinks(methodName, classInfo);
}
if (classInfo == firstClassInfo) {
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Already first [ {1} ]",
new Object[] { useHashText, useClassHashText }));
}
return;
} else if (classInfo == lastClassInfo) {
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Moving from last [ {1} ]",
new Object[] { useHashText, useClassHashText }));
Tr.debug(tc, MessageFormat.format("[ {0} ] Old first [ {1} ]",
new Object[] { useHashText, firstClassInfo.getHashText() }));
}
lastClassInfo = classInfo.getPriorClassInfo();
lastClassInfo.setNextClassInfo(null);
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] New last [ {1} ]",
new Object[] { useHashText, lastClassInfo.getHashText() }));
}
firstClassInfo.setPriorClassInfo(classInfo);
classInfo.setPriorClassInfo(null);
classInfo.setNextClassInfo(firstClassInfo);
firstClassInfo = classInfo;
} else {
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Moving from middle [ {1} ]",
new Object[] { useHashText, useClassHashText }));
Tr.debug(tc, MessageFormat.format("[ {0} ] Old first [ {1} ]",
new Object[] { useHashText, firstClassInfo.getHashText() }));
}
NonDelayedClassInfo currentPrior = classInfo.getPriorClassInfo();
NonDelayedClassInfo currentNext = classInfo.getNextClassInfo();
currentPrior.setNextClassInfo(currentNext);
currentNext.setPriorClassInfo(currentPrior);
firstClassInfo.setPriorClassInfo(classInfo);
classInfo.setNextClassInfo(firstClassInfo);
classInfo.setPriorClassInfo(null);
firstClassInfo = classInfo;
}
} | java | public void makeFirst(NonDelayedClassInfo classInfo) {
String methodName = "makeFirst";
boolean doLog = tc.isDebugEnabled();
String useHashText = (doLog ? getHashText() : null);
String useClassHashText = (doLog ? classInfo.getHashText() : null);
if (doLog) {
logLinks(methodName, classInfo);
}
if (classInfo == firstClassInfo) {
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Already first [ {1} ]",
new Object[] { useHashText, useClassHashText }));
}
return;
} else if (classInfo == lastClassInfo) {
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Moving from last [ {1} ]",
new Object[] { useHashText, useClassHashText }));
Tr.debug(tc, MessageFormat.format("[ {0} ] Old first [ {1} ]",
new Object[] { useHashText, firstClassInfo.getHashText() }));
}
lastClassInfo = classInfo.getPriorClassInfo();
lastClassInfo.setNextClassInfo(null);
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] New last [ {1} ]",
new Object[] { useHashText, lastClassInfo.getHashText() }));
}
firstClassInfo.setPriorClassInfo(classInfo);
classInfo.setPriorClassInfo(null);
classInfo.setNextClassInfo(firstClassInfo);
firstClassInfo = classInfo;
} else {
if (doLog) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Moving from middle [ {1} ]",
new Object[] { useHashText, useClassHashText }));
Tr.debug(tc, MessageFormat.format("[ {0} ] Old first [ {1} ]",
new Object[] { useHashText, firstClassInfo.getHashText() }));
}
NonDelayedClassInfo currentPrior = classInfo.getPriorClassInfo();
NonDelayedClassInfo currentNext = classInfo.getNextClassInfo();
currentPrior.setNextClassInfo(currentNext);
currentNext.setPriorClassInfo(currentPrior);
firstClassInfo.setPriorClassInfo(classInfo);
classInfo.setNextClassInfo(firstClassInfo);
classInfo.setPriorClassInfo(null);
firstClassInfo = classInfo;
}
} | [
"public",
"void",
"makeFirst",
"(",
"NonDelayedClassInfo",
"classInfo",
")",
"{",
"String",
"methodName",
"=",
"\"makeFirst\"",
";",
"boolean",
"doLog",
"=",
"tc",
".",
"isDebugEnabled",
"(",
")",
";",
"String",
"useHashText",
"=",
"(",
"doLog",
"?",
"getHashText",
"(",
")",
":",
"null",
")",
";",
"String",
"useClassHashText",
"=",
"(",
"doLog",
"?",
"classInfo",
".",
"getHashText",
"(",
")",
":",
"null",
")",
";",
"if",
"(",
"doLog",
")",
"{",
"logLinks",
"(",
"methodName",
",",
"classInfo",
")",
";",
"}",
"if",
"(",
"classInfo",
"==",
"firstClassInfo",
")",
"{",
"if",
"(",
"doLog",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Already first [ {1} ]\"",
",",
"new",
"Object",
"[",
"]",
"{",
"useHashText",
",",
"useClassHashText",
"}",
")",
")",
";",
"}",
"return",
";",
"}",
"else",
"if",
"(",
"classInfo",
"==",
"lastClassInfo",
")",
"{",
"if",
"(",
"doLog",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Moving from last [ {1} ]\"",
",",
"new",
"Object",
"[",
"]",
"{",
"useHashText",
",",
"useClassHashText",
"}",
")",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Old first [ {1} ]\"",
",",
"new",
"Object",
"[",
"]",
"{",
"useHashText",
",",
"firstClassInfo",
".",
"getHashText",
"(",
")",
"}",
")",
")",
";",
"}",
"lastClassInfo",
"=",
"classInfo",
".",
"getPriorClassInfo",
"(",
")",
";",
"lastClassInfo",
".",
"setNextClassInfo",
"(",
"null",
")",
";",
"if",
"(",
"doLog",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] New last [ {1} ]\"",
",",
"new",
"Object",
"[",
"]",
"{",
"useHashText",
",",
"lastClassInfo",
".",
"getHashText",
"(",
")",
"}",
")",
")",
";",
"}",
"firstClassInfo",
".",
"setPriorClassInfo",
"(",
"classInfo",
")",
";",
"classInfo",
".",
"setPriorClassInfo",
"(",
"null",
")",
";",
"classInfo",
".",
"setNextClassInfo",
"(",
"firstClassInfo",
")",
";",
"firstClassInfo",
"=",
"classInfo",
";",
"}",
"else",
"{",
"if",
"(",
"doLog",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Moving from middle [ {1} ]\"",
",",
"new",
"Object",
"[",
"]",
"{",
"useHashText",
",",
"useClassHashText",
"}",
")",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Old first [ {1} ]\"",
",",
"new",
"Object",
"[",
"]",
"{",
"useHashText",
",",
"firstClassInfo",
".",
"getHashText",
"(",
")",
"}",
")",
")",
";",
"}",
"NonDelayedClassInfo",
"currentPrior",
"=",
"classInfo",
".",
"getPriorClassInfo",
"(",
")",
";",
"NonDelayedClassInfo",
"currentNext",
"=",
"classInfo",
".",
"getNextClassInfo",
"(",
")",
";",
"currentPrior",
".",
"setNextClassInfo",
"(",
"currentNext",
")",
";",
"currentNext",
".",
"setPriorClassInfo",
"(",
"currentPrior",
")",
";",
"firstClassInfo",
".",
"setPriorClassInfo",
"(",
"classInfo",
")",
";",
"classInfo",
".",
"setNextClassInfo",
"(",
"firstClassInfo",
")",
";",
"classInfo",
".",
"setPriorClassInfo",
"(",
"null",
")",
";",
"firstClassInfo",
"=",
"classInfo",
";",
"}",
"}"
] | The class info is last, or the class info is somewhere in the middle. | [
"The",
"class",
"info",
"is",
"last",
"or",
"the",
"class",
"info",
"is",
"somewhere",
"in",
"the",
"middle",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/ClassInfoCache.java#L1255-L1316 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileEntry.java | ZipFileEntry.getResource | @Override
@FFDCIgnore(MalformedURLException.class)
public URL getResource() {
String useRelPath = getRelativePath();
if ( (zipEntryData == null) || zipEntryData.isDirectory() ) {
useRelPath += "/";
}
URI entryUri = rootContainer.createEntryUri(useRelPath);
if ( entryUri == null ) {
return null;
}
try {
return entryUri.toURL(); // throws MalformedURLException
} catch ( MalformedURLException e ) {
// In some cases an attempt is made to get a resource using the wsjar protocol
// after the protocol has been deregistered. It would be too much of a behavior change
// to properly enforce the dependency on the wsjar protocol for all components.
// Instead, only log a debug statement if a MalformedURLException is caught during
// shutdown.
if ( FrameworkState.isStopping() ) {
if ( TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, "MalformedURLException during OSGi framework stop.", e.getMessage());
} else {
FFDCFilter.processException(e, getClass().getName(), "269");
}
}
return null;
}
} | java | @Override
@FFDCIgnore(MalformedURLException.class)
public URL getResource() {
String useRelPath = getRelativePath();
if ( (zipEntryData == null) || zipEntryData.isDirectory() ) {
useRelPath += "/";
}
URI entryUri = rootContainer.createEntryUri(useRelPath);
if ( entryUri == null ) {
return null;
}
try {
return entryUri.toURL(); // throws MalformedURLException
} catch ( MalformedURLException e ) {
// In some cases an attempt is made to get a resource using the wsjar protocol
// after the protocol has been deregistered. It would be too much of a behavior change
// to properly enforce the dependency on the wsjar protocol for all components.
// Instead, only log a debug statement if a MalformedURLException is caught during
// shutdown.
if ( FrameworkState.isStopping() ) {
if ( TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, "MalformedURLException during OSGi framework stop.", e.getMessage());
} else {
FFDCFilter.processException(e, getClass().getName(), "269");
}
}
return null;
}
} | [
"@",
"Override",
"@",
"FFDCIgnore",
"(",
"MalformedURLException",
".",
"class",
")",
"public",
"URL",
"getResource",
"(",
")",
"{",
"String",
"useRelPath",
"=",
"getRelativePath",
"(",
")",
";",
"if",
"(",
"(",
"zipEntryData",
"==",
"null",
")",
"||",
"zipEntryData",
".",
"isDirectory",
"(",
")",
")",
"{",
"useRelPath",
"+=",
"\"/\"",
";",
"}",
"URI",
"entryUri",
"=",
"rootContainer",
".",
"createEntryUri",
"(",
"useRelPath",
")",
";",
"if",
"(",
"entryUri",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"return",
"entryUri",
".",
"toURL",
"(",
")",
";",
"// throws MalformedURLException",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"// In some cases an attempt is made to get a resource using the wsjar protocol",
"// after the protocol has been deregistered. It would be too much of a behavior change",
"// to properly enforce the dependency on the wsjar protocol for all components.",
"// Instead, only log a debug statement if a MalformedURLException is caught during",
"// shutdown.",
"if",
"(",
"FrameworkState",
".",
"isStopping",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"MalformedURLException during OSGi framework stop.\"",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"else",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"269\"",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"}"
] | Answer the URL of this entry.
Directory type entries have a trailing "/". That is required by
{@link ClassLoader#getResource(String)}.
Answer null if a malformed URL is obtained.
@return The URL for this entry. | [
"Answer",
"the",
"URL",
"of",
"this",
"entry",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileEntry.java#L124-L155 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileEntry.java | ZipFileEntry.getInputStream | @Override
public InputStream getInputStream() throws IOException {
if ( (zipEntryData == null) || zipEntryData.isDirectory() ) {
return null;
}
final ZipFileHandle zipFileHandle = rootContainer.getZipFileHandle(); // throws IOException
ZipFile zipFile = zipFileHandle.open();
// The open must have a balancing close. That should be done by the caller.
// In the worst case, 'finalize' makes sure it happens.
final InputStream baseInputStream;
try {
baseInputStream = zipFileHandle.getInputStream( zipFile, zipEntryData.getPath() ); // throws IOException
} catch ( Throwable th ) {
// Need to close here, since the caller never receives a wrapped
// input stream to close.
zipFileHandle.close();
throw th;
}
if ( baseInputStream == null ) {
throw new FileNotFoundException(
"Zip file [ " + zipFile.getName() + " ]" +
" failed to provide input stream for entry [ " + zipEntryData.getPath() + " ]");
}
InputStream inputStream = new InputStream() {
private final InputStream wrappedInputStream = baseInputStream;
// Object lifecycle ...
@Override
public synchronized void finalize() throws Throwable {
close(); // throws IOException
super.finalize(); // throws Throwable
}
// Close ...
private volatile boolean isClosed;
@Override
public void close() throws IOException {
if ( !isClosed ) {
synchronized( this ) {
if ( !isClosed ) {
try {
wrappedInputStream.close(); // throws IOException
} catch ( IOException e ) {
// FFDC
}
zipFileHandle.close();
isClosed = true;
}
}
}
}
// Delegate methods ...
@Trivial
@Override
public int read(byte[] b) throws IOException {
return wrappedInputStream.read(b);
}
@Trivial
@Override
public int read(byte[] b, int off, int len) throws IOException {
return wrappedInputStream.read(b, off, len); // throws IOException
}
@Trivial
@Override
public long skip(long n) throws IOException {
return wrappedInputStream.skip(n); // throws IOException
}
@Trivial
@Override
public int available() throws IOException {
return wrappedInputStream.available(); // throws IOException
}
@SuppressWarnings("sync-override")
@Trivial
@Override
public void mark(int readlimit) {
wrappedInputStream.mark(readlimit);
}
@SuppressWarnings("sync-override")
@Trivial
@Override
public void reset() throws IOException {
wrappedInputStream.reset(); // throws IOException
}
@Trivial
@Override
public boolean markSupported() {
return wrappedInputStream.markSupported();
}
@Override
public int read() throws IOException {
return wrappedInputStream.read(); // throws IOException
}
};
return inputStream;
} | java | @Override
public InputStream getInputStream() throws IOException {
if ( (zipEntryData == null) || zipEntryData.isDirectory() ) {
return null;
}
final ZipFileHandle zipFileHandle = rootContainer.getZipFileHandle(); // throws IOException
ZipFile zipFile = zipFileHandle.open();
// The open must have a balancing close. That should be done by the caller.
// In the worst case, 'finalize' makes sure it happens.
final InputStream baseInputStream;
try {
baseInputStream = zipFileHandle.getInputStream( zipFile, zipEntryData.getPath() ); // throws IOException
} catch ( Throwable th ) {
// Need to close here, since the caller never receives a wrapped
// input stream to close.
zipFileHandle.close();
throw th;
}
if ( baseInputStream == null ) {
throw new FileNotFoundException(
"Zip file [ " + zipFile.getName() + " ]" +
" failed to provide input stream for entry [ " + zipEntryData.getPath() + " ]");
}
InputStream inputStream = new InputStream() {
private final InputStream wrappedInputStream = baseInputStream;
// Object lifecycle ...
@Override
public synchronized void finalize() throws Throwable {
close(); // throws IOException
super.finalize(); // throws Throwable
}
// Close ...
private volatile boolean isClosed;
@Override
public void close() throws IOException {
if ( !isClosed ) {
synchronized( this ) {
if ( !isClosed ) {
try {
wrappedInputStream.close(); // throws IOException
} catch ( IOException e ) {
// FFDC
}
zipFileHandle.close();
isClosed = true;
}
}
}
}
// Delegate methods ...
@Trivial
@Override
public int read(byte[] b) throws IOException {
return wrappedInputStream.read(b);
}
@Trivial
@Override
public int read(byte[] b, int off, int len) throws IOException {
return wrappedInputStream.read(b, off, len); // throws IOException
}
@Trivial
@Override
public long skip(long n) throws IOException {
return wrappedInputStream.skip(n); // throws IOException
}
@Trivial
@Override
public int available() throws IOException {
return wrappedInputStream.available(); // throws IOException
}
@SuppressWarnings("sync-override")
@Trivial
@Override
public void mark(int readlimit) {
wrappedInputStream.mark(readlimit);
}
@SuppressWarnings("sync-override")
@Trivial
@Override
public void reset() throws IOException {
wrappedInputStream.reset(); // throws IOException
}
@Trivial
@Override
public boolean markSupported() {
return wrappedInputStream.markSupported();
}
@Override
public int read() throws IOException {
return wrappedInputStream.read(); // throws IOException
}
};
return inputStream;
} | [
"@",
"Override",
"public",
"InputStream",
"getInputStream",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"zipEntryData",
"==",
"null",
")",
"||",
"zipEntryData",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"final",
"ZipFileHandle",
"zipFileHandle",
"=",
"rootContainer",
".",
"getZipFileHandle",
"(",
")",
";",
"// throws IOException",
"ZipFile",
"zipFile",
"=",
"zipFileHandle",
".",
"open",
"(",
")",
";",
"// The open must have a balancing close. That should be done by the caller.",
"// In the worst case, 'finalize' makes sure it happens.",
"final",
"InputStream",
"baseInputStream",
";",
"try",
"{",
"baseInputStream",
"=",
"zipFileHandle",
".",
"getInputStream",
"(",
"zipFile",
",",
"zipEntryData",
".",
"getPath",
"(",
")",
")",
";",
"// throws IOException",
"}",
"catch",
"(",
"Throwable",
"th",
")",
"{",
"// Need to close here, since the caller never receives a wrapped",
"// input stream to close.",
"zipFileHandle",
".",
"close",
"(",
")",
";",
"throw",
"th",
";",
"}",
"if",
"(",
"baseInputStream",
"==",
"null",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"\"Zip file [ \"",
"+",
"zipFile",
".",
"getName",
"(",
")",
"+",
"\" ]\"",
"+",
"\" failed to provide input stream for entry [ \"",
"+",
"zipEntryData",
".",
"getPath",
"(",
")",
"+",
"\" ]\"",
")",
";",
"}",
"InputStream",
"inputStream",
"=",
"new",
"InputStream",
"(",
")",
"{",
"private",
"final",
"InputStream",
"wrappedInputStream",
"=",
"baseInputStream",
";",
"// Object lifecycle ...",
"@",
"Override",
"public",
"synchronized",
"void",
"finalize",
"(",
")",
"throws",
"Throwable",
"{",
"close",
"(",
")",
";",
"// throws IOException",
"super",
".",
"finalize",
"(",
")",
";",
"// throws Throwable",
"}",
"// Close ...",
"private",
"volatile",
"boolean",
"isClosed",
";",
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"isClosed",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"!",
"isClosed",
")",
"{",
"try",
"{",
"wrappedInputStream",
".",
"close",
"(",
")",
";",
"// throws IOException",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// FFDC",
"}",
"zipFileHandle",
".",
"close",
"(",
")",
";",
"isClosed",
"=",
"true",
";",
"}",
"}",
"}",
"}",
"// Delegate methods ...",
"@",
"Trivial",
"@",
"Override",
"public",
"int",
"read",
"(",
"byte",
"[",
"]",
"b",
")",
"throws",
"IOException",
"{",
"return",
"wrappedInputStream",
".",
"read",
"(",
"b",
")",
";",
"}",
"@",
"Trivial",
"@",
"Override",
"public",
"int",
"read",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"return",
"wrappedInputStream",
".",
"read",
"(",
"b",
",",
"off",
",",
"len",
")",
";",
"// throws IOException",
"}",
"@",
"Trivial",
"@",
"Override",
"public",
"long",
"skip",
"(",
"long",
"n",
")",
"throws",
"IOException",
"{",
"return",
"wrappedInputStream",
".",
"skip",
"(",
"n",
")",
";",
"// throws IOException",
"}",
"@",
"Trivial",
"@",
"Override",
"public",
"int",
"available",
"(",
")",
"throws",
"IOException",
"{",
"return",
"wrappedInputStream",
".",
"available",
"(",
")",
";",
"// throws IOException",
"}",
"@",
"SuppressWarnings",
"(",
"\"sync-override\"",
")",
"@",
"Trivial",
"@",
"Override",
"public",
"void",
"mark",
"(",
"int",
"readlimit",
")",
"{",
"wrappedInputStream",
".",
"mark",
"(",
"readlimit",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"sync-override\"",
")",
"@",
"Trivial",
"@",
"Override",
"public",
"void",
"reset",
"(",
")",
"throws",
"IOException",
"{",
"wrappedInputStream",
".",
"reset",
"(",
")",
";",
"// throws IOException",
"}",
"@",
"Trivial",
"@",
"Override",
"public",
"boolean",
"markSupported",
"(",
")",
"{",
"return",
"wrappedInputStream",
".",
"markSupported",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"int",
"read",
"(",
")",
"throws",
"IOException",
"{",
"return",
"wrappedInputStream",
".",
"read",
"(",
")",
";",
"// throws IOException",
"}",
"}",
";",
"return",
"inputStream",
";",
"}"
] | Obtain an input stream for the entry.
Answer null for directory entries. That is, when the zip entry is not
available and when the zip entry is a directory entry.
The input stream which is obtained should be closed as soon as possible
following use.
@return An input stream for the entry. | [
"Obtain",
"an",
"input",
"stream",
"for",
"the",
"entry",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileEntry.java#L168-L283 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileEntry.java | ZipFileEntry.getEnclosingContainer | @Override
public ArtifactContainer getEnclosingContainer() {
// The enclosing container may be set when the entry is
// created, in which case the enclosing container lock is null
// and is never needed.
//
// The entry can be created in these ways:
//
// ZipFileContainer.createEntry(ArtifactContainer, String, String, String, int, ZipEntry)
// -- A caching factory method of zip file container entries.
// -- Caches intermediate entries. Non-container leaf entries are not cached.
//
// That is invoked in several ways:
//
// By:
// ZipFileContainer.createEntry(String, String, String)
// Which is invoked by:
// ZipFileEntry.getEnclosingContainer()
// -- Used when the enclosing container is not set when the entry was
// created. This happens when the entry was created with a null
// enclosing container, which only happens when the entry is created
// from 'ZipFileContainer.getEntry'.
// -- This is the core non-trivial step of resolving the enclosing container.
// -- As a first step, if the parent is the root zip container, that is
// obtained as the enclosing container.
// -- As a second step, the enclosing entry of this entry is obtained, then
// the enclosing container is obtained by interpreting that entry as a
// container.
// -- The enclosing container must be obtained from the enclosing entry
// since those are cached and re-used, and since the reference to those
// keep a reference to their interpreted container.
//
// By zip container iterators:
//
// -- com.ibm.ws.artifact.zip.internal.ZipFileEntry.getEnclosingContainer()
// ZipFileContainer.RootZipFileEntryIterator.next()
// -- always provides the root zip container as the enclosing container
// ZipFileNestedDirContainer.NestedZipFileEntryIterator.next()
// -- always provides the nested zip container as the enclosing container
//
// ZipFileContainer.getEntry(String, boolean)
// -- always provides null as the enclosing container
//
// As a public API, 'getEnclosingContainer' may be invoked externally.
// Locally, 'getEnclosingContainer' is only invoked from:
// ZipFileEntry.convertToContainer(boolean)
// That is also a public API.
// Locally, that is only invoked from:
// ZipFileEntry.convertToContainer(boolean)
// That is also a public API.
if ( enclosingContainer == null ) {
synchronized( this ) { // Having a new object to guard 'enclosingContainer' is too many objects.
if ( enclosingContainer == null ) {
String a_enclosingPath = PathUtils.getParent(a_path);
int parentLen = a_enclosingPath.length();
if ( parentLen == 1 ) { // a_enclosingPath == "/"
enclosingContainer = rootContainer;
} else {
String r_enclosingPath = a_enclosingPath.substring(1);
int lastSlash = r_enclosingPath.lastIndexOf('/');
String enclosingName;
if ( lastSlash == -1 ) {
enclosingName = r_enclosingPath; // r_enclosingPath = "name"
} else {
enclosingName = r_enclosingPath.substring(lastSlash + 1); // r_enclosingPath = "parent/child/name"
}
ZipFileEntry entryInEnclosingContainer =
rootContainer.createEntry(enclosingName, a_enclosingPath);
enclosingContainer = entryInEnclosingContainer.convertToLocalContainer();
}
}
}
}
return enclosingContainer;
} | java | @Override
public ArtifactContainer getEnclosingContainer() {
// The enclosing container may be set when the entry is
// created, in which case the enclosing container lock is null
// and is never needed.
//
// The entry can be created in these ways:
//
// ZipFileContainer.createEntry(ArtifactContainer, String, String, String, int, ZipEntry)
// -- A caching factory method of zip file container entries.
// -- Caches intermediate entries. Non-container leaf entries are not cached.
//
// That is invoked in several ways:
//
// By:
// ZipFileContainer.createEntry(String, String, String)
// Which is invoked by:
// ZipFileEntry.getEnclosingContainer()
// -- Used when the enclosing container is not set when the entry was
// created. This happens when the entry was created with a null
// enclosing container, which only happens when the entry is created
// from 'ZipFileContainer.getEntry'.
// -- This is the core non-trivial step of resolving the enclosing container.
// -- As a first step, if the parent is the root zip container, that is
// obtained as the enclosing container.
// -- As a second step, the enclosing entry of this entry is obtained, then
// the enclosing container is obtained by interpreting that entry as a
// container.
// -- The enclosing container must be obtained from the enclosing entry
// since those are cached and re-used, and since the reference to those
// keep a reference to their interpreted container.
//
// By zip container iterators:
//
// -- com.ibm.ws.artifact.zip.internal.ZipFileEntry.getEnclosingContainer()
// ZipFileContainer.RootZipFileEntryIterator.next()
// -- always provides the root zip container as the enclosing container
// ZipFileNestedDirContainer.NestedZipFileEntryIterator.next()
// -- always provides the nested zip container as the enclosing container
//
// ZipFileContainer.getEntry(String, boolean)
// -- always provides null as the enclosing container
//
// As a public API, 'getEnclosingContainer' may be invoked externally.
// Locally, 'getEnclosingContainer' is only invoked from:
// ZipFileEntry.convertToContainer(boolean)
// That is also a public API.
// Locally, that is only invoked from:
// ZipFileEntry.convertToContainer(boolean)
// That is also a public API.
if ( enclosingContainer == null ) {
synchronized( this ) { // Having a new object to guard 'enclosingContainer' is too many objects.
if ( enclosingContainer == null ) {
String a_enclosingPath = PathUtils.getParent(a_path);
int parentLen = a_enclosingPath.length();
if ( parentLen == 1 ) { // a_enclosingPath == "/"
enclosingContainer = rootContainer;
} else {
String r_enclosingPath = a_enclosingPath.substring(1);
int lastSlash = r_enclosingPath.lastIndexOf('/');
String enclosingName;
if ( lastSlash == -1 ) {
enclosingName = r_enclosingPath; // r_enclosingPath = "name"
} else {
enclosingName = r_enclosingPath.substring(lastSlash + 1); // r_enclosingPath = "parent/child/name"
}
ZipFileEntry entryInEnclosingContainer =
rootContainer.createEntry(enclosingName, a_enclosingPath);
enclosingContainer = entryInEnclosingContainer.convertToLocalContainer();
}
}
}
}
return enclosingContainer;
} | [
"@",
"Override",
"public",
"ArtifactContainer",
"getEnclosingContainer",
"(",
")",
"{",
"// The enclosing container may be set when the entry is",
"// created, in which case the enclosing container lock is null",
"// and is never needed.",
"//",
"// The entry can be created in these ways:",
"//",
"// ZipFileContainer.createEntry(ArtifactContainer, String, String, String, int, ZipEntry)",
"// -- A caching factory method of zip file container entries.",
"// -- Caches intermediate entries. Non-container leaf entries are not cached.",
"//",
"// That is invoked in several ways:",
"//",
"// By:",
"// ZipFileContainer.createEntry(String, String, String)",
"// Which is invoked by:",
"// ZipFileEntry.getEnclosingContainer()",
"// -- Used when the enclosing container is not set when the entry was",
"// created. This happens when the entry was created with a null",
"// enclosing container, which only happens when the entry is created",
"// from 'ZipFileContainer.getEntry'.",
"// -- This is the core non-trivial step of resolving the enclosing container.",
"// -- As a first step, if the parent is the root zip container, that is",
"// obtained as the enclosing container.",
"// -- As a second step, the enclosing entry of this entry is obtained, then",
"// the enclosing container is obtained by interpreting that entry as a",
"// container.",
"// -- The enclosing container must be obtained from the enclosing entry",
"// since those are cached and re-used, and since the reference to those",
"// keep a reference to their interpreted container.",
"//",
"// By zip container iterators:",
"//",
"// -- com.ibm.ws.artifact.zip.internal.ZipFileEntry.getEnclosingContainer()",
"// ZipFileContainer.RootZipFileEntryIterator.next()",
"// -- always provides the root zip container as the enclosing container",
"// ZipFileNestedDirContainer.NestedZipFileEntryIterator.next()",
"// -- always provides the nested zip container as the enclosing container",
"//",
"// ZipFileContainer.getEntry(String, boolean)",
"// -- always provides null as the enclosing container",
"//",
"// As a public API, 'getEnclosingContainer' may be invoked externally.",
"// Locally, 'getEnclosingContainer' is only invoked from:",
"// ZipFileEntry.convertToContainer(boolean)",
"// That is also a public API.",
"// Locally, that is only invoked from:",
"// ZipFileEntry.convertToContainer(boolean)",
"// That is also a public API.",
"if",
"(",
"enclosingContainer",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"// Having a new object to guard 'enclosingContainer' is too many objects.",
"if",
"(",
"enclosingContainer",
"==",
"null",
")",
"{",
"String",
"a_enclosingPath",
"=",
"PathUtils",
".",
"getParent",
"(",
"a_path",
")",
";",
"int",
"parentLen",
"=",
"a_enclosingPath",
".",
"length",
"(",
")",
";",
"if",
"(",
"parentLen",
"==",
"1",
")",
"{",
"// a_enclosingPath == \"/\"",
"enclosingContainer",
"=",
"rootContainer",
";",
"}",
"else",
"{",
"String",
"r_enclosingPath",
"=",
"a_enclosingPath",
".",
"substring",
"(",
"1",
")",
";",
"int",
"lastSlash",
"=",
"r_enclosingPath",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"String",
"enclosingName",
";",
"if",
"(",
"lastSlash",
"==",
"-",
"1",
")",
"{",
"enclosingName",
"=",
"r_enclosingPath",
";",
"// r_enclosingPath = \"name\"",
"}",
"else",
"{",
"enclosingName",
"=",
"r_enclosingPath",
".",
"substring",
"(",
"lastSlash",
"+",
"1",
")",
";",
"// r_enclosingPath = \"parent/child/name\"",
"}",
"ZipFileEntry",
"entryInEnclosingContainer",
"=",
"rootContainer",
".",
"createEntry",
"(",
"enclosingName",
",",
"a_enclosingPath",
")",
";",
"enclosingContainer",
"=",
"entryInEnclosingContainer",
".",
"convertToLocalContainer",
"(",
")",
";",
"}",
"}",
"}",
"}",
"return",
"enclosingContainer",
";",
"}"
] | Answer the enclosing container of this entry.
Obtaining the enclosing container is expensive. The implementation
works very hard to avoid having to obtain the enclosing container.
First, the zip entry is created with the enclosing container when
the container is already available. Second, the implementation only
asks for the enclosing container when a call is made to interpret
an entry as a non-local container. That is, other than the case of
interpreting an entry as a nested directory container.
@return The enclosing container of this entry. Since this entry is
a zip file type entry, the enclosing container is either a root
zip type container or a nested directory zip type container. | [
"Answer",
"the",
"enclosing",
"container",
"of",
"this",
"entry",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileEntry.java#L392-L467 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/Normalizer.java | Normalizer.normalize | public char normalize(char currentChar) {
if (NORMALIZE_UPPER == getNormalization()) {
return toUpper(currentChar);
}
if (NORMALIZE_LOWER == getNormalization()) {
return toLower(currentChar);
}
return currentChar;
} | java | public char normalize(char currentChar) {
if (NORMALIZE_UPPER == getNormalization()) {
return toUpper(currentChar);
}
if (NORMALIZE_LOWER == getNormalization()) {
return toLower(currentChar);
}
return currentChar;
} | [
"public",
"char",
"normalize",
"(",
"char",
"currentChar",
")",
"{",
"if",
"(",
"NORMALIZE_UPPER",
"==",
"getNormalization",
"(",
")",
")",
"{",
"return",
"toUpper",
"(",
"currentChar",
")",
";",
"}",
"if",
"(",
"NORMALIZE_LOWER",
"==",
"getNormalization",
"(",
")",
")",
"{",
"return",
"toLower",
"(",
"currentChar",
")",
";",
"}",
"return",
"currentChar",
";",
"}"
] | Take the input character and normalize based on this normalizer instance.
@param currentChar
@return char (normalized based on settings) | [
"Take",
"the",
"input",
"character",
"and",
"normalize",
"based",
"on",
"this",
"normalizer",
"instance",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/Normalizer.java#L112-L120 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/Normalizer.java | Normalizer.normalize | static public char normalize(char input, int format) {
if (NORMALIZE_LOWER == format) {
return toLower(input);
}
if (NORMALIZE_UPPER == format) {
return toUpper(input);
}
return input;
} | java | static public char normalize(char input, int format) {
if (NORMALIZE_LOWER == format) {
return toLower(input);
}
if (NORMALIZE_UPPER == format) {
return toUpper(input);
}
return input;
} | [
"static",
"public",
"char",
"normalize",
"(",
"char",
"input",
",",
"int",
"format",
")",
"{",
"if",
"(",
"NORMALIZE_LOWER",
"==",
"format",
")",
"{",
"return",
"toLower",
"(",
"input",
")",
";",
"}",
"if",
"(",
"NORMALIZE_UPPER",
"==",
"format",
")",
"{",
"return",
"toUpper",
"(",
"input",
")",
";",
"}",
"return",
"input",
";",
"}"
] | Take the input character and normalize based on the input format.
@param input
@param format
@return normalized character. | [
"Take",
"the",
"input",
"character",
"and",
"normalize",
"based",
"on",
"the",
"input",
"format",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/Normalizer.java#L184-L192 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/filter/FilterInstanceWrapper.java | FilterInstanceWrapper.init | public void init(IFilterConfig filterConfig) throws ServletException
{
try
{
// init the filter instance
_filterState = FILTER_STATE_INITIALIZING;
// LIDB-3598: begin
this._filterConfig = filterConfig;
if(_eventSource != null && _eventSource.hasFilterListeners()){
_eventSource.onFilterStartInit(getFilterEvent());
// LIDB-3598: end
_filterInstance.init(filterConfig);
// LIDB-3598: begin
_eventSource.onFilterFinishInit(getFilterEvent());
// LIDB-3598: end
}
else{
_filterInstance.init(filterConfig);
}
_filterState = FILTER_STATE_AVAILABLE;
}
catch (Throwable th)
{
if(_eventSource != null && _eventSource.hasFilterErrorListeners()){
FilterErrorEvent errorEvent = getFilterErrorEvent(th);
_eventSource.onFilterInitError(errorEvent);
}
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(th, "com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init", "111", this);
_filterState = FILTER_STATE_UNAVAILABLE;
throw new ServletException(MessageFormat.format("Filter [{0}]: could not be initialized", new Object[] {_filterName}), th);
}
} | java | public void init(IFilterConfig filterConfig) throws ServletException
{
try
{
// init the filter instance
_filterState = FILTER_STATE_INITIALIZING;
// LIDB-3598: begin
this._filterConfig = filterConfig;
if(_eventSource != null && _eventSource.hasFilterListeners()){
_eventSource.onFilterStartInit(getFilterEvent());
// LIDB-3598: end
_filterInstance.init(filterConfig);
// LIDB-3598: begin
_eventSource.onFilterFinishInit(getFilterEvent());
// LIDB-3598: end
}
else{
_filterInstance.init(filterConfig);
}
_filterState = FILTER_STATE_AVAILABLE;
}
catch (Throwable th)
{
if(_eventSource != null && _eventSource.hasFilterErrorListeners()){
FilterErrorEvent errorEvent = getFilterErrorEvent(th);
_eventSource.onFilterInitError(errorEvent);
}
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(th, "com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init", "111", this);
_filterState = FILTER_STATE_UNAVAILABLE;
throw new ServletException(MessageFormat.format("Filter [{0}]: could not be initialized", new Object[] {_filterName}), th);
}
} | [
"public",
"void",
"init",
"(",
"IFilterConfig",
"filterConfig",
")",
"throws",
"ServletException",
"{",
"try",
"{",
"// init the filter instance",
"_filterState",
"=",
"FILTER_STATE_INITIALIZING",
";",
"// LIDB-3598: begin",
"this",
".",
"_filterConfig",
"=",
"filterConfig",
";",
"if",
"(",
"_eventSource",
"!=",
"null",
"&&",
"_eventSource",
".",
"hasFilterListeners",
"(",
")",
")",
"{",
"_eventSource",
".",
"onFilterStartInit",
"(",
"getFilterEvent",
"(",
")",
")",
";",
"// LIDB-3598: end",
"_filterInstance",
".",
"init",
"(",
"filterConfig",
")",
";",
"// LIDB-3598: begin",
"_eventSource",
".",
"onFilterFinishInit",
"(",
"getFilterEvent",
"(",
")",
")",
";",
"// LIDB-3598: end",
"}",
"else",
"{",
"_filterInstance",
".",
"init",
"(",
"filterConfig",
")",
";",
"}",
"_filterState",
"=",
"FILTER_STATE_AVAILABLE",
";",
"}",
"catch",
"(",
"Throwable",
"th",
")",
"{",
"if",
"(",
"_eventSource",
"!=",
"null",
"&&",
"_eventSource",
".",
"hasFilterErrorListeners",
"(",
")",
")",
"{",
"FilterErrorEvent",
"errorEvent",
"=",
"getFilterErrorEvent",
"(",
"th",
")",
";",
"_eventSource",
".",
"onFilterInitError",
"(",
"errorEvent",
")",
";",
"}",
"com",
".",
"ibm",
".",
"wsspi",
".",
"webcontainer",
".",
"util",
".",
"FFDCWrapper",
".",
"processException",
"(",
"th",
",",
"\"com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init\"",
",",
"\"111\"",
",",
"this",
")",
";",
"_filterState",
"=",
"FILTER_STATE_UNAVAILABLE",
";",
"throw",
"new",
"ServletException",
"(",
"MessageFormat",
".",
"format",
"(",
"\"Filter [{0}]: could not be initialized\"",
",",
"new",
"Object",
"[",
"]",
"{",
"_filterName",
"}",
")",
",",
"th",
")",
";",
"}",
"}"
] | Initializes the filter wrapper and the underlying filter instance
@param fConfig - the filter config object for this filter instance | [
"Initializes",
"the",
"filter",
"wrapper",
"and",
"the",
"underlying",
"filter",
"instance"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/filter/FilterInstanceWrapper.java#L124-L160 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/filter/FilterInstanceWrapper.java | FilterInstanceWrapper.destroy | public void destroy() throws ServletException
{
try
{
// destroy the filter instance
_filterState = FILTER_STATE_DESTROYING;
for (int i = 0;(nServicing.get() > 0) && i < 60; i++) {
try {
if (i == 0)
{
logger.logp(Level.INFO, CLASS_NAME,"destroy", "waiting.to.destroy.filter.[{0}]", _filterName);
}
Thread.sleep(1000);
}
catch (InterruptedException e) {
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(e, "com.ibm.ws.webcontainer.servlet.ServletInstance.destroy", "377", this);
}
}
if(_eventSource != null && _eventSource.hasFilterListeners()){
// LIDB-3598: begin
_eventSource.onFilterStartDestroy(getFilterEvent());
// LIDB-3598: end
_filterInstance.destroy();
// LIDB-3598: begin
_eventSource.onFilterFinishDestroy(getFilterEvent());
// LIDB-3598: end
}
else{
_filterInstance.destroy();
}
_filterState = FILTER_STATE_DESTROYED;
if (null != _managedObject){
_managedObject.release();
}
}
catch (Throwable th)
{
if(_eventSource != null && _eventSource.hasFilterErrorListeners()){
FilterErrorEvent errorEvent = getFilterErrorEvent(th);
_eventSource.onFilterDestroyError(errorEvent);
}
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(th, "com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.destroy", "173", this);
_filterState = FILTER_STATE_UNAVAILABLE;
throw new ServletException(MessageFormat.format("Filter [{0}]: could not be destroyed", new Object[] {_filterName}), th);
}
} | java | public void destroy() throws ServletException
{
try
{
// destroy the filter instance
_filterState = FILTER_STATE_DESTROYING;
for (int i = 0;(nServicing.get() > 0) && i < 60; i++) {
try {
if (i == 0)
{
logger.logp(Level.INFO, CLASS_NAME,"destroy", "waiting.to.destroy.filter.[{0}]", _filterName);
}
Thread.sleep(1000);
}
catch (InterruptedException e) {
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(e, "com.ibm.ws.webcontainer.servlet.ServletInstance.destroy", "377", this);
}
}
if(_eventSource != null && _eventSource.hasFilterListeners()){
// LIDB-3598: begin
_eventSource.onFilterStartDestroy(getFilterEvent());
// LIDB-3598: end
_filterInstance.destroy();
// LIDB-3598: begin
_eventSource.onFilterFinishDestroy(getFilterEvent());
// LIDB-3598: end
}
else{
_filterInstance.destroy();
}
_filterState = FILTER_STATE_DESTROYED;
if (null != _managedObject){
_managedObject.release();
}
}
catch (Throwable th)
{
if(_eventSource != null && _eventSource.hasFilterErrorListeners()){
FilterErrorEvent errorEvent = getFilterErrorEvent(th);
_eventSource.onFilterDestroyError(errorEvent);
}
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(th, "com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.destroy", "173", this);
_filterState = FILTER_STATE_UNAVAILABLE;
throw new ServletException(MessageFormat.format("Filter [{0}]: could not be destroyed", new Object[] {_filterName}), th);
}
} | [
"public",
"void",
"destroy",
"(",
")",
"throws",
"ServletException",
"{",
"try",
"{",
"// destroy the filter instance",
"_filterState",
"=",
"FILTER_STATE_DESTROYING",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"(",
"nServicing",
".",
"get",
"(",
")",
">",
"0",
")",
"&&",
"i",
"<",
"60",
";",
"i",
"++",
")",
"{",
"try",
"{",
"if",
"(",
"i",
"==",
"0",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"INFO",
",",
"CLASS_NAME",
",",
"\"destroy\"",
",",
"\"waiting.to.destroy.filter.[{0}]\"",
",",
"_filterName",
")",
";",
"}",
"Thread",
".",
"sleep",
"(",
"1000",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"com",
".",
"ibm",
".",
"wsspi",
".",
"webcontainer",
".",
"util",
".",
"FFDCWrapper",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.webcontainer.servlet.ServletInstance.destroy\"",
",",
"\"377\"",
",",
"this",
")",
";",
"}",
"}",
"if",
"(",
"_eventSource",
"!=",
"null",
"&&",
"_eventSource",
".",
"hasFilterListeners",
"(",
")",
")",
"{",
"// LIDB-3598: begin",
"_eventSource",
".",
"onFilterStartDestroy",
"(",
"getFilterEvent",
"(",
")",
")",
";",
"// LIDB-3598: end",
"_filterInstance",
".",
"destroy",
"(",
")",
";",
"// LIDB-3598: begin",
"_eventSource",
".",
"onFilterFinishDestroy",
"(",
"getFilterEvent",
"(",
")",
")",
";",
"// LIDB-3598: end",
"}",
"else",
"{",
"_filterInstance",
".",
"destroy",
"(",
")",
";",
"}",
"_filterState",
"=",
"FILTER_STATE_DESTROYED",
";",
"if",
"(",
"null",
"!=",
"_managedObject",
")",
"{",
"_managedObject",
".",
"release",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"th",
")",
"{",
"if",
"(",
"_eventSource",
"!=",
"null",
"&&",
"_eventSource",
".",
"hasFilterErrorListeners",
"(",
")",
")",
"{",
"FilterErrorEvent",
"errorEvent",
"=",
"getFilterErrorEvent",
"(",
"th",
")",
";",
"_eventSource",
".",
"onFilterDestroyError",
"(",
"errorEvent",
")",
";",
"}",
"com",
".",
"ibm",
".",
"wsspi",
".",
"webcontainer",
".",
"util",
".",
"FFDCWrapper",
".",
"processException",
"(",
"th",
",",
"\"com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.destroy\"",
",",
"\"173\"",
",",
"this",
")",
";",
"_filterState",
"=",
"FILTER_STATE_UNAVAILABLE",
";",
"throw",
"new",
"ServletException",
"(",
"MessageFormat",
".",
"format",
"(",
"\"Filter [{0}]: could not be destroyed\"",
",",
"new",
"Object",
"[",
"]",
"{",
"_filterName",
"}",
")",
",",
"th",
")",
";",
"}",
"}"
] | Destroys the filter wrapper and the underlying filter instance | [
"Destroys",
"the",
"filter",
"wrapper",
"and",
"the",
"underlying",
"filter",
"instance"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/filter/FilterInstanceWrapper.java#L297-L345 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.management.security/src/com/ibm/ws/management/security/internal/JMXSecurityMBeanServer.java | JMXSecurityMBeanServer.activate | protected synchronized void activate(ComponentContext cc) {
pipelineRef.activate(cc);
securityServiceRef.activate(cc);
insertJMXSecurityFilter();
} | java | protected synchronized void activate(ComponentContext cc) {
pipelineRef.activate(cc);
securityServiceRef.activate(cc);
insertJMXSecurityFilter();
} | [
"protected",
"synchronized",
"void",
"activate",
"(",
"ComponentContext",
"cc",
")",
"{",
"pipelineRef",
".",
"activate",
"(",
"cc",
")",
";",
"securityServiceRef",
".",
"activate",
"(",
"cc",
")",
";",
"insertJMXSecurityFilter",
"(",
")",
";",
"}"
] | Insert the JMX security filter upon activation. This will only
happen if we have both the MBeanServerPipeline and the SecurityService.
@param cc | [
"Insert",
"the",
"JMX",
"security",
"filter",
"upon",
"activation",
".",
"This",
"will",
"only",
"happen",
"if",
"we",
"have",
"both",
"the",
"MBeanServerPipeline",
"and",
"the",
"SecurityService",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.management.security/src/com/ibm/ws/management/security/internal/JMXSecurityMBeanServer.java#L93-L98 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.management.security/src/com/ibm/ws/management/security/internal/JMXSecurityMBeanServer.java | JMXSecurityMBeanServer.deactivate | protected synchronized void deactivate(ComponentContext cc) {
removeJMXSecurityFilter();
pipelineRef.deactivate(cc);
securityServiceRef.deactivate(cc);
} | java | protected synchronized void deactivate(ComponentContext cc) {
removeJMXSecurityFilter();
pipelineRef.deactivate(cc);
securityServiceRef.deactivate(cc);
} | [
"protected",
"synchronized",
"void",
"deactivate",
"(",
"ComponentContext",
"cc",
")",
"{",
"removeJMXSecurityFilter",
"(",
")",
";",
"pipelineRef",
".",
"deactivate",
"(",
"cc",
")",
";",
"securityServiceRef",
".",
"deactivate",
"(",
"cc",
")",
";",
"}"
] | Remove the JMX security filter upon deactivation.
@param cc | [
"Remove",
"the",
"JMX",
"security",
"filter",
"upon",
"deactivation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.management.security/src/com/ibm/ws/management/security/internal/JMXSecurityMBeanServer.java#L120-L125 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.management.security/src/com/ibm/ws/management/security/internal/JMXSecurityMBeanServer.java | JMXSecurityMBeanServer.throwAuthzException | private void throwAuthzException() throws SecurityException {
SubjectManager subjectManager = new SubjectManager();
String name = "UNAUTHENTICATED";
if (subjectManager.getInvocationSubject() != null) {
name = subjectManager.getInvocationSubject().getPrincipals().iterator().next().getName();
}
Tr.audit(tc, "MANAGEMENT_SECURITY_AUTHZ_FAILED", name, "MBeanAccess", requiredRoles);
String message = Tr.formatMessage(tc, "MANAGEMENT_SECURITY_AUTHZ_FAILED", name, "MBeanAccess", requiredRoles);
throw new SecurityException(message);
} | java | private void throwAuthzException() throws SecurityException {
SubjectManager subjectManager = new SubjectManager();
String name = "UNAUTHENTICATED";
if (subjectManager.getInvocationSubject() != null) {
name = subjectManager.getInvocationSubject().getPrincipals().iterator().next().getName();
}
Tr.audit(tc, "MANAGEMENT_SECURITY_AUTHZ_FAILED", name, "MBeanAccess", requiredRoles);
String message = Tr.formatMessage(tc, "MANAGEMENT_SECURITY_AUTHZ_FAILED", name, "MBeanAccess", requiredRoles);
throw new SecurityException(message);
} | [
"private",
"void",
"throwAuthzException",
"(",
")",
"throws",
"SecurityException",
"{",
"SubjectManager",
"subjectManager",
"=",
"new",
"SubjectManager",
"(",
")",
";",
"String",
"name",
"=",
"\"UNAUTHENTICATED\"",
";",
"if",
"(",
"subjectManager",
".",
"getInvocationSubject",
"(",
")",
"!=",
"null",
")",
"{",
"name",
"=",
"subjectManager",
".",
"getInvocationSubject",
"(",
")",
".",
"getPrincipals",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
".",
"getName",
"(",
")",
";",
"}",
"Tr",
".",
"audit",
"(",
"tc",
",",
"\"MANAGEMENT_SECURITY_AUTHZ_FAILED\"",
",",
"name",
",",
"\"MBeanAccess\"",
",",
"requiredRoles",
")",
";",
"String",
"message",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"MANAGEMENT_SECURITY_AUTHZ_FAILED\"",
",",
"name",
",",
"\"MBeanAccess\"",
",",
"requiredRoles",
")",
";",
"throw",
"new",
"SecurityException",
"(",
"message",
")",
";",
"}"
] | Throwing a SecurityException as not all of the methods that need
protection throw an MBeanException. We can change this if we need to.
@throws SecurityException | [
"Throwing",
"a",
"SecurityException",
"as",
"not",
"all",
"of",
"the",
"methods",
"that",
"need",
"protection",
"throw",
"an",
"MBeanException",
".",
"We",
"can",
"change",
"this",
"if",
"we",
"need",
"to",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.management.security/src/com/ibm/ws/management/security/internal/JMXSecurityMBeanServer.java#L162-L171 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationRegistry.java | NotificationRegistry.setupNotificationArea | protected void setupNotificationArea() throws Throwable {
final String sourceMethod = "setupNotificationArea";
URL notificationsURL = null;
HttpsURLConnection connection = null;
try {
// Get URL for creating a notification area
notificationsURL = serverConnection.getNotificationsURL();
if (logger.isLoggable(Level.FINEST)) {
logger.logp(Level.FINEST, logger.getName(), sourceMethod, "[" + RESTClientMessagesUtil.getObjID(this) + "] About to call notificationURL: " + notificationsURL);
}
// Get connection to server
connection = serverConnection.getConnection(notificationsURL, HttpMethod.POST, true);
// Create NotificationSettings object
NotificationSettings ns = new NotificationSettings();
ns.deliveryInterval = serverConnection.getConnector().getNotificationDeliveryInterval();
ns.inboxExpiry = serverConnection.getConnector().getNotificationInboxExpiry();
// Write CreateMBean JSON to connection output stream
OutputStream output = connection.getOutputStream();
converter.writeNotificationSettings(output, ns);
output.flush();
} catch (ConnectException ce) {
// Server is down; not a client bug
throw ce;
} catch (IOException io) {
throw serverConnection.getRequestErrorException(sourceMethod, io, notificationsURL);
}
// Check response code from server
final int responseCode = connection.getResponseCode();
if (logger.isLoggable(Level.FINEST)) {
logger.logp(Level.FINEST, logger.getName(), sourceMethod, "Received responseCode: " + responseCode);
}
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
JSONConverter converter = JSONConverter.getConverter();
try {
// Process and return server response, which should be a NotificationArea
NotificationArea area = converter.readNotificationArea(connection.getInputStream());
inboxURL = new DynamicURL(serverConnection.connector, area.inboxURL);
registrationsURL = new DynamicURL(serverConnection.connector, area.registrationsURL);
serverRegistrationsURL = new DynamicURL(serverConnection.connector, area.serverRegistrationsURL);
notificationClientURL = new DynamicURL(serverConnection.connector, area.clientURL);
if (logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, logger.getName(), "setupNotificationArea", "Successfully setup inboxURL: " + inboxURL.getURL());
}
break;
} catch (Exception e) {
throw serverConnection.getResponseErrorException(sourceMethod, e, notificationsURL);
} finally {
JSONConverter.returnConverter(converter);
}
case HttpURLConnection.HTTP_NOT_FOUND:
throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.URL_NOT_FOUND));
case HttpURLConnection.HTTP_UNAVAILABLE:
case HttpURLConnection.HTTP_BAD_REQUEST:
case HttpURLConnection.HTTP_INTERNAL_ERROR:
// Server response should be a serialized Throwable
throw serverConnection.getServerThrowable(sourceMethod, connection);
case HttpURLConnection.HTTP_UNAUTHORIZED:
case HttpURLConnection.HTTP_FORBIDDEN:
throw serverConnection.getBadCredentialsException(responseCode, connection);
default:
throw serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection);
}
} | java | protected void setupNotificationArea() throws Throwable {
final String sourceMethod = "setupNotificationArea";
URL notificationsURL = null;
HttpsURLConnection connection = null;
try {
// Get URL for creating a notification area
notificationsURL = serverConnection.getNotificationsURL();
if (logger.isLoggable(Level.FINEST)) {
logger.logp(Level.FINEST, logger.getName(), sourceMethod, "[" + RESTClientMessagesUtil.getObjID(this) + "] About to call notificationURL: " + notificationsURL);
}
// Get connection to server
connection = serverConnection.getConnection(notificationsURL, HttpMethod.POST, true);
// Create NotificationSettings object
NotificationSettings ns = new NotificationSettings();
ns.deliveryInterval = serverConnection.getConnector().getNotificationDeliveryInterval();
ns.inboxExpiry = serverConnection.getConnector().getNotificationInboxExpiry();
// Write CreateMBean JSON to connection output stream
OutputStream output = connection.getOutputStream();
converter.writeNotificationSettings(output, ns);
output.flush();
} catch (ConnectException ce) {
// Server is down; not a client bug
throw ce;
} catch (IOException io) {
throw serverConnection.getRequestErrorException(sourceMethod, io, notificationsURL);
}
// Check response code from server
final int responseCode = connection.getResponseCode();
if (logger.isLoggable(Level.FINEST)) {
logger.logp(Level.FINEST, logger.getName(), sourceMethod, "Received responseCode: " + responseCode);
}
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
JSONConverter converter = JSONConverter.getConverter();
try {
// Process and return server response, which should be a NotificationArea
NotificationArea area = converter.readNotificationArea(connection.getInputStream());
inboxURL = new DynamicURL(serverConnection.connector, area.inboxURL);
registrationsURL = new DynamicURL(serverConnection.connector, area.registrationsURL);
serverRegistrationsURL = new DynamicURL(serverConnection.connector, area.serverRegistrationsURL);
notificationClientURL = new DynamicURL(serverConnection.connector, area.clientURL);
if (logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, logger.getName(), "setupNotificationArea", "Successfully setup inboxURL: " + inboxURL.getURL());
}
break;
} catch (Exception e) {
throw serverConnection.getResponseErrorException(sourceMethod, e, notificationsURL);
} finally {
JSONConverter.returnConverter(converter);
}
case HttpURLConnection.HTTP_NOT_FOUND:
throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.URL_NOT_FOUND));
case HttpURLConnection.HTTP_UNAVAILABLE:
case HttpURLConnection.HTTP_BAD_REQUEST:
case HttpURLConnection.HTTP_INTERNAL_ERROR:
// Server response should be a serialized Throwable
throw serverConnection.getServerThrowable(sourceMethod, connection);
case HttpURLConnection.HTTP_UNAUTHORIZED:
case HttpURLConnection.HTTP_FORBIDDEN:
throw serverConnection.getBadCredentialsException(responseCode, connection);
default:
throw serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection);
}
} | [
"protected",
"void",
"setupNotificationArea",
"(",
")",
"throws",
"Throwable",
"{",
"final",
"String",
"sourceMethod",
"=",
"\"setupNotificationArea\"",
";",
"URL",
"notificationsURL",
"=",
"null",
";",
"HttpsURLConnection",
"connection",
"=",
"null",
";",
"try",
"{",
"// Get URL for creating a notification area",
"notificationsURL",
"=",
"serverConnection",
".",
"getNotificationsURL",
"(",
")",
";",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINEST",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINEST",
",",
"logger",
".",
"getName",
"(",
")",
",",
"sourceMethod",
",",
"\"[\"",
"+",
"RESTClientMessagesUtil",
".",
"getObjID",
"(",
"this",
")",
"+",
"\"] About to call notificationURL: \"",
"+",
"notificationsURL",
")",
";",
"}",
"// Get connection to server",
"connection",
"=",
"serverConnection",
".",
"getConnection",
"(",
"notificationsURL",
",",
"HttpMethod",
".",
"POST",
",",
"true",
")",
";",
"// Create NotificationSettings object",
"NotificationSettings",
"ns",
"=",
"new",
"NotificationSettings",
"(",
")",
";",
"ns",
".",
"deliveryInterval",
"=",
"serverConnection",
".",
"getConnector",
"(",
")",
".",
"getNotificationDeliveryInterval",
"(",
")",
";",
"ns",
".",
"inboxExpiry",
"=",
"serverConnection",
".",
"getConnector",
"(",
")",
".",
"getNotificationInboxExpiry",
"(",
")",
";",
"// Write CreateMBean JSON to connection output stream",
"OutputStream",
"output",
"=",
"connection",
".",
"getOutputStream",
"(",
")",
";",
"converter",
".",
"writeNotificationSettings",
"(",
"output",
",",
"ns",
")",
";",
"output",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"ConnectException",
"ce",
")",
"{",
"// Server is down; not a client bug",
"throw",
"ce",
";",
"}",
"catch",
"(",
"IOException",
"io",
")",
"{",
"throw",
"serverConnection",
".",
"getRequestErrorException",
"(",
"sourceMethod",
",",
"io",
",",
"notificationsURL",
")",
";",
"}",
"// Check response code from server",
"final",
"int",
"responseCode",
"=",
"connection",
".",
"getResponseCode",
"(",
")",
";",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINEST",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINEST",
",",
"logger",
".",
"getName",
"(",
")",
",",
"sourceMethod",
",",
"\"Received responseCode: \"",
"+",
"responseCode",
")",
";",
"}",
"switch",
"(",
"responseCode",
")",
"{",
"case",
"HttpURLConnection",
".",
"HTTP_OK",
":",
"JSONConverter",
"converter",
"=",
"JSONConverter",
".",
"getConverter",
"(",
")",
";",
"try",
"{",
"// Process and return server response, which should be a NotificationArea",
"NotificationArea",
"area",
"=",
"converter",
".",
"readNotificationArea",
"(",
"connection",
".",
"getInputStream",
"(",
")",
")",
";",
"inboxURL",
"=",
"new",
"DynamicURL",
"(",
"serverConnection",
".",
"connector",
",",
"area",
".",
"inboxURL",
")",
";",
"registrationsURL",
"=",
"new",
"DynamicURL",
"(",
"serverConnection",
".",
"connector",
",",
"area",
".",
"registrationsURL",
")",
";",
"serverRegistrationsURL",
"=",
"new",
"DynamicURL",
"(",
"serverConnection",
".",
"connector",
",",
"area",
".",
"serverRegistrationsURL",
")",
";",
"notificationClientURL",
"=",
"new",
"DynamicURL",
"(",
"serverConnection",
".",
"connector",
",",
"area",
".",
"clientURL",
")",
";",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINER",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINER",
",",
"logger",
".",
"getName",
"(",
")",
",",
"\"setupNotificationArea\"",
",",
"\"Successfully setup inboxURL: \"",
"+",
"inboxURL",
".",
"getURL",
"(",
")",
")",
";",
"}",
"break",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"serverConnection",
".",
"getResponseErrorException",
"(",
"sourceMethod",
",",
"e",
",",
"notificationsURL",
")",
";",
"}",
"finally",
"{",
"JSONConverter",
".",
"returnConverter",
"(",
"converter",
")",
";",
"}",
"case",
"HttpURLConnection",
".",
"HTTP_NOT_FOUND",
":",
"throw",
"new",
"IOException",
"(",
"RESTClientMessagesUtil",
".",
"getMessage",
"(",
"RESTClientMessagesUtil",
".",
"URL_NOT_FOUND",
")",
")",
";",
"case",
"HttpURLConnection",
".",
"HTTP_UNAVAILABLE",
":",
"case",
"HttpURLConnection",
".",
"HTTP_BAD_REQUEST",
":",
"case",
"HttpURLConnection",
".",
"HTTP_INTERNAL_ERROR",
":",
"// Server response should be a serialized Throwable",
"throw",
"serverConnection",
".",
"getServerThrowable",
"(",
"sourceMethod",
",",
"connection",
")",
";",
"case",
"HttpURLConnection",
".",
"HTTP_UNAUTHORIZED",
":",
"case",
"HttpURLConnection",
".",
"HTTP_FORBIDDEN",
":",
"throw",
"serverConnection",
".",
"getBadCredentialsException",
"(",
"responseCode",
",",
"connection",
")",
";",
"default",
":",
"throw",
"serverConnection",
".",
"getResponseCodeErrorException",
"(",
"sourceMethod",
",",
"responseCode",
",",
"connection",
")",
";",
"}",
"}"
] | we want to avoid cycles. | [
"we",
"want",
"to",
"avoid",
"cycles",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationRegistry.java#L78-L151 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationRegistry.java | NotificationRegistry.sendClosingSignal | private void sendClosingSignal() {
URL clientURL = null;
HttpsURLConnection connection = null;
try {
// Get the appropriate URL to delete notification client
if (serverConnection.serverVersion >= 4) {
//V4+ clients use /{clientID} to delete the notification client
clientURL = getNotificationClientURL();
} else {
//Pre-V4 clients use /{clientID}/inbox to delete the notification client
clientURL = getInboxURL();
}
if (logger.isLoggable(Level.FINEST)) {
logger.logp(Level.FINEST,
logger.getName(),
"sendClosingSignal",
"Making a call to delete inbox [" + clientURL + "] from ["
+ RESTClientMessagesUtil.getObjID(this) + "]");
}
// Get connection to server
connection = serverConnection.getConnection(clientURL, HttpMethod.DELETE, true);
connection.setReadTimeout(serverConnection.getConnector().getReadTimeout());
// Check response code from server
int responseCode = 0;
try {
responseCode = connection.getResponseCode();
} catch (ConnectException ce) {
logger.logp(Level.FINE, logger.getName(), "sendClosingSignal", ce.getMessage(), ce);
}
if (logger.isLoggable(Level.FINEST)) {
logger.logp(Level.FINEST, logger.getName(), "sendClosingSignal", "Response code: " + responseCode);
}
} catch (IOException io) {
logger.logp(Level.FINE, logger.getName(), "sendClosingSignal", io.getMessage(), io);
}
} | java | private void sendClosingSignal() {
URL clientURL = null;
HttpsURLConnection connection = null;
try {
// Get the appropriate URL to delete notification client
if (serverConnection.serverVersion >= 4) {
//V4+ clients use /{clientID} to delete the notification client
clientURL = getNotificationClientURL();
} else {
//Pre-V4 clients use /{clientID}/inbox to delete the notification client
clientURL = getInboxURL();
}
if (logger.isLoggable(Level.FINEST)) {
logger.logp(Level.FINEST,
logger.getName(),
"sendClosingSignal",
"Making a call to delete inbox [" + clientURL + "] from ["
+ RESTClientMessagesUtil.getObjID(this) + "]");
}
// Get connection to server
connection = serverConnection.getConnection(clientURL, HttpMethod.DELETE, true);
connection.setReadTimeout(serverConnection.getConnector().getReadTimeout());
// Check response code from server
int responseCode = 0;
try {
responseCode = connection.getResponseCode();
} catch (ConnectException ce) {
logger.logp(Level.FINE, logger.getName(), "sendClosingSignal", ce.getMessage(), ce);
}
if (logger.isLoggable(Level.FINEST)) {
logger.logp(Level.FINEST, logger.getName(), "sendClosingSignal", "Response code: " + responseCode);
}
} catch (IOException io) {
logger.logp(Level.FINE, logger.getName(), "sendClosingSignal", io.getMessage(), io);
}
} | [
"private",
"void",
"sendClosingSignal",
"(",
")",
"{",
"URL",
"clientURL",
"=",
"null",
";",
"HttpsURLConnection",
"connection",
"=",
"null",
";",
"try",
"{",
"// Get the appropriate URL to delete notification client",
"if",
"(",
"serverConnection",
".",
"serverVersion",
">=",
"4",
")",
"{",
"//V4+ clients use /{clientID} to delete the notification client",
"clientURL",
"=",
"getNotificationClientURL",
"(",
")",
";",
"}",
"else",
"{",
"//Pre-V4 clients use /{clientID}/inbox to delete the notification client",
"clientURL",
"=",
"getInboxURL",
"(",
")",
";",
"}",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINEST",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINEST",
",",
"logger",
".",
"getName",
"(",
")",
",",
"\"sendClosingSignal\"",
",",
"\"Making a call to delete inbox [\"",
"+",
"clientURL",
"+",
"\"] from [\"",
"+",
"RESTClientMessagesUtil",
".",
"getObjID",
"(",
"this",
")",
"+",
"\"]\"",
")",
";",
"}",
"// Get connection to server",
"connection",
"=",
"serverConnection",
".",
"getConnection",
"(",
"clientURL",
",",
"HttpMethod",
".",
"DELETE",
",",
"true",
")",
";",
"connection",
".",
"setReadTimeout",
"(",
"serverConnection",
".",
"getConnector",
"(",
")",
".",
"getReadTimeout",
"(",
")",
")",
";",
"// Check response code from server",
"int",
"responseCode",
"=",
"0",
";",
"try",
"{",
"responseCode",
"=",
"connection",
".",
"getResponseCode",
"(",
")",
";",
"}",
"catch",
"(",
"ConnectException",
"ce",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"logger",
".",
"getName",
"(",
")",
",",
"\"sendClosingSignal\"",
",",
"ce",
".",
"getMessage",
"(",
")",
",",
"ce",
")",
";",
"}",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINEST",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINEST",
",",
"logger",
".",
"getName",
"(",
")",
",",
"\"sendClosingSignal\"",
",",
"\"Response code: \"",
"+",
"responseCode",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"io",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"logger",
".",
"getName",
"(",
")",
",",
"\"sendClosingSignal\"",
",",
"io",
".",
"getMessage",
"(",
")",
",",
"io",
")",
";",
"}",
"}"
] | We don't throw any errors because the connector is about to be closed. | [
"We",
"don",
"t",
"throw",
"any",
"errors",
"because",
"the",
"connector",
"is",
"about",
"to",
"be",
"closed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationRegistry.java#L285-L324 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/utils/InjectionUtils.java | InjectionUtils.getAsynchronizedGenericType | private static Type getAsynchronizedGenericType(Object targetObject) {
if (targetObject instanceof java.util.Collection) {
Class<? extends java.util.Collection> rawType = (Class<? extends Collection>) targetObject.getClass();
Class<?> actualType = Object.class;
if (((java.util.Collection<?>) targetObject).size() > 0) {
Object element = ((java.util.Collection<?>) targetObject).iterator().next();
actualType = element.getClass();
}
return new ParameterizedType() {
private Type actualType, rawType;
public ParameterizedType setTypes(Type actualType, Type rawType) {
this.actualType = actualType;
this.rawType = rawType;
return this;
}
@Override
public Type[] getActualTypeArguments() {
return new Type[] { actualType };
}
@Override
public Type getRawType() {
return rawType;
}
@Override
public Type getOwnerType() {
return null;
}
}.setTypes(actualType, rawType);
} else
return targetObject.getClass();
} | java | private static Type getAsynchronizedGenericType(Object targetObject) {
if (targetObject instanceof java.util.Collection) {
Class<? extends java.util.Collection> rawType = (Class<? extends Collection>) targetObject.getClass();
Class<?> actualType = Object.class;
if (((java.util.Collection<?>) targetObject).size() > 0) {
Object element = ((java.util.Collection<?>) targetObject).iterator().next();
actualType = element.getClass();
}
return new ParameterizedType() {
private Type actualType, rawType;
public ParameterizedType setTypes(Type actualType, Type rawType) {
this.actualType = actualType;
this.rawType = rawType;
return this;
}
@Override
public Type[] getActualTypeArguments() {
return new Type[] { actualType };
}
@Override
public Type getRawType() {
return rawType;
}
@Override
public Type getOwnerType() {
return null;
}
}.setTypes(actualType, rawType);
} else
return targetObject.getClass();
} | [
"private",
"static",
"Type",
"getAsynchronizedGenericType",
"(",
"Object",
"targetObject",
")",
"{",
"if",
"(",
"targetObject",
"instanceof",
"java",
".",
"util",
".",
"Collection",
")",
"{",
"Class",
"<",
"?",
"extends",
"java",
".",
"util",
".",
"Collection",
">",
"rawType",
"=",
"(",
"Class",
"<",
"?",
"extends",
"Collection",
">",
")",
"targetObject",
".",
"getClass",
"(",
")",
";",
"Class",
"<",
"?",
">",
"actualType",
"=",
"Object",
".",
"class",
";",
"if",
"(",
"(",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"?",
">",
")",
"targetObject",
")",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"Object",
"element",
"=",
"(",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"?",
">",
")",
"targetObject",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"actualType",
"=",
"element",
".",
"getClass",
"(",
")",
";",
"}",
"return",
"new",
"ParameterizedType",
"(",
")",
"{",
"private",
"Type",
"actualType",
",",
"rawType",
";",
"public",
"ParameterizedType",
"setTypes",
"(",
"Type",
"actualType",
",",
"Type",
"rawType",
")",
"{",
"this",
".",
"actualType",
"=",
"actualType",
";",
"this",
".",
"rawType",
"=",
"rawType",
";",
"return",
"this",
";",
"}",
"@",
"Override",
"public",
"Type",
"[",
"]",
"getActualTypeArguments",
"(",
")",
"{",
"return",
"new",
"Type",
"[",
"]",
"{",
"actualType",
"}",
";",
"}",
"@",
"Override",
"public",
"Type",
"getRawType",
"(",
")",
"{",
"return",
"rawType",
";",
"}",
"@",
"Override",
"public",
"Type",
"getOwnerType",
"(",
")",
"{",
"return",
"null",
";",
"}",
"}",
".",
"setTypes",
"(",
"actualType",
",",
"rawType",
")",
";",
"}",
"else",
"return",
"targetObject",
".",
"getClass",
"(",
")",
";",
"}"
] | Hack to generate a type class for collection object.
@param targetObject
@return | [
"Hack",
"to",
"generate",
"a",
"type",
"class",
"for",
"collection",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/utils/InjectionUtils.java#L1780-L1815 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java | RecoveryDirectorImpl.currentFailureScope | @Override
public synchronized FailureScope currentFailureScope() {
if (tc.isEntryEnabled())
Tr.entry(tc, "currentFailureScope", this);
if (_currentFailureScope == null) {
_currentFailureScope = new FileFailureScope();
}
if (tc.isEntryEnabled())
Tr.exit(tc, "currentFailureScope", _currentFailureScope);
return _currentFailureScope;
} | java | @Override
public synchronized FailureScope currentFailureScope() {
if (tc.isEntryEnabled())
Tr.entry(tc, "currentFailureScope", this);
if (_currentFailureScope == null) {
_currentFailureScope = new FileFailureScope();
}
if (tc.isEntryEnabled())
Tr.exit(tc, "currentFailureScope", _currentFailureScope);
return _currentFailureScope;
} | [
"@",
"Override",
"public",
"synchronized",
"FailureScope",
"currentFailureScope",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"currentFailureScope\"",
",",
"this",
")",
";",
"if",
"(",
"_currentFailureScope",
"==",
"null",
")",
"{",
"_currentFailureScope",
"=",
"new",
"FileFailureScope",
"(",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"currentFailureScope\"",
",",
"_currentFailureScope",
")",
";",
"return",
"_currentFailureScope",
";",
"}"
] | Invoked by a client service to determine the "current" FailureScope. This is
defined as a FailureScope that identifies the current point of execution. In
practice this means the current server on distributed or server region on 390.
@return FailureScope The current FailureScope. | [
"Invoked",
"by",
"a",
"client",
"service",
"to",
"determine",
"the",
"current",
"FailureScope",
".",
"This",
"is",
"defined",
"as",
"a",
"FailureScope",
"that",
"identifies",
"the",
"current",
"point",
"of",
"execution",
".",
"In",
"practice",
"this",
"means",
"the",
"current",
"server",
"on",
"distributed",
"or",
"server",
"region",
"on",
"390",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java#L579-L591 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java | RecoveryDirectorImpl.directInitialization | @Override
public void directInitialization(FailureScope failureScope) throws RecoveryFailedException {
if (tc.isEntryEnabled())
Tr.entry(tc, "directInitialization", new Object[] { failureScope, this });
// Use configuration to determine if recovery is local (for z/OS).
final FailureScope currentFailureScope = Configuration.localFailureScope(); /* @LI1578-22A */
// Synchronize to ensure consistency with the registerService
// method. The remainder of the method is not synchronized on this in order that two independant
// recovery processes may be driven concurrently on two different threads.
synchronized (_registeredRecoveryAgents) {
// Ensure that further RecoveryAgent registrations are prohibited.
_registrationAllowed = false;
}
if (currentFailureScope.equals(failureScope)) /* @LI1578-22C */
{
Tr.info(tc, "CWRLS0010_PERFORM_LOCAL_RECOVERY", failureScope.serverName());
} else {
Tr.info(tc, "CWRLS0011_PERFORM_PEER_RECOVERY", failureScope.serverName());
}
// Extract the 'values' collection from the _registeredRecoveryAgents map and create an iterator
// from it. This iterator will return ArrayList objects each containing a set of RecoveryAgent
// objects. Each ArrayList corrisponds to a different sequence priority value.
final Collection registeredRecoveryAgentsValues = _registeredRecoveryAgents.values();
Iterator registeredRecoveryAgentsValuesIterator = registeredRecoveryAgentsValues.iterator();
while (registeredRecoveryAgentsValuesIterator.hasNext()) {
// Extract the next ArrayList and create an iterator from it. This iterator will return RecoveryAgent
// objects that are registered at the same sequence priority value.
final ArrayList registeredRecoveryAgentsArray = (java.util.ArrayList) registeredRecoveryAgentsValuesIterator.next();
final Iterator registeredRecoveryAgentsArrayIterator = registeredRecoveryAgentsArray.iterator();
while (registeredRecoveryAgentsArrayIterator.hasNext()) {
// Extract the next RecoveryAgent object
final RecoveryAgent recoveryAgent = (RecoveryAgent) registeredRecoveryAgentsArrayIterator.next();
recoveryAgent.prepareForRecovery(failureScope);
// Prepare the maps for the recovery event.
addInitializationRecord(recoveryAgent, failureScope);
addRecoveryRecord(recoveryAgent, failureScope);
}
}
// This is the opportunity to kick off any Network Parition Detection logic that we deem necessary. Right
// now we are relying on the Hardware quorum support within the HA framework itself if NP's are tro be
// handled.
if (Configuration.HAEnabled()) {
// Join the "dynamic cluster" in order that IOR references can be associated with the
// resulting identity. Only do this in an HA-enabled environment.
Configuration.getRecoveryLogComponent().joinCluster(failureScope);
}
// If callbacks are registered, drive then now.
if (_registeredCallbacks != null) {
driveCallBacks(CALLBACK_RECOVERYSTARTED, failureScope);
}
// Re-set the iterator.
registeredRecoveryAgentsValuesIterator = registeredRecoveryAgentsValues.iterator();
while (registeredRecoveryAgentsValuesIterator.hasNext()) {
// Extract the next ArrayList and create an iterator from it. This iterator will return RecoveryAgent
// objects that are registered at the same sequence priority value.
final ArrayList registeredRecoveryAgentsArray = (java.util.ArrayList) registeredRecoveryAgentsValuesIterator.next();
final Iterator registeredRecoveryAgentsArrayIterator = registeredRecoveryAgentsArray.iterator();
while (registeredRecoveryAgentsArrayIterator.hasNext()) {
// Extract the next RecoveryAgent object
final RecoveryAgent recoveryAgent = (RecoveryAgent) registeredRecoveryAgentsArrayIterator.next();
// Direct the RecoveryAgent instance to process this failure scope.
try {
// Notify the listeners we're about to make the call
_eventListeners.clientRecoveryInitiated(failureScope, recoveryAgent.clientIdentifier()); /* @MD19638A */
recoveryAgent.initiateRecovery(failureScope);
} catch (RecoveryFailedException exc) {
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directInitialization", "410", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "directInitialization", exc);
throw exc;
}
// Wait for 'serialRecoveryComplete' to be called. This callback may be issued from another thread.
synchronized (_outstandingInitializationRecords) {
while (initializationOutstanding(recoveryAgent, failureScope)) {
try {
_outstandingInitializationRecords.wait();
} catch (InterruptedException exc) {
// This exception is recieved if another thread interrupts this thread by calling this threads
// Thread.interrupt method. The RecoveryDirectorImpl class does not use this mechanism for
// breaking out of the wait call - it uses notifyAll to wake up all waiting threads. This
// exception should never be generated. If for some reason it is called then ignore it and
//start to wait again.
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directInitialization", "432", this);
}
}
}
}
}
if (currentFailureScope.equals(failureScope)) /* @LI1578-22C */
{
Tr.info(tc, "CWRLS0012_DIRECT_LOCAL_RECOVERY", failureScope.serverName());
} else {
Tr.info(tc, "CWRLS0013_DIRECT_PEER_RECOVERY", failureScope.serverName());
}
if (tc.isEntryEnabled())
Tr.exit(tc, "directInitialization");
} | java | @Override
public void directInitialization(FailureScope failureScope) throws RecoveryFailedException {
if (tc.isEntryEnabled())
Tr.entry(tc, "directInitialization", new Object[] { failureScope, this });
// Use configuration to determine if recovery is local (for z/OS).
final FailureScope currentFailureScope = Configuration.localFailureScope(); /* @LI1578-22A */
// Synchronize to ensure consistency with the registerService
// method. The remainder of the method is not synchronized on this in order that two independant
// recovery processes may be driven concurrently on two different threads.
synchronized (_registeredRecoveryAgents) {
// Ensure that further RecoveryAgent registrations are prohibited.
_registrationAllowed = false;
}
if (currentFailureScope.equals(failureScope)) /* @LI1578-22C */
{
Tr.info(tc, "CWRLS0010_PERFORM_LOCAL_RECOVERY", failureScope.serverName());
} else {
Tr.info(tc, "CWRLS0011_PERFORM_PEER_RECOVERY", failureScope.serverName());
}
// Extract the 'values' collection from the _registeredRecoveryAgents map and create an iterator
// from it. This iterator will return ArrayList objects each containing a set of RecoveryAgent
// objects. Each ArrayList corrisponds to a different sequence priority value.
final Collection registeredRecoveryAgentsValues = _registeredRecoveryAgents.values();
Iterator registeredRecoveryAgentsValuesIterator = registeredRecoveryAgentsValues.iterator();
while (registeredRecoveryAgentsValuesIterator.hasNext()) {
// Extract the next ArrayList and create an iterator from it. This iterator will return RecoveryAgent
// objects that are registered at the same sequence priority value.
final ArrayList registeredRecoveryAgentsArray = (java.util.ArrayList) registeredRecoveryAgentsValuesIterator.next();
final Iterator registeredRecoveryAgentsArrayIterator = registeredRecoveryAgentsArray.iterator();
while (registeredRecoveryAgentsArrayIterator.hasNext()) {
// Extract the next RecoveryAgent object
final RecoveryAgent recoveryAgent = (RecoveryAgent) registeredRecoveryAgentsArrayIterator.next();
recoveryAgent.prepareForRecovery(failureScope);
// Prepare the maps for the recovery event.
addInitializationRecord(recoveryAgent, failureScope);
addRecoveryRecord(recoveryAgent, failureScope);
}
}
// This is the opportunity to kick off any Network Parition Detection logic that we deem necessary. Right
// now we are relying on the Hardware quorum support within the HA framework itself if NP's are tro be
// handled.
if (Configuration.HAEnabled()) {
// Join the "dynamic cluster" in order that IOR references can be associated with the
// resulting identity. Only do this in an HA-enabled environment.
Configuration.getRecoveryLogComponent().joinCluster(failureScope);
}
// If callbacks are registered, drive then now.
if (_registeredCallbacks != null) {
driveCallBacks(CALLBACK_RECOVERYSTARTED, failureScope);
}
// Re-set the iterator.
registeredRecoveryAgentsValuesIterator = registeredRecoveryAgentsValues.iterator();
while (registeredRecoveryAgentsValuesIterator.hasNext()) {
// Extract the next ArrayList and create an iterator from it. This iterator will return RecoveryAgent
// objects that are registered at the same sequence priority value.
final ArrayList registeredRecoveryAgentsArray = (java.util.ArrayList) registeredRecoveryAgentsValuesIterator.next();
final Iterator registeredRecoveryAgentsArrayIterator = registeredRecoveryAgentsArray.iterator();
while (registeredRecoveryAgentsArrayIterator.hasNext()) {
// Extract the next RecoveryAgent object
final RecoveryAgent recoveryAgent = (RecoveryAgent) registeredRecoveryAgentsArrayIterator.next();
// Direct the RecoveryAgent instance to process this failure scope.
try {
// Notify the listeners we're about to make the call
_eventListeners.clientRecoveryInitiated(failureScope, recoveryAgent.clientIdentifier()); /* @MD19638A */
recoveryAgent.initiateRecovery(failureScope);
} catch (RecoveryFailedException exc) {
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directInitialization", "410", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "directInitialization", exc);
throw exc;
}
// Wait for 'serialRecoveryComplete' to be called. This callback may be issued from another thread.
synchronized (_outstandingInitializationRecords) {
while (initializationOutstanding(recoveryAgent, failureScope)) {
try {
_outstandingInitializationRecords.wait();
} catch (InterruptedException exc) {
// This exception is recieved if another thread interrupts this thread by calling this threads
// Thread.interrupt method. The RecoveryDirectorImpl class does not use this mechanism for
// breaking out of the wait call - it uses notifyAll to wake up all waiting threads. This
// exception should never be generated. If for some reason it is called then ignore it and
//start to wait again.
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directInitialization", "432", this);
}
}
}
}
}
if (currentFailureScope.equals(failureScope)) /* @LI1578-22C */
{
Tr.info(tc, "CWRLS0012_DIRECT_LOCAL_RECOVERY", failureScope.serverName());
} else {
Tr.info(tc, "CWRLS0013_DIRECT_PEER_RECOVERY", failureScope.serverName());
}
if (tc.isEntryEnabled())
Tr.exit(tc, "directInitialization");
} | [
"@",
"Override",
"public",
"void",
"directInitialization",
"(",
"FailureScope",
"failureScope",
")",
"throws",
"RecoveryFailedException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"directInitialization\"",
",",
"new",
"Object",
"[",
"]",
"{",
"failureScope",
",",
"this",
"}",
")",
";",
"// Use configuration to determine if recovery is local (for z/OS).",
"final",
"FailureScope",
"currentFailureScope",
"=",
"Configuration",
".",
"localFailureScope",
"(",
")",
";",
"/* @LI1578-22A */",
"// Synchronize to ensure consistency with the registerService",
"// method. The remainder of the method is not synchronized on this in order that two independant",
"// recovery processes may be driven concurrently on two different threads.",
"synchronized",
"(",
"_registeredRecoveryAgents",
")",
"{",
"// Ensure that further RecoveryAgent registrations are prohibited.",
"_registrationAllowed",
"=",
"false",
";",
"}",
"if",
"(",
"currentFailureScope",
".",
"equals",
"(",
"failureScope",
")",
")",
"/* @LI1578-22C */",
"{",
"Tr",
".",
"info",
"(",
"tc",
",",
"\"CWRLS0010_PERFORM_LOCAL_RECOVERY\"",
",",
"failureScope",
".",
"serverName",
"(",
")",
")",
";",
"}",
"else",
"{",
"Tr",
".",
"info",
"(",
"tc",
",",
"\"CWRLS0011_PERFORM_PEER_RECOVERY\"",
",",
"failureScope",
".",
"serverName",
"(",
")",
")",
";",
"}",
"// Extract the 'values' collection from the _registeredRecoveryAgents map and create an iterator",
"// from it. This iterator will return ArrayList objects each containing a set of RecoveryAgent",
"// objects. Each ArrayList corrisponds to a different sequence priority value.",
"final",
"Collection",
"registeredRecoveryAgentsValues",
"=",
"_registeredRecoveryAgents",
".",
"values",
"(",
")",
";",
"Iterator",
"registeredRecoveryAgentsValuesIterator",
"=",
"registeredRecoveryAgentsValues",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"registeredRecoveryAgentsValuesIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"// Extract the next ArrayList and create an iterator from it. This iterator will return RecoveryAgent",
"// objects that are registered at the same sequence priority value.",
"final",
"ArrayList",
"registeredRecoveryAgentsArray",
"=",
"(",
"java",
".",
"util",
".",
"ArrayList",
")",
"registeredRecoveryAgentsValuesIterator",
".",
"next",
"(",
")",
";",
"final",
"Iterator",
"registeredRecoveryAgentsArrayIterator",
"=",
"registeredRecoveryAgentsArray",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"registeredRecoveryAgentsArrayIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"// Extract the next RecoveryAgent object",
"final",
"RecoveryAgent",
"recoveryAgent",
"=",
"(",
"RecoveryAgent",
")",
"registeredRecoveryAgentsArrayIterator",
".",
"next",
"(",
")",
";",
"recoveryAgent",
".",
"prepareForRecovery",
"(",
"failureScope",
")",
";",
"// Prepare the maps for the recovery event.",
"addInitializationRecord",
"(",
"recoveryAgent",
",",
"failureScope",
")",
";",
"addRecoveryRecord",
"(",
"recoveryAgent",
",",
"failureScope",
")",
";",
"}",
"}",
"// This is the opportunity to kick off any Network Parition Detection logic that we deem necessary. Right",
"// now we are relying on the Hardware quorum support within the HA framework itself if NP's are tro be",
"// handled.",
"if",
"(",
"Configuration",
".",
"HAEnabled",
"(",
")",
")",
"{",
"// Join the \"dynamic cluster\" in order that IOR references can be associated with the",
"// resulting identity. Only do this in an HA-enabled environment.",
"Configuration",
".",
"getRecoveryLogComponent",
"(",
")",
".",
"joinCluster",
"(",
"failureScope",
")",
";",
"}",
"// If callbacks are registered, drive then now.",
"if",
"(",
"_registeredCallbacks",
"!=",
"null",
")",
"{",
"driveCallBacks",
"(",
"CALLBACK_RECOVERYSTARTED",
",",
"failureScope",
")",
";",
"}",
"// Re-set the iterator.",
"registeredRecoveryAgentsValuesIterator",
"=",
"registeredRecoveryAgentsValues",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"registeredRecoveryAgentsValuesIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"// Extract the next ArrayList and create an iterator from it. This iterator will return RecoveryAgent",
"// objects that are registered at the same sequence priority value.",
"final",
"ArrayList",
"registeredRecoveryAgentsArray",
"=",
"(",
"java",
".",
"util",
".",
"ArrayList",
")",
"registeredRecoveryAgentsValuesIterator",
".",
"next",
"(",
")",
";",
"final",
"Iterator",
"registeredRecoveryAgentsArrayIterator",
"=",
"registeredRecoveryAgentsArray",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"registeredRecoveryAgentsArrayIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"// Extract the next RecoveryAgent object",
"final",
"RecoveryAgent",
"recoveryAgent",
"=",
"(",
"RecoveryAgent",
")",
"registeredRecoveryAgentsArrayIterator",
".",
"next",
"(",
")",
";",
"// Direct the RecoveryAgent instance to process this failure scope.",
"try",
"{",
"// Notify the listeners we're about to make the call",
"_eventListeners",
".",
"clientRecoveryInitiated",
"(",
"failureScope",
",",
"recoveryAgent",
".",
"clientIdentifier",
"(",
")",
")",
";",
"/* @MD19638A */",
"recoveryAgent",
".",
"initiateRecovery",
"(",
"failureScope",
")",
";",
"}",
"catch",
"(",
"RecoveryFailedException",
"exc",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exc",
",",
"\"com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directInitialization\"",
",",
"\"410\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"directInitialization\"",
",",
"exc",
")",
";",
"throw",
"exc",
";",
"}",
"// Wait for 'serialRecoveryComplete' to be called. This callback may be issued from another thread.",
"synchronized",
"(",
"_outstandingInitializationRecords",
")",
"{",
"while",
"(",
"initializationOutstanding",
"(",
"recoveryAgent",
",",
"failureScope",
")",
")",
"{",
"try",
"{",
"_outstandingInitializationRecords",
".",
"wait",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"exc",
")",
"{",
"// This exception is recieved if another thread interrupts this thread by calling this threads",
"// Thread.interrupt method. The RecoveryDirectorImpl class does not use this mechanism for",
"// breaking out of the wait call - it uses notifyAll to wake up all waiting threads. This",
"// exception should never be generated. If for some reason it is called then ignore it and",
"//start to wait again.",
"FFDCFilter",
".",
"processException",
"(",
"exc",
",",
"\"com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directInitialization\"",
",",
"\"432\"",
",",
"this",
")",
";",
"}",
"}",
"}",
"}",
"}",
"if",
"(",
"currentFailureScope",
".",
"equals",
"(",
"failureScope",
")",
")",
"/* @LI1578-22C */",
"{",
"Tr",
".",
"info",
"(",
"tc",
",",
"\"CWRLS0012_DIRECT_LOCAL_RECOVERY\"",
",",
"failureScope",
".",
"serverName",
"(",
")",
")",
";",
"}",
"else",
"{",
"Tr",
".",
"info",
"(",
"tc",
",",
"\"CWRLS0013_DIRECT_PEER_RECOVERY\"",
",",
"failureScope",
".",
"serverName",
"(",
")",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"directInitialization\"",
")",
";",
"}"
] | Internal method to initiate recovery processing of the given FailureScope. All
registered RecoveryAgent objects will be directed to process the FailureScope
in sequence.
@param FailureScope The FailureScope to process.
@return boolean success | [
"Internal",
"method",
"to",
"initiate",
"recovery",
"processing",
"of",
"the",
"given",
"FailureScope",
".",
"All",
"registered",
"RecoveryAgent",
"objects",
"will",
"be",
"directed",
"to",
"process",
"the",
"FailureScope",
"in",
"sequence",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java#L604-L718 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java | RecoveryDirectorImpl.directTermination | public void directTermination(FailureScope failureScope) throws TerminationFailedException {
if (tc.isEntryEnabled())
Tr.entry(tc, "directTermination", new Object[] { failureScope, this });
Tr.info(tc, "CWRLS0014_HALT_PEER_RECOVERY", failureScope.serverName());
// If callbacks are registered, drive then now.
if (_registeredCallbacks != null) {
driveCallBacks(CALLBACK_TERMINATIONSTARTED, failureScope);
}
if (Configuration.HAEnabled()) {
Configuration.getRecoveryLogComponent().leaveCluster(failureScope);
}
// Extract the 'values' collection from the _registeredRecoveryAgents map and create an iterator
// from it. This iterator will return ArrayList objects each containing a set of RecoveryAgent
// objects. Each ArrayList corrisponds to a different sequence priority value.
final Collection registeredRecoveryAgentsValues = _registeredRecoveryAgents.values();
final Iterator registeredRecoveryAgentsValuesIterator = registeredRecoveryAgentsValues.iterator();
while (registeredRecoveryAgentsValuesIterator.hasNext()) {
// Extract the next ArrayList and create an iterator from it. This iterator will return RecoveryAgent
// objects that are registered at the same sequence priority value.
final ArrayList registeredRecoveryAgentsArray = (java.util.ArrayList) registeredRecoveryAgentsValuesIterator.next();
final Iterator registeredRecoveryAgentsArrayIterator = registeredRecoveryAgentsArray.iterator();
while (registeredRecoveryAgentsArrayIterator.hasNext()) {
// Extract the next RecoveryAgent object
final RecoveryAgent recoveryAgent = (RecoveryAgent) registeredRecoveryAgentsArrayIterator.next();
// Record the fact that we have an outstanding termination request for the RecoveryAgent.
addTerminationRecord(recoveryAgent, failureScope);
// Direct the RecoveryAgent instance to terminate processing of this failure scope
try {
recoveryAgent.terminateRecovery(failureScope);
} catch (TerminationFailedException exc) {
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination", "540", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "directTermination", exc);
throw exc;
} catch (Exception exc) {
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination", "576", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "directTermination", exc);
throw new TerminationFailedException(exc);
}
// Wait for 'terminationComplete' to be called. This callback may be issued from another thread.
synchronized (_outstandingTerminationRecords) {
while (terminationOutstanding(recoveryAgent, failureScope)) {
try {
_outstandingTerminationRecords.wait();
} catch (InterruptedException exc) {
// This exception is recieved if another thread interrupts this thread by calling this threads
// Thread.interrupt method. The RecoveryDirectorImpl class does not use this mechanism for
// breaking out of the wait call - it uses notifyAll to wake up all waiting threads. This
// exception should never be generated. If for some reason it is called then ignore it and
//start to wait again.
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination", "549", this);
}
}
}
}
}
// If callbacks are registered, drive then now.
if (_registeredCallbacks != null) {
driveCallBacks(CALLBACK_TERMINATIONCOMPLETE, failureScope);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "directTermination");
} | java | public void directTermination(FailureScope failureScope) throws TerminationFailedException {
if (tc.isEntryEnabled())
Tr.entry(tc, "directTermination", new Object[] { failureScope, this });
Tr.info(tc, "CWRLS0014_HALT_PEER_RECOVERY", failureScope.serverName());
// If callbacks are registered, drive then now.
if (_registeredCallbacks != null) {
driveCallBacks(CALLBACK_TERMINATIONSTARTED, failureScope);
}
if (Configuration.HAEnabled()) {
Configuration.getRecoveryLogComponent().leaveCluster(failureScope);
}
// Extract the 'values' collection from the _registeredRecoveryAgents map and create an iterator
// from it. This iterator will return ArrayList objects each containing a set of RecoveryAgent
// objects. Each ArrayList corrisponds to a different sequence priority value.
final Collection registeredRecoveryAgentsValues = _registeredRecoveryAgents.values();
final Iterator registeredRecoveryAgentsValuesIterator = registeredRecoveryAgentsValues.iterator();
while (registeredRecoveryAgentsValuesIterator.hasNext()) {
// Extract the next ArrayList and create an iterator from it. This iterator will return RecoveryAgent
// objects that are registered at the same sequence priority value.
final ArrayList registeredRecoveryAgentsArray = (java.util.ArrayList) registeredRecoveryAgentsValuesIterator.next();
final Iterator registeredRecoveryAgentsArrayIterator = registeredRecoveryAgentsArray.iterator();
while (registeredRecoveryAgentsArrayIterator.hasNext()) {
// Extract the next RecoveryAgent object
final RecoveryAgent recoveryAgent = (RecoveryAgent) registeredRecoveryAgentsArrayIterator.next();
// Record the fact that we have an outstanding termination request for the RecoveryAgent.
addTerminationRecord(recoveryAgent, failureScope);
// Direct the RecoveryAgent instance to terminate processing of this failure scope
try {
recoveryAgent.terminateRecovery(failureScope);
} catch (TerminationFailedException exc) {
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination", "540", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "directTermination", exc);
throw exc;
} catch (Exception exc) {
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination", "576", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "directTermination", exc);
throw new TerminationFailedException(exc);
}
// Wait for 'terminationComplete' to be called. This callback may be issued from another thread.
synchronized (_outstandingTerminationRecords) {
while (terminationOutstanding(recoveryAgent, failureScope)) {
try {
_outstandingTerminationRecords.wait();
} catch (InterruptedException exc) {
// This exception is recieved if another thread interrupts this thread by calling this threads
// Thread.interrupt method. The RecoveryDirectorImpl class does not use this mechanism for
// breaking out of the wait call - it uses notifyAll to wake up all waiting threads. This
// exception should never be generated. If for some reason it is called then ignore it and
//start to wait again.
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination", "549", this);
}
}
}
}
}
// If callbacks are registered, drive then now.
if (_registeredCallbacks != null) {
driveCallBacks(CALLBACK_TERMINATIONCOMPLETE, failureScope);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "directTermination");
} | [
"public",
"void",
"directTermination",
"(",
"FailureScope",
"failureScope",
")",
"throws",
"TerminationFailedException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"directTermination\"",
",",
"new",
"Object",
"[",
"]",
"{",
"failureScope",
",",
"this",
"}",
")",
";",
"Tr",
".",
"info",
"(",
"tc",
",",
"\"CWRLS0014_HALT_PEER_RECOVERY\"",
",",
"failureScope",
".",
"serverName",
"(",
")",
")",
";",
"// If callbacks are registered, drive then now.",
"if",
"(",
"_registeredCallbacks",
"!=",
"null",
")",
"{",
"driveCallBacks",
"(",
"CALLBACK_TERMINATIONSTARTED",
",",
"failureScope",
")",
";",
"}",
"if",
"(",
"Configuration",
".",
"HAEnabled",
"(",
")",
")",
"{",
"Configuration",
".",
"getRecoveryLogComponent",
"(",
")",
".",
"leaveCluster",
"(",
"failureScope",
")",
";",
"}",
"// Extract the 'values' collection from the _registeredRecoveryAgents map and create an iterator",
"// from it. This iterator will return ArrayList objects each containing a set of RecoveryAgent",
"// objects. Each ArrayList corrisponds to a different sequence priority value.",
"final",
"Collection",
"registeredRecoveryAgentsValues",
"=",
"_registeredRecoveryAgents",
".",
"values",
"(",
")",
";",
"final",
"Iterator",
"registeredRecoveryAgentsValuesIterator",
"=",
"registeredRecoveryAgentsValues",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"registeredRecoveryAgentsValuesIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"// Extract the next ArrayList and create an iterator from it. This iterator will return RecoveryAgent",
"// objects that are registered at the same sequence priority value.",
"final",
"ArrayList",
"registeredRecoveryAgentsArray",
"=",
"(",
"java",
".",
"util",
".",
"ArrayList",
")",
"registeredRecoveryAgentsValuesIterator",
".",
"next",
"(",
")",
";",
"final",
"Iterator",
"registeredRecoveryAgentsArrayIterator",
"=",
"registeredRecoveryAgentsArray",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"registeredRecoveryAgentsArrayIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"// Extract the next RecoveryAgent object",
"final",
"RecoveryAgent",
"recoveryAgent",
"=",
"(",
"RecoveryAgent",
")",
"registeredRecoveryAgentsArrayIterator",
".",
"next",
"(",
")",
";",
"// Record the fact that we have an outstanding termination request for the RecoveryAgent.",
"addTerminationRecord",
"(",
"recoveryAgent",
",",
"failureScope",
")",
";",
"// Direct the RecoveryAgent instance to terminate processing of this failure scope",
"try",
"{",
"recoveryAgent",
".",
"terminateRecovery",
"(",
"failureScope",
")",
";",
"}",
"catch",
"(",
"TerminationFailedException",
"exc",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exc",
",",
"\"com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination\"",
",",
"\"540\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"directTermination\"",
",",
"exc",
")",
";",
"throw",
"exc",
";",
"}",
"catch",
"(",
"Exception",
"exc",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exc",
",",
"\"com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination\"",
",",
"\"576\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"directTermination\"",
",",
"exc",
")",
";",
"throw",
"new",
"TerminationFailedException",
"(",
"exc",
")",
";",
"}",
"// Wait for 'terminationComplete' to be called. This callback may be issued from another thread.",
"synchronized",
"(",
"_outstandingTerminationRecords",
")",
"{",
"while",
"(",
"terminationOutstanding",
"(",
"recoveryAgent",
",",
"failureScope",
")",
")",
"{",
"try",
"{",
"_outstandingTerminationRecords",
".",
"wait",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"exc",
")",
"{",
"// This exception is recieved if another thread interrupts this thread by calling this threads",
"// Thread.interrupt method. The RecoveryDirectorImpl class does not use this mechanism for",
"// breaking out of the wait call - it uses notifyAll to wake up all waiting threads. This",
"// exception should never be generated. If for some reason it is called then ignore it and",
"//start to wait again.",
"FFDCFilter",
".",
"processException",
"(",
"exc",
",",
"\"com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination\"",
",",
"\"549\"",
",",
"this",
")",
";",
"}",
"}",
"}",
"}",
"}",
"// If callbacks are registered, drive then now.",
"if",
"(",
"_registeredCallbacks",
"!=",
"null",
")",
"{",
"driveCallBacks",
"(",
"CALLBACK_TERMINATIONCOMPLETE",
",",
"failureScope",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"directTermination\"",
")",
";",
"}"
] | Internal method to terminate recovery processing of the given FailureScope. All
registered RecoveryAgent objects will be directed to terminate processing of the
FailureScopein sequence.
@param FailureScope The FailureScope to process. | [
"Internal",
"method",
"to",
"terminate",
"recovery",
"processing",
"of",
"the",
"given",
"FailureScope",
".",
"All",
"registered",
"RecoveryAgent",
"objects",
"will",
"be",
"directed",
"to",
"terminate",
"processing",
"of",
"the",
"FailureScopein",
"sequence",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java#L730-L804 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java | RecoveryDirectorImpl.registerRecoveryEventListener | @Override
public void registerRecoveryEventListener(RecoveryEventListener rel) /* @MD19638A */
{
if (tc.isEntryEnabled())
Tr.entry(tc, "registerRecoveryEventListener", rel);
RegisteredRecoveryEventListeners.instance().add(rel);
if (tc.isEntryEnabled())
Tr.exit(tc, "registerRecoveryEventListener");
} | java | @Override
public void registerRecoveryEventListener(RecoveryEventListener rel) /* @MD19638A */
{
if (tc.isEntryEnabled())
Tr.entry(tc, "registerRecoveryEventListener", rel);
RegisteredRecoveryEventListeners.instance().add(rel);
if (tc.isEntryEnabled())
Tr.exit(tc, "registerRecoveryEventListener");
} | [
"@",
"Override",
"public",
"void",
"registerRecoveryEventListener",
"(",
"RecoveryEventListener",
"rel",
")",
"/* @MD19638A */",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"registerRecoveryEventListener\"",
",",
"rel",
")",
";",
"RegisteredRecoveryEventListeners",
".",
"instance",
"(",
")",
".",
"add",
"(",
"rel",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"registerRecoveryEventListener\"",
")",
";",
"}"
] | Register the recovery event callback listener.
@param rel The new recovery event listener | [
"Register",
"the",
"recovery",
"event",
"callback",
"listener",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java#L1668-L1678 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java | RecoveryDirectorImpl.isHAEnabled | @Override
public boolean isHAEnabled() {
if (tc.isEntryEnabled())
Tr.entry(tc, "isHAEnabled");
final boolean haEnabled = Configuration.HAEnabled();
if (tc.isEntryEnabled())
Tr.exit(tc, "isHAEnabled", haEnabled);
return haEnabled;
} | java | @Override
public boolean isHAEnabled() {
if (tc.isEntryEnabled())
Tr.entry(tc, "isHAEnabled");
final boolean haEnabled = Configuration.HAEnabled();
if (tc.isEntryEnabled())
Tr.exit(tc, "isHAEnabled", haEnabled);
return haEnabled;
} | [
"@",
"Override",
"public",
"boolean",
"isHAEnabled",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"isHAEnabled\"",
")",
";",
"final",
"boolean",
"haEnabled",
"=",
"Configuration",
".",
"HAEnabled",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"isHAEnabled\"",
",",
"haEnabled",
")",
";",
"return",
"haEnabled",
";",
"}"
] | This method allows a client service to determine if High Availability support
has been enabled for the local cluster.
@return boolean true if HA support is enabled, otherwise false. | [
"This",
"method",
"allows",
"a",
"client",
"service",
"to",
"determine",
"if",
"High",
"Availability",
"support",
"has",
"been",
"enabled",
"for",
"the",
"local",
"cluster",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java#L1689-L1699 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/UserTransactionImpl.java | UserTransactionImpl.registerCallback | public void registerCallback(UOWScopeCallback callback)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "registerCallback", new Object[]{callback, this});
_callbackManager.addCallback(callback);
if (tc.isEntryEnabled()) Tr.exit(tc, "registerCallback");
} | java | public void registerCallback(UOWScopeCallback callback)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "registerCallback", new Object[]{callback, this});
_callbackManager.addCallback(callback);
if (tc.isEntryEnabled()) Tr.exit(tc, "registerCallback");
} | [
"public",
"void",
"registerCallback",
"(",
"UOWScopeCallback",
"callback",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"registerCallback\"",
",",
"new",
"Object",
"[",
"]",
"{",
"callback",
",",
"this",
"}",
")",
";",
"_callbackManager",
".",
"addCallback",
"(",
"callback",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"registerCallback\"",
")",
";",
"}"
] | Register users who want notification on UserTransaction Begin and End
@param callback | [
"Register",
"users",
"who",
"want",
"notification",
"on",
"UserTransaction",
"Begin",
"and",
"End"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/UserTransactionImpl.java#L281-L288 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/UserTransactionImpl.java | UserTransactionImpl.unregisterCallback | public void unregisterCallback(UOWScopeCallback callback)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "unregisterCallback", new Object[]{callback, this});
_callbackManager.removeCallback(callback);
if (tc.isEntryEnabled()) Tr.exit(tc, "unregisterCallback");
} | java | public void unregisterCallback(UOWScopeCallback callback)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "unregisterCallback", new Object[]{callback, this});
_callbackManager.removeCallback(callback);
if (tc.isEntryEnabled()) Tr.exit(tc, "unregisterCallback");
} | [
"public",
"void",
"unregisterCallback",
"(",
"UOWScopeCallback",
"callback",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"unregisterCallback\"",
",",
"new",
"Object",
"[",
"]",
"{",
"callback",
",",
"this",
"}",
")",
";",
"_callbackManager",
".",
"removeCallback",
"(",
"callback",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"unregisterCallback\"",
")",
";",
"}"
] | unregister users who want notification on UserTransaction Begin and End
@param callback | [
"unregister",
"users",
"who",
"want",
"notification",
"on",
"UserTransaction",
"Begin",
"and",
"End"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/UserTransactionImpl.java#L295-L302 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPConnLink.java | UDPConnLink.connectCommon | private void connectCommon(Object _udpRequestContextObject) throws IOException {
String localAddress = "*";
int localPort = 0;
Map<Object, Object> vcStateMap = getVirtualConnection().getStateMap();
if (vcStateMap != null) {
//
// Size of the buffer the channel should use to read.
//
String value = (String) vcStateMap.get(UDPConfigConstants.CHANNEL_RCV_BUFF_SIZE);
if (value != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, UDPConfigConstants.CHANNEL_RCV_BUFF_SIZE + " " + value);
}
cfg.setChannelReceiveBufferSize(Integer.parseInt(value));
}
//
// Receive buffer size.
//
value = (String) vcStateMap.get(UDPConfigConstants.RCV_BUFF_SIZE);
if (value != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, UDPConfigConstants.RCV_BUFF_SIZE + " " + value);
}
cfg.setReceiveBufferSize(Integer.parseInt(value));
}
//
// Send buffer size
//
value = (String) vcStateMap.get(UDPConfigConstants.SEND_BUFF_SIZE);
if (value != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, UDPConfigConstants.SEND_BUFF_SIZE + " " + value);
}
cfg.setSendBufferSize(Integer.parseInt(value));
}
}
//
// Allow for this to be null. If the requestContext is null, then just
// allow The NetworkLayer to find the port to listen on.
//
if (_udpRequestContextObject != null) {
final UDPRequestContext udpRequestContext = (UDPRequestContext) _udpRequestContextObject;
final InetSocketAddress addr = udpRequestContext.getLocalAddress();
localAddress = addr.getAddress().getHostAddress();
localPort = addr.getPort();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "connect with local address: " + localAddress + " local port: " + localPort);
}
}
udpNetworkLayer = new UDPNetworkLayer(udpChannel, workQueueMgr, localAddress, localPort);
udpNetworkLayer.initDatagramSocket(getVirtualConnection());
udpNetworkLayer.setConnLink(this);
} | java | private void connectCommon(Object _udpRequestContextObject) throws IOException {
String localAddress = "*";
int localPort = 0;
Map<Object, Object> vcStateMap = getVirtualConnection().getStateMap();
if (vcStateMap != null) {
//
// Size of the buffer the channel should use to read.
//
String value = (String) vcStateMap.get(UDPConfigConstants.CHANNEL_RCV_BUFF_SIZE);
if (value != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, UDPConfigConstants.CHANNEL_RCV_BUFF_SIZE + " " + value);
}
cfg.setChannelReceiveBufferSize(Integer.parseInt(value));
}
//
// Receive buffer size.
//
value = (String) vcStateMap.get(UDPConfigConstants.RCV_BUFF_SIZE);
if (value != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, UDPConfigConstants.RCV_BUFF_SIZE + " " + value);
}
cfg.setReceiveBufferSize(Integer.parseInt(value));
}
//
// Send buffer size
//
value = (String) vcStateMap.get(UDPConfigConstants.SEND_BUFF_SIZE);
if (value != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, UDPConfigConstants.SEND_BUFF_SIZE + " " + value);
}
cfg.setSendBufferSize(Integer.parseInt(value));
}
}
//
// Allow for this to be null. If the requestContext is null, then just
// allow The NetworkLayer to find the port to listen on.
//
if (_udpRequestContextObject != null) {
final UDPRequestContext udpRequestContext = (UDPRequestContext) _udpRequestContextObject;
final InetSocketAddress addr = udpRequestContext.getLocalAddress();
localAddress = addr.getAddress().getHostAddress();
localPort = addr.getPort();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "connect with local address: " + localAddress + " local port: " + localPort);
}
}
udpNetworkLayer = new UDPNetworkLayer(udpChannel, workQueueMgr, localAddress, localPort);
udpNetworkLayer.initDatagramSocket(getVirtualConnection());
udpNetworkLayer.setConnLink(this);
} | [
"private",
"void",
"connectCommon",
"(",
"Object",
"_udpRequestContextObject",
")",
"throws",
"IOException",
"{",
"String",
"localAddress",
"=",
"\"*\"",
";",
"int",
"localPort",
"=",
"0",
";",
"Map",
"<",
"Object",
",",
"Object",
">",
"vcStateMap",
"=",
"getVirtualConnection",
"(",
")",
".",
"getStateMap",
"(",
")",
";",
"if",
"(",
"vcStateMap",
"!=",
"null",
")",
"{",
"//",
"// Size of the buffer the channel should use to read.",
"//",
"String",
"value",
"=",
"(",
"String",
")",
"vcStateMap",
".",
"get",
"(",
"UDPConfigConstants",
".",
"CHANNEL_RCV_BUFF_SIZE",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"UDPConfigConstants",
".",
"CHANNEL_RCV_BUFF_SIZE",
"+",
"\" \"",
"+",
"value",
")",
";",
"}",
"cfg",
".",
"setChannelReceiveBufferSize",
"(",
"Integer",
".",
"parseInt",
"(",
"value",
")",
")",
";",
"}",
"//",
"// Receive buffer size.",
"//",
"value",
"=",
"(",
"String",
")",
"vcStateMap",
".",
"get",
"(",
"UDPConfigConstants",
".",
"RCV_BUFF_SIZE",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"UDPConfigConstants",
".",
"RCV_BUFF_SIZE",
"+",
"\" \"",
"+",
"value",
")",
";",
"}",
"cfg",
".",
"setReceiveBufferSize",
"(",
"Integer",
".",
"parseInt",
"(",
"value",
")",
")",
";",
"}",
"//",
"// Send buffer size",
"//",
"value",
"=",
"(",
"String",
")",
"vcStateMap",
".",
"get",
"(",
"UDPConfigConstants",
".",
"SEND_BUFF_SIZE",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"UDPConfigConstants",
".",
"SEND_BUFF_SIZE",
"+",
"\" \"",
"+",
"value",
")",
";",
"}",
"cfg",
".",
"setSendBufferSize",
"(",
"Integer",
".",
"parseInt",
"(",
"value",
")",
")",
";",
"}",
"}",
"//",
"// Allow for this to be null. If the requestContext is null, then just",
"// allow The NetworkLayer to find the port to listen on.",
"//",
"if",
"(",
"_udpRequestContextObject",
"!=",
"null",
")",
"{",
"final",
"UDPRequestContext",
"udpRequestContext",
"=",
"(",
"UDPRequestContext",
")",
"_udpRequestContextObject",
";",
"final",
"InetSocketAddress",
"addr",
"=",
"udpRequestContext",
".",
"getLocalAddress",
"(",
")",
";",
"localAddress",
"=",
"addr",
".",
"getAddress",
"(",
")",
".",
"getHostAddress",
"(",
")",
";",
"localPort",
"=",
"addr",
".",
"getPort",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"connect with local address: \"",
"+",
"localAddress",
"+",
"\" local port: \"",
"+",
"localPort",
")",
";",
"}",
"}",
"udpNetworkLayer",
"=",
"new",
"UDPNetworkLayer",
"(",
"udpChannel",
",",
"workQueueMgr",
",",
"localAddress",
",",
"localPort",
")",
";",
"udpNetworkLayer",
".",
"initDatagramSocket",
"(",
"getVirtualConnection",
"(",
")",
")",
";",
"udpNetworkLayer",
".",
"setConnLink",
"(",
"this",
")",
";",
"}"
] | Common connect logic between sync and async connect requests.
@param _udpRequestContextObject
@throws IOException | [
"Common",
"connect",
"logic",
"between",
"sync",
"and",
"async",
"connect",
"requests",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPConnLink.java#L78-L131 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/JaxWsServerMetaData.java | JaxWsServerMetaData.retrieveEndpointName | public String retrieveEndpointName(J2EEName j2eeName) {
for (Entry<String, J2EEName> entry : endpointNameJ2EENameMap.entrySet()) {
if (entry.getValue().equals(j2eeName)) {
return entry.getKey();
}
}
return null;
} | java | public String retrieveEndpointName(J2EEName j2eeName) {
for (Entry<String, J2EEName> entry : endpointNameJ2EENameMap.entrySet()) {
if (entry.getValue().equals(j2eeName)) {
return entry.getKey();
}
}
return null;
} | [
"public",
"String",
"retrieveEndpointName",
"(",
"J2EEName",
"j2eeName",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"J2EEName",
">",
"entry",
":",
"endpointNameJ2EENameMap",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"entry",
".",
"getValue",
"(",
")",
".",
"equals",
"(",
"j2eeName",
")",
")",
"{",
"return",
"entry",
".",
"getKey",
"(",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Get the endpoint name by j2eeName
@param j2eeName
@return | [
"Get",
"the",
"endpoint",
"name",
"by",
"j2eeName"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/JaxWsServerMetaData.java#L82-L89 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/collections/linkedlist/Link.java | Link._tryUnlink | private final void _tryUnlink() {
if (0 >= _cursorCount && _state == LOGICALLY_UNLINKED) {
_previousLink._nextLink = _nextLink;
_nextLink._previousLink = _previousLink;
_previousLink = null;
_nextLink = null;
// Defect 240039
//_parent = null;
_state = PHYSICALLY_UNLINKED;
}
} | java | private final void _tryUnlink() {
if (0 >= _cursorCount && _state == LOGICALLY_UNLINKED) {
_previousLink._nextLink = _nextLink;
_nextLink._previousLink = _previousLink;
_previousLink = null;
_nextLink = null;
// Defect 240039
//_parent = null;
_state = PHYSICALLY_UNLINKED;
}
} | [
"private",
"final",
"void",
"_tryUnlink",
"(",
")",
"{",
"if",
"(",
"0",
">=",
"_cursorCount",
"&&",
"_state",
"==",
"LOGICALLY_UNLINKED",
")",
"{",
"_previousLink",
".",
"_nextLink",
"=",
"_nextLink",
";",
"_nextLink",
".",
"_previousLink",
"=",
"_previousLink",
";",
"_previousLink",
"=",
"null",
";",
"_nextLink",
"=",
"null",
";",
"// Defect 240039",
"//_parent = null;",
"_state",
"=",
"PHYSICALLY_UNLINKED",
";",
"}",
"}"
] | Attempt to physically unlink the receiver if appropriate.
MUST BE CALLED UNDER _parent MONITOR. | [
"Attempt",
"to",
"physically",
"unlink",
"the",
"receiver",
"if",
"appropriate",
".",
"MUST",
"BE",
"CALLED",
"UNDER",
"_parent",
"MONITOR",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/collections/linkedlist/Link.java#L185-L195 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/collections/linkedlist/Link.java | Link.getNextLink | public final Link getNextLink() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(this, tc, "getNextLink", _positionString());
}
Link nextLink = null;
LinkedList parent = _parent;
if (null != parent) {
nextLink = _parent.getNextLink(this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(this, tc, "getNextLink", nextLink);
}
return nextLink;
} | java | public final Link getNextLink() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(this, tc, "getNextLink", _positionString());
}
Link nextLink = null;
LinkedList parent = _parent;
if (null != parent) {
nextLink = _parent.getNextLink(this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(this, tc, "getNextLink", nextLink);
}
return nextLink;
} | [
"public",
"final",
"Link",
"getNextLink",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getNextLink\"",
",",
"_positionString",
"(",
")",
")",
";",
"}",
"Link",
"nextLink",
"=",
"null",
";",
"LinkedList",
"parent",
"=",
"_parent",
";",
"if",
"(",
"null",
"!=",
"parent",
")",
"{",
"nextLink",
"=",
"_parent",
".",
"getNextLink",
"(",
"this",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getNextLink\"",
",",
"nextLink",
")",
";",
"}",
"return",
"nextLink",
";",
"}"
] | Navigate to the next logical link.
This version is for use with non-cursored navigation.
@return the next link object or null if nothing left in the list to return
@ deprecated. Use list.getNextLink(); | [
"Navigate",
"to",
"the",
"next",
"logical",
"link",
".",
"This",
"version",
"is",
"for",
"use",
"with",
"non",
"-",
"cursored",
"navigation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/collections/linkedlist/Link.java#L240-L253 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/collections/linkedlist/Link.java | Link.xmlWriteOn | public void xmlWriteOn(FormattedWriter writer) throws IOException {
String name = "link";
writer.write("<");
writer.write(name);
xmlWriteAttributesOn(writer);
writer.write(" />");
} | java | public void xmlWriteOn(FormattedWriter writer) throws IOException {
String name = "link";
writer.write("<");
writer.write(name);
xmlWriteAttributesOn(writer);
writer.write(" />");
} | [
"public",
"void",
"xmlWriteOn",
"(",
"FormattedWriter",
"writer",
")",
"throws",
"IOException",
"{",
"String",
"name",
"=",
"\"link\"",
";",
"writer",
".",
"write",
"(",
"\"<\"",
")",
";",
"writer",
".",
"write",
"(",
"name",
")",
";",
"xmlWriteAttributesOn",
"(",
"writer",
")",
";",
"writer",
".",
"write",
"(",
"\" />\"",
")",
";",
"}"
] | Default XML output.
@param buffer
@throws IOException | [
"Default",
"XML",
"output",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/collections/linkedlist/Link.java#L406-L412 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java | LifecycleCallbackHelper.doPostConstruct | @SuppressWarnings("rawtypes")
public void doPostConstruct(Class clazz, List<LifecycleCallback> postConstructs) throws InjectionException {
mainClassName = clazz.getName();
doPostConstruct(clazz, postConstructs, null);
} | java | @SuppressWarnings("rawtypes")
public void doPostConstruct(Class clazz, List<LifecycleCallback> postConstructs) throws InjectionException {
mainClassName = clazz.getName();
doPostConstruct(clazz, postConstructs, null);
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"void",
"doPostConstruct",
"(",
"Class",
"clazz",
",",
"List",
"<",
"LifecycleCallback",
">",
"postConstructs",
")",
"throws",
"InjectionException",
"{",
"mainClassName",
"=",
"clazz",
".",
"getName",
"(",
")",
";",
"doPostConstruct",
"(",
"clazz",
",",
"postConstructs",
",",
"null",
")",
";",
"}"
] | Processes the PostConstruct callback method for the application main class
@param clazz the application main class object
@param postConstructs a list of PostConstruct metadata in the application client module
@throws InjectionException | [
"Processes",
"the",
"PostConstruct",
"callback",
"method",
"for",
"the",
"application",
"main",
"class"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java#L47-L51 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java | LifecycleCallbackHelper.doPostConstruct | public void doPostConstruct(Object instance, List<LifecycleCallback> postConstructs) throws InjectionException {
doPostConstruct(instance.getClass(), postConstructs, instance);
} | java | public void doPostConstruct(Object instance, List<LifecycleCallback> postConstructs) throws InjectionException {
doPostConstruct(instance.getClass(), postConstructs, instance);
} | [
"public",
"void",
"doPostConstruct",
"(",
"Object",
"instance",
",",
"List",
"<",
"LifecycleCallback",
">",
"postConstructs",
")",
"throws",
"InjectionException",
"{",
"doPostConstruct",
"(",
"instance",
".",
"getClass",
"(",
")",
",",
"postConstructs",
",",
"instance",
")",
";",
"}"
] | Processes the PostConstruct callback method for the login callback handler class
@param instance the instance object of the login callback handler class
@param postConstructs a list of PostConstruct metadata in the application client module
@throws InjectionException | [
"Processes",
"the",
"PostConstruct",
"callback",
"method",
"for",
"the",
"login",
"callback",
"handler",
"class"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java#L60-L62 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java | LifecycleCallbackHelper.doPreDestroy | public void doPreDestroy(Object instance, List<LifecycleCallback> preDestroy) throws InjectionException {
doPreDestroy(instance.getClass(), preDestroy, instance);
} | java | public void doPreDestroy(Object instance, List<LifecycleCallback> preDestroy) throws InjectionException {
doPreDestroy(instance.getClass(), preDestroy, instance);
} | [
"public",
"void",
"doPreDestroy",
"(",
"Object",
"instance",
",",
"List",
"<",
"LifecycleCallback",
">",
"preDestroy",
")",
"throws",
"InjectionException",
"{",
"doPreDestroy",
"(",
"instance",
".",
"getClass",
"(",
")",
",",
"preDestroy",
",",
"instance",
")",
";",
"}"
] | Processes the PreDestroy callback method for the login callback handler class
@param instance the instance object of the login callback handler class
@param postConstructs a list of PreDestroy metadata in the application client module
@throws InjectionException | [
"Processes",
"the",
"PreDestroy",
"callback",
"method",
"for",
"the",
"login",
"callback",
"handler",
"class"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java#L71-L73 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java | LifecycleCallbackHelper.doPostConstruct | @SuppressWarnings("rawtypes")
private void doPostConstruct(Class clazz, List<LifecycleCallback> postConstructs, Object instance) throws InjectionException {
if (!metadataComplete && clazz.getSuperclass() != null) {
doPostConstruct(clazz.getSuperclass(), postConstructs, instance);
}
String classname = clazz.getName();
String methodName = getMethodNameFromDD(postConstructs, classname);
if (methodName != null) {
invokeMethod(clazz, methodName, instance);
} else if (!metadataComplete) {
Method method = getAnnotatedPostConstructMethod(clazz);
if (method != null) {
invokeMethod(clazz, method.getName(), instance);
}
}
} | java | @SuppressWarnings("rawtypes")
private void doPostConstruct(Class clazz, List<LifecycleCallback> postConstructs, Object instance) throws InjectionException {
if (!metadataComplete && clazz.getSuperclass() != null) {
doPostConstruct(clazz.getSuperclass(), postConstructs, instance);
}
String classname = clazz.getName();
String methodName = getMethodNameFromDD(postConstructs, classname);
if (methodName != null) {
invokeMethod(clazz, methodName, instance);
} else if (!metadataComplete) {
Method method = getAnnotatedPostConstructMethod(clazz);
if (method != null) {
invokeMethod(clazz, method.getName(), instance);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"private",
"void",
"doPostConstruct",
"(",
"Class",
"clazz",
",",
"List",
"<",
"LifecycleCallback",
">",
"postConstructs",
",",
"Object",
"instance",
")",
"throws",
"InjectionException",
"{",
"if",
"(",
"!",
"metadataComplete",
"&&",
"clazz",
".",
"getSuperclass",
"(",
")",
"!=",
"null",
")",
"{",
"doPostConstruct",
"(",
"clazz",
".",
"getSuperclass",
"(",
")",
",",
"postConstructs",
",",
"instance",
")",
";",
"}",
"String",
"classname",
"=",
"clazz",
".",
"getName",
"(",
")",
";",
"String",
"methodName",
"=",
"getMethodNameFromDD",
"(",
"postConstructs",
",",
"classname",
")",
";",
"if",
"(",
"methodName",
"!=",
"null",
")",
"{",
"invokeMethod",
"(",
"clazz",
",",
"methodName",
",",
"instance",
")",
";",
"}",
"else",
"if",
"(",
"!",
"metadataComplete",
")",
"{",
"Method",
"method",
"=",
"getAnnotatedPostConstructMethod",
"(",
"clazz",
")",
";",
"if",
"(",
"method",
"!=",
"null",
")",
"{",
"invokeMethod",
"(",
"clazz",
",",
"method",
".",
"getName",
"(",
")",
",",
"instance",
")",
";",
"}",
"}",
"}"
] | Processes the PostConstruct callback method
@param clazz the callback class object
@param postConstructs a list of PostConstruct application client module deployment descriptor.
@param instance the instance object of the callback class. It can be null for static method.
@throws InjectionException | [
"Processes",
"the",
"PostConstruct",
"callback",
"method"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java#L83-L99 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java | LifecycleCallbackHelper.getAnnotatedMethod | @SuppressWarnings("rawtypes")
public Method getAnnotatedMethod(Class clazz, Class<? extends Annotation> annotationClass) {
Method m = null;
Method[] methods = clazz.getDeclaredMethods();
for (int i = 0; i < methods.length; i++) {
Annotation[] a = methods[i].getAnnotations();
if (a != null) {
for (int j = 0; j < a.length; j++) {
if (a[j].annotationType() == annotationClass) {
if (m == null) {
m = methods[i];
} else {
Tr.warning(tc, "DUPLICATE_CALLBACK_METHOD_CWWKC2454W", new Object[] { methods[i].getName(), clazz.getName() });
}
}
}
}
}
return m;
} | java | @SuppressWarnings("rawtypes")
public Method getAnnotatedMethod(Class clazz, Class<? extends Annotation> annotationClass) {
Method m = null;
Method[] methods = clazz.getDeclaredMethods();
for (int i = 0; i < methods.length; i++) {
Annotation[] a = methods[i].getAnnotations();
if (a != null) {
for (int j = 0; j < a.length; j++) {
if (a[j].annotationType() == annotationClass) {
if (m == null) {
m = methods[i];
} else {
Tr.warning(tc, "DUPLICATE_CALLBACK_METHOD_CWWKC2454W", new Object[] { methods[i].getName(), clazz.getName() });
}
}
}
}
}
return m;
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"Method",
"getAnnotatedMethod",
"(",
"Class",
"clazz",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
")",
"{",
"Method",
"m",
"=",
"null",
";",
"Method",
"[",
"]",
"methods",
"=",
"clazz",
".",
"getDeclaredMethods",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"methods",
".",
"length",
";",
"i",
"++",
")",
"{",
"Annotation",
"[",
"]",
"a",
"=",
"methods",
"[",
"i",
"]",
".",
"getAnnotations",
"(",
")",
";",
"if",
"(",
"a",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"a",
".",
"length",
";",
"j",
"++",
")",
"{",
"if",
"(",
"a",
"[",
"j",
"]",
".",
"annotationType",
"(",
")",
"==",
"annotationClass",
")",
"{",
"if",
"(",
"m",
"==",
"null",
")",
"{",
"m",
"=",
"methods",
"[",
"i",
"]",
";",
"}",
"else",
"{",
"Tr",
".",
"warning",
"(",
"tc",
",",
"\"DUPLICATE_CALLBACK_METHOD_CWWKC2454W\"",
",",
"new",
"Object",
"[",
"]",
"{",
"methods",
"[",
"i",
"]",
".",
"getName",
"(",
")",
",",
"clazz",
".",
"getName",
"(",
")",
"}",
")",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"m",
";",
"}"
] | Gets the annotated method from the class object.
@param clazz the Class to be inspected.
@param annotationClass the annotation class object
@return a Method object or null if there is no annotated method. | [
"Gets",
"the",
"annotated",
"method",
"from",
"the",
"class",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java#L156-L177 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java | LifecycleCallbackHelper.invokeMethod | @SuppressWarnings({ "rawtypes", "unchecked" })
public void invokeMethod(final Class clazz, final String methodName, final Object instance) {
// instance can be null for the static application main method
AccessController.doPrivileged(new PrivilegedAction() {
@Override
public Object run() {
try {
final Method m = clazz.getDeclaredMethod(methodName);
if (!m.isAccessible()) {
m.setAccessible(true);
m.invoke(instance);
m.setAccessible(false);
return m;
} else {
m.invoke(instance);
return m;
}
} catch (Exception e) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, e.getMessage());
}
return null;
}
}
});
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
public void invokeMethod(final Class clazz, final String methodName, final Object instance) {
// instance can be null for the static application main method
AccessController.doPrivileged(new PrivilegedAction() {
@Override
public Object run() {
try {
final Method m = clazz.getDeclaredMethod(methodName);
if (!m.isAccessible()) {
m.setAccessible(true);
m.invoke(instance);
m.setAccessible(false);
return m;
} else {
m.invoke(instance);
return m;
}
} catch (Exception e) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, e.getMessage());
}
return null;
}
}
});
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"void",
"invokeMethod",
"(",
"final",
"Class",
"clazz",
",",
"final",
"String",
"methodName",
",",
"final",
"Object",
"instance",
")",
"{",
"// instance can be null for the static application main method",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"(",
")",
"{",
"@",
"Override",
"public",
"Object",
"run",
"(",
")",
"{",
"try",
"{",
"final",
"Method",
"m",
"=",
"clazz",
".",
"getDeclaredMethod",
"(",
"methodName",
")",
";",
"if",
"(",
"!",
"m",
".",
"isAccessible",
"(",
")",
")",
"{",
"m",
".",
"setAccessible",
"(",
"true",
")",
";",
"m",
".",
"invoke",
"(",
"instance",
")",
";",
"m",
".",
"setAccessible",
"(",
"false",
")",
";",
"return",
"m",
";",
"}",
"else",
"{",
"m",
".",
"invoke",
"(",
"instance",
")",
";",
"return",
"m",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Invokes the class method. The object instance can be null for the application main class.
@param clazz the Class object
@param methodName the Method name
@param instance the instance object of the class. It can be null if the class is the application Main. | [
"Invokes",
"the",
"class",
"method",
".",
"The",
"object",
"instance",
"can",
"be",
"null",
"for",
"the",
"application",
"main",
"class",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java#L186-L211 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java | LifecycleCallbackHelper.getMethodNameFromDD | public String getMethodNameFromDD(List<LifecycleCallback> callbacks, String classname) {
String methodName = null;
for (LifecycleCallback callback : callbacks) {
// lifecycle-callback-class default to the enclosing component class Client
String callbackClassName;
callbackClassName = callback.getClassName();
if (callbackClassName == null) {
callbackClassName = mainClassName;
}
if (callbackClassName.equals(classname)) {
if (methodName == null) {
methodName = callback.getMethodName();
} else {
Tr.warning(tc, "DUPLICATE_CALLBACK_METHOD_CWWKC2454W", new Object[] { methodName, classname });
}
}
}
return methodName;
} | java | public String getMethodNameFromDD(List<LifecycleCallback> callbacks, String classname) {
String methodName = null;
for (LifecycleCallback callback : callbacks) {
// lifecycle-callback-class default to the enclosing component class Client
String callbackClassName;
callbackClassName = callback.getClassName();
if (callbackClassName == null) {
callbackClassName = mainClassName;
}
if (callbackClassName.equals(classname)) {
if (methodName == null) {
methodName = callback.getMethodName();
} else {
Tr.warning(tc, "DUPLICATE_CALLBACK_METHOD_CWWKC2454W", new Object[] { methodName, classname });
}
}
}
return methodName;
} | [
"public",
"String",
"getMethodNameFromDD",
"(",
"List",
"<",
"LifecycleCallback",
">",
"callbacks",
",",
"String",
"classname",
")",
"{",
"String",
"methodName",
"=",
"null",
";",
"for",
"(",
"LifecycleCallback",
"callback",
":",
"callbacks",
")",
"{",
"// lifecycle-callback-class default to the enclosing component class Client",
"String",
"callbackClassName",
";",
"callbackClassName",
"=",
"callback",
".",
"getClassName",
"(",
")",
";",
"if",
"(",
"callbackClassName",
"==",
"null",
")",
"{",
"callbackClassName",
"=",
"mainClassName",
";",
"}",
"if",
"(",
"callbackClassName",
".",
"equals",
"(",
"classname",
")",
")",
"{",
"if",
"(",
"methodName",
"==",
"null",
")",
"{",
"methodName",
"=",
"callback",
".",
"getMethodName",
"(",
")",
";",
"}",
"else",
"{",
"Tr",
".",
"warning",
"(",
"tc",
",",
"\"DUPLICATE_CALLBACK_METHOD_CWWKC2454W\"",
",",
"new",
"Object",
"[",
"]",
"{",
"methodName",
",",
"classname",
"}",
")",
";",
"}",
"}",
"}",
"return",
"methodName",
";",
"}"
] | Gets the lifecycle callback method name from the application client module deployment descriptor
@param callbacks a list of lifecycle-callback in the application client module deployment descriptor
@param classname the Class name
@return the Mehtod name | [
"Gets",
"the",
"lifecycle",
"callback",
"method",
"name",
"from",
"the",
"application",
"client",
"module",
"deployment",
"descriptor"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java#L220-L238 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.token.ltpa/src/com/ibm/ws/security/token/ltpa/internal/LTPAToken2.java | LTPAToken2.encrypt | private final void encrypt() throws Exception {
String signStr = Base64Coder.toString(Base64Coder.base64Encode(signature));
String ud = userData.toString();
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "encrypt: userData" + ud);
}
byte[] accessID = Base64Coder.getBytes(ud);
StringBuilder sb = new StringBuilder(DELIM);
sb.append(getExpiration()).append(DELIM).append(signStr);
byte[] timeAndSign = getSimpleBytes(sb.toString());
byte[] toBeEnc = new byte[accessID.length + timeAndSign.length];
for (int i = 0; i < accessID.length; i++) {
toBeEnc[i] = accessID[i];
}
for (int i = accessID.length; i < toBeEnc.length; i++) {
toBeEnc[i] = timeAndSign[i - accessID.length];
}
try {
encryptedBytes = LTPAKeyUtil.encrypt(toBeEnc, sharedKey, cipher);
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Error encrypting; " + e);
}
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Encrypted bytes are: " + (encryptedBytes == null ? "" : Base64Coder.toString(Base64Coder.base64Encode(encryptedBytes))));
}
} | java | private final void encrypt() throws Exception {
String signStr = Base64Coder.toString(Base64Coder.base64Encode(signature));
String ud = userData.toString();
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "encrypt: userData" + ud);
}
byte[] accessID = Base64Coder.getBytes(ud);
StringBuilder sb = new StringBuilder(DELIM);
sb.append(getExpiration()).append(DELIM).append(signStr);
byte[] timeAndSign = getSimpleBytes(sb.toString());
byte[] toBeEnc = new byte[accessID.length + timeAndSign.length];
for (int i = 0; i < accessID.length; i++) {
toBeEnc[i] = accessID[i];
}
for (int i = accessID.length; i < toBeEnc.length; i++) {
toBeEnc[i] = timeAndSign[i - accessID.length];
}
try {
encryptedBytes = LTPAKeyUtil.encrypt(toBeEnc, sharedKey, cipher);
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Error encrypting; " + e);
}
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Encrypted bytes are: " + (encryptedBytes == null ? "" : Base64Coder.toString(Base64Coder.base64Encode(encryptedBytes))));
}
} | [
"private",
"final",
"void",
"encrypt",
"(",
")",
"throws",
"Exception",
"{",
"String",
"signStr",
"=",
"Base64Coder",
".",
"toString",
"(",
"Base64Coder",
".",
"base64Encode",
"(",
"signature",
")",
")",
";",
"String",
"ud",
"=",
"userData",
".",
"toString",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"encrypt: userData\"",
"+",
"ud",
")",
";",
"}",
"byte",
"[",
"]",
"accessID",
"=",
"Base64Coder",
".",
"getBytes",
"(",
"ud",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"DELIM",
")",
";",
"sb",
".",
"append",
"(",
"getExpiration",
"(",
")",
")",
".",
"append",
"(",
"DELIM",
")",
".",
"append",
"(",
"signStr",
")",
";",
"byte",
"[",
"]",
"timeAndSign",
"=",
"getSimpleBytes",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"byte",
"[",
"]",
"toBeEnc",
"=",
"new",
"byte",
"[",
"accessID",
".",
"length",
"+",
"timeAndSign",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"accessID",
".",
"length",
";",
"i",
"++",
")",
"{",
"toBeEnc",
"[",
"i",
"]",
"=",
"accessID",
"[",
"i",
"]",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"accessID",
".",
"length",
";",
"i",
"<",
"toBeEnc",
".",
"length",
";",
"i",
"++",
")",
"{",
"toBeEnc",
"[",
"i",
"]",
"=",
"timeAndSign",
"[",
"i",
"-",
"accessID",
".",
"length",
"]",
";",
"}",
"try",
"{",
"encryptedBytes",
"=",
"LTPAKeyUtil",
".",
"encrypt",
"(",
"toBeEnc",
",",
"sharedKey",
",",
"cipher",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Error encrypting; \"",
"+",
"e",
")",
";",
"}",
"throw",
"e",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Encrypted bytes are: \"",
"+",
"(",
"encryptedBytes",
"==",
"null",
"?",
"\"\"",
":",
"Base64Coder",
".",
"toString",
"(",
"Base64Coder",
".",
"base64Encode",
"(",
"encryptedBytes",
")",
")",
")",
")",
";",
"}",
"}"
] | Encrypt the token passed into the token.
@throws TokenException | [
"Encrypt",
"the",
"token",
"passed",
"into",
"the",
"token",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.token.ltpa/src/com/ibm/ws/security/token/ltpa/internal/LTPAToken2.java#L151-L182 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.token.ltpa/src/com/ibm/ws/security/token/ltpa/internal/LTPAToken2.java | LTPAToken2.decrypt | @FFDCIgnore({ BadPaddingException.class, Exception.class })
private final void decrypt() throws InvalidTokenException {
byte[] tokenData;
try {
tokenData = LTPAKeyUtil.decrypt(encryptedBytes.clone(), sharedKey, cipher);
checkTokenBytes(tokenData);
String UTF8TokenString = toUTF8String(tokenData);
String[] userFields = LTPATokenizer.parseToken(UTF8TokenString);
Map<String, ArrayList<String>> attribs = LTPATokenizer.parseUserData(userFields[0]);
userData = new UserData(attribs);
String tokenString = toSimpleString(tokenData);
String[] fields = LTPATokenizer.parseToken(tokenString);
String[] expirationArray = userData.getAttributes(AttributeNameConstants.WSTOKEN_EXPIRATION);
if (expirationArray != null && expirationArray[expirationArray.length - 1] != null) {
// the new expiration value inside the signature
expirationInMilliseconds = Long.parseLong(expirationArray[expirationArray.length - 1]);
} else {
// the old expiration value outside of the signature
expirationInMilliseconds = Long.parseLong(fields[1]);
}
byte[] signature = Base64Coder.base64Decode(Base64Coder.getBytes(fields[2]));
setSignature(signature);
} catch (BadPaddingException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Caught BadPaddingException while decrypting token, this is only a critical problem if decryption should have worked.", e);
}
throw new InvalidTokenException(e.getMessage(), e);
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Error decrypting; " + e);
}
throw new InvalidTokenException(e.getMessage(), e);
}
} | java | @FFDCIgnore({ BadPaddingException.class, Exception.class })
private final void decrypt() throws InvalidTokenException {
byte[] tokenData;
try {
tokenData = LTPAKeyUtil.decrypt(encryptedBytes.clone(), sharedKey, cipher);
checkTokenBytes(tokenData);
String UTF8TokenString = toUTF8String(tokenData);
String[] userFields = LTPATokenizer.parseToken(UTF8TokenString);
Map<String, ArrayList<String>> attribs = LTPATokenizer.parseUserData(userFields[0]);
userData = new UserData(attribs);
String tokenString = toSimpleString(tokenData);
String[] fields = LTPATokenizer.parseToken(tokenString);
String[] expirationArray = userData.getAttributes(AttributeNameConstants.WSTOKEN_EXPIRATION);
if (expirationArray != null && expirationArray[expirationArray.length - 1] != null) {
// the new expiration value inside the signature
expirationInMilliseconds = Long.parseLong(expirationArray[expirationArray.length - 1]);
} else {
// the old expiration value outside of the signature
expirationInMilliseconds = Long.parseLong(fields[1]);
}
byte[] signature = Base64Coder.base64Decode(Base64Coder.getBytes(fields[2]));
setSignature(signature);
} catch (BadPaddingException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Caught BadPaddingException while decrypting token, this is only a critical problem if decryption should have worked.", e);
}
throw new InvalidTokenException(e.getMessage(), e);
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Error decrypting; " + e);
}
throw new InvalidTokenException(e.getMessage(), e);
}
} | [
"@",
"FFDCIgnore",
"(",
"{",
"BadPaddingException",
".",
"class",
",",
"Exception",
".",
"class",
"}",
")",
"private",
"final",
"void",
"decrypt",
"(",
")",
"throws",
"InvalidTokenException",
"{",
"byte",
"[",
"]",
"tokenData",
";",
"try",
"{",
"tokenData",
"=",
"LTPAKeyUtil",
".",
"decrypt",
"(",
"encryptedBytes",
".",
"clone",
"(",
")",
",",
"sharedKey",
",",
"cipher",
")",
";",
"checkTokenBytes",
"(",
"tokenData",
")",
";",
"String",
"UTF8TokenString",
"=",
"toUTF8String",
"(",
"tokenData",
")",
";",
"String",
"[",
"]",
"userFields",
"=",
"LTPATokenizer",
".",
"parseToken",
"(",
"UTF8TokenString",
")",
";",
"Map",
"<",
"String",
",",
"ArrayList",
"<",
"String",
">",
">",
"attribs",
"=",
"LTPATokenizer",
".",
"parseUserData",
"(",
"userFields",
"[",
"0",
"]",
")",
";",
"userData",
"=",
"new",
"UserData",
"(",
"attribs",
")",
";",
"String",
"tokenString",
"=",
"toSimpleString",
"(",
"tokenData",
")",
";",
"String",
"[",
"]",
"fields",
"=",
"LTPATokenizer",
".",
"parseToken",
"(",
"tokenString",
")",
";",
"String",
"[",
"]",
"expirationArray",
"=",
"userData",
".",
"getAttributes",
"(",
"AttributeNameConstants",
".",
"WSTOKEN_EXPIRATION",
")",
";",
"if",
"(",
"expirationArray",
"!=",
"null",
"&&",
"expirationArray",
"[",
"expirationArray",
".",
"length",
"-",
"1",
"]",
"!=",
"null",
")",
"{",
"// the new expiration value inside the signature",
"expirationInMilliseconds",
"=",
"Long",
".",
"parseLong",
"(",
"expirationArray",
"[",
"expirationArray",
".",
"length",
"-",
"1",
"]",
")",
";",
"}",
"else",
"{",
"// the old expiration value outside of the signature",
"expirationInMilliseconds",
"=",
"Long",
".",
"parseLong",
"(",
"fields",
"[",
"1",
"]",
")",
";",
"}",
"byte",
"[",
"]",
"signature",
"=",
"Base64Coder",
".",
"base64Decode",
"(",
"Base64Coder",
".",
"getBytes",
"(",
"fields",
"[",
"2",
"]",
")",
")",
";",
"setSignature",
"(",
"signature",
")",
";",
"}",
"catch",
"(",
"BadPaddingException",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Caught BadPaddingException while decrypting token, this is only a critical problem if decryption should have worked.\"",
",",
"e",
")",
";",
"}",
"throw",
"new",
"InvalidTokenException",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Error decrypting; \"",
"+",
"e",
")",
";",
"}",
"throw",
"new",
"InvalidTokenException",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] | Decrypt the encrypted token bytes passed into the constructor. | [
"Decrypt",
"the",
"encrypted",
"token",
"bytes",
"passed",
"into",
"the",
"constructor",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.token.ltpa/src/com/ibm/ws/security/token/ltpa/internal/LTPAToken2.java#L187-L223 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.token.ltpa/src/com/ibm/ws/security/token/ltpa/internal/LTPAToken2.java | LTPAToken2.sign | private final void sign() throws Exception {
String dataStr = this.getUserData().toString();
byte[] data = Base64Coder.getBytes(dataStr);
byte[] signature = sign(data, this.privateKey);
this.setSignature(signature);
} | java | private final void sign() throws Exception {
String dataStr = this.getUserData().toString();
byte[] data = Base64Coder.getBytes(dataStr);
byte[] signature = sign(data, this.privateKey);
this.setSignature(signature);
} | [
"private",
"final",
"void",
"sign",
"(",
")",
"throws",
"Exception",
"{",
"String",
"dataStr",
"=",
"this",
".",
"getUserData",
"(",
")",
".",
"toString",
"(",
")",
";",
"byte",
"[",
"]",
"data",
"=",
"Base64Coder",
".",
"getBytes",
"(",
"dataStr",
")",
";",
"byte",
"[",
"]",
"signature",
"=",
"sign",
"(",
"data",
",",
"this",
".",
"privateKey",
")",
";",
"this",
".",
"setSignature",
"(",
"signature",
")",
";",
"}"
] | Sign the token passed into the token. | [
"Sign",
"the",
"token",
"passed",
"into",
"the",
"token",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.token.ltpa/src/com/ibm/ws/security/token/ltpa/internal/LTPAToken2.java#L228-L233 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.token.ltpa/src/com/ibm/ws/security/token/ltpa/internal/LTPAToken2.java | LTPAToken2.verify | private final boolean verify() throws Exception {
String dataStr = this.getUserData().toString();
byte[] data = Base64Coder.getBytes(dataStr);
return verify(data, signature, publicKey);
} | java | private final boolean verify() throws Exception {
String dataStr = this.getUserData().toString();
byte[] data = Base64Coder.getBytes(dataStr);
return verify(data, signature, publicKey);
} | [
"private",
"final",
"boolean",
"verify",
"(",
")",
"throws",
"Exception",
"{",
"String",
"dataStr",
"=",
"this",
".",
"getUserData",
"(",
")",
".",
"toString",
"(",
")",
";",
"byte",
"[",
"]",
"data",
"=",
"Base64Coder",
".",
"getBytes",
"(",
"dataStr",
")",
";",
"return",
"verify",
"(",
"data",
",",
"signature",
",",
"publicKey",
")",
";",
"}"
] | Verify the token. | [
"Verify",
"the",
"token",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.token.ltpa/src/com/ibm/ws/security/token/ltpa/internal/LTPAToken2.java#L251-L255 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.token.ltpa/src/com/ibm/ws/security/token/ltpa/internal/LTPAToken2.java | LTPAToken2.validateExpiration | public final void validateExpiration() throws TokenExpiredException {
Date d = new Date();
Date expD = new Date(getExpiration());
boolean expired = d.after(expD);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Current time = " + d + ", expiration time = " + expD);
}
if (expired) {
String msg = "The token has expired: current time = \"" + d + "\", expire time = \"" + expD + "\"";
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, msg);
}
throw new TokenExpiredException(expirationInMilliseconds, msg);
}
} | java | public final void validateExpiration() throws TokenExpiredException {
Date d = new Date();
Date expD = new Date(getExpiration());
boolean expired = d.after(expD);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Current time = " + d + ", expiration time = " + expD);
}
if (expired) {
String msg = "The token has expired: current time = \"" + d + "\", expire time = \"" + expD + "\"";
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, msg);
}
throw new TokenExpiredException(expirationInMilliseconds, msg);
}
} | [
"public",
"final",
"void",
"validateExpiration",
"(",
")",
"throws",
"TokenExpiredException",
"{",
"Date",
"d",
"=",
"new",
"Date",
"(",
")",
";",
"Date",
"expD",
"=",
"new",
"Date",
"(",
"getExpiration",
"(",
")",
")",
";",
"boolean",
"expired",
"=",
"d",
".",
"after",
"(",
"expD",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Current time = \"",
"+",
"d",
"+",
"\", expiration time = \"",
"+",
"expD",
")",
";",
"}",
"if",
"(",
"expired",
")",
"{",
"String",
"msg",
"=",
"\"The token has expired: current time = \\\"\"",
"+",
"d",
"+",
"\"\\\", expire time = \\\"\"",
"+",
"expD",
"+",
"\"\\\"\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"msg",
")",
";",
"}",
"throw",
"new",
"TokenExpiredException",
"(",
"expirationInMilliseconds",
",",
"msg",
")",
";",
"}",
"}"
] | Checks if the token has expired.
@throws TokenExpiredException | [
"Checks",
"if",
"the",
"token",
"has",
"expired",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.token.ltpa/src/com/ibm/ws/security/token/ltpa/internal/LTPAToken2.java#L301-L315 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.token.ltpa/src/com/ibm/ws/security/token/ltpa/internal/LTPAToken2.java | LTPAToken2.setExpiration | private final void setExpiration(long expirationInMinutes) {
expirationInMilliseconds = System.currentTimeMillis()+ expirationInMinutes * 60 * 1000;
signature = null;
if (userData != null) {
encryptedBytes = null;
userData.addAttribute("expire", Long.toString(expirationInMilliseconds));
} else {
encryptedBytes = null;
}
} | java | private final void setExpiration(long expirationInMinutes) {
expirationInMilliseconds = System.currentTimeMillis()+ expirationInMinutes * 60 * 1000;
signature = null;
if (userData != null) {
encryptedBytes = null;
userData.addAttribute("expire", Long.toString(expirationInMilliseconds));
} else {
encryptedBytes = null;
}
} | [
"private",
"final",
"void",
"setExpiration",
"(",
"long",
"expirationInMinutes",
")",
"{",
"expirationInMilliseconds",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"expirationInMinutes",
"*",
"60",
"*",
"1000",
";",
"signature",
"=",
"null",
";",
"if",
"(",
"userData",
"!=",
"null",
")",
"{",
"encryptedBytes",
"=",
"null",
";",
"userData",
".",
"addAttribute",
"(",
"\"expire\"",
",",
"Long",
".",
"toString",
"(",
"expirationInMilliseconds",
")",
")",
";",
"}",
"else",
"{",
"encryptedBytes",
"=",
"null",
";",
"}",
"}"
] | Set expiration limit of the LTPA2 token
@param expirationInMinutes the expiration limit of the LTPA2 token in minutes | [
"Set",
"expiration",
"limit",
"of",
"the",
"LTPA2",
"token"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.token.ltpa/src/com/ibm/ws/security/token/ltpa/internal/LTPAToken2.java#L414-L423 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.