repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
sequence | docstring
stringlengths 3
16k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 105
339
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.rls.jdbc/src/com/ibm/ws/recoverylog/custom/jdbc/impl/SQLNonTransactionalDataSource.java | SQLNonTransactionalDataSource.getDataSource | @FFDCIgnore(Exception.class)
public DataSource getDataSource() throws Exception {
if (tc.isEntryEnabled())
Tr.entry(tc, "getDataSource");
// Retrieve the data source factory from the CustomLogProperties. This Factory should be set in the JTMConfigurationProvider
// by the jdbc component using DeclarativeServices. TxRecoveryAgentImpl gets the factory from the ConfigurationProvider and
// then sets it into CustomLogProperties.
ResourceFactory dataSourceFactory = _customLogProperties.resourceFactory();
if (dataSourceFactory != null) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Using DataSourceFactory " + dataSourceFactory);
} else {
if (tc.isEntryEnabled())
Tr.exit(tc, "getDataSource", "Null ResourceFactory InternalLogException");
throw new InternalLogException("Failed to locate DataSource, null Resourcefactory", null);
}
try {
nonTranDataSource = (DataSource) dataSourceFactory.createResource(null);
} catch (Exception e) {
//e.printStackTrace();
if (tc.isEntryEnabled())
Tr.exit(tc, "getDataSource", "Caught exception " + e + "throw InternalLogException");
throw new InternalLogException("Failed to locate DataSource, caught exception ", null);
}
/*
* TEMPORARY This is waiting on fixes to DeclarativeServices which impact the jdbc component. At present it is
* possible that the DataSource will have been set but that its associated jdbc driver service will still be initialising
*/
// boolean refSet = false;
// while (!refSet)
// {
// if (tc.isDebugEnabled())
// Tr.debug(tc, "getDataSource after sleep");
// try {
//
// nonTranDataSource = (DataSource) dataSourceFactory.createResource(null);
// if (tc.isDebugEnabled())
// Tr.debug(tc, "Non Tran dataSource is " + nonTranDataSource);
// Connection conn = nonTranDataSource.getConnection();
// if (tc.isDebugEnabled())
// Tr.debug(tc, "Established connection " + conn);
//
// DatabaseMetaData mdata = conn.getMetaData();
//
// String dbName = mdata.getDatabaseProductName();
// if (tc.isDebugEnabled())
// Tr.debug(tc, "Database name " + dbName);
//
// String dbVersion = mdata.getDatabaseProductVersion();
// if (tc.isDebugEnabled())
// Tr.debug(tc, "Database version " + dbVersion);
// refSet = true;
// } catch (Exception e) {
// // We will catch an exception if the DataSource is not yet fully formed
// if (tc.isDebugEnabled())
// Tr.debug(tc, "Caught exception: " + e);
// }
//
// if (!refSet)
// Thread.sleep(200);
// }
// eof TEMPORARY
if (tc.isEntryEnabled())
Tr.exit(tc, "getDataSource", nonTranDataSource);
return nonTranDataSource;
} | java | @FFDCIgnore(Exception.class)
public DataSource getDataSource() throws Exception {
if (tc.isEntryEnabled())
Tr.entry(tc, "getDataSource");
// Retrieve the data source factory from the CustomLogProperties. This Factory should be set in the JTMConfigurationProvider
// by the jdbc component using DeclarativeServices. TxRecoveryAgentImpl gets the factory from the ConfigurationProvider and
// then sets it into CustomLogProperties.
ResourceFactory dataSourceFactory = _customLogProperties.resourceFactory();
if (dataSourceFactory != null) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Using DataSourceFactory " + dataSourceFactory);
} else {
if (tc.isEntryEnabled())
Tr.exit(tc, "getDataSource", "Null ResourceFactory InternalLogException");
throw new InternalLogException("Failed to locate DataSource, null Resourcefactory", null);
}
try {
nonTranDataSource = (DataSource) dataSourceFactory.createResource(null);
} catch (Exception e) {
//e.printStackTrace();
if (tc.isEntryEnabled())
Tr.exit(tc, "getDataSource", "Caught exception " + e + "throw InternalLogException");
throw new InternalLogException("Failed to locate DataSource, caught exception ", null);
}
/*
* TEMPORARY This is waiting on fixes to DeclarativeServices which impact the jdbc component. At present it is
* possible that the DataSource will have been set but that its associated jdbc driver service will still be initialising
*/
// boolean refSet = false;
// while (!refSet)
// {
// if (tc.isDebugEnabled())
// Tr.debug(tc, "getDataSource after sleep");
// try {
//
// nonTranDataSource = (DataSource) dataSourceFactory.createResource(null);
// if (tc.isDebugEnabled())
// Tr.debug(tc, "Non Tran dataSource is " + nonTranDataSource);
// Connection conn = nonTranDataSource.getConnection();
// if (tc.isDebugEnabled())
// Tr.debug(tc, "Established connection " + conn);
//
// DatabaseMetaData mdata = conn.getMetaData();
//
// String dbName = mdata.getDatabaseProductName();
// if (tc.isDebugEnabled())
// Tr.debug(tc, "Database name " + dbName);
//
// String dbVersion = mdata.getDatabaseProductVersion();
// if (tc.isDebugEnabled())
// Tr.debug(tc, "Database version " + dbVersion);
// refSet = true;
// } catch (Exception e) {
// // We will catch an exception if the DataSource is not yet fully formed
// if (tc.isDebugEnabled())
// Tr.debug(tc, "Caught exception: " + e);
// }
//
// if (!refSet)
// Thread.sleep(200);
// }
// eof TEMPORARY
if (tc.isEntryEnabled())
Tr.exit(tc, "getDataSource", nonTranDataSource);
return nonTranDataSource;
} | [
"@",
"FFDCIgnore",
"(",
"Exception",
".",
"class",
")",
"public",
"DataSource",
"getDataSource",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getDataSource\"",
")",
";",
"// Retrieve the data source factory from the CustomLogProperties. This Factory should be set in the JTMConfigurationProvider",
"// by the jdbc component using DeclarativeServices. TxRecoveryAgentImpl gets the factory from the ConfigurationProvider and",
"// then sets it into CustomLogProperties.",
"ResourceFactory",
"dataSourceFactory",
"=",
"_customLogProperties",
".",
"resourceFactory",
"(",
")",
";",
"if",
"(",
"dataSourceFactory",
"!=",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Using DataSourceFactory \"",
"+",
"dataSourceFactory",
")",
";",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getDataSource\"",
",",
"\"Null ResourceFactory InternalLogException\"",
")",
";",
"throw",
"new",
"InternalLogException",
"(",
"\"Failed to locate DataSource, null Resourcefactory\"",
",",
"null",
")",
";",
"}",
"try",
"{",
"nonTranDataSource",
"=",
"(",
"DataSource",
")",
"dataSourceFactory",
".",
"createResource",
"(",
"null",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"//e.printStackTrace();",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getDataSource\"",
",",
"\"Caught exception \"",
"+",
"e",
"+",
"\"throw InternalLogException\"",
")",
";",
"throw",
"new",
"InternalLogException",
"(",
"\"Failed to locate DataSource, caught exception \"",
",",
"null",
")",
";",
"}",
"/*\n * TEMPORARY This is waiting on fixes to DeclarativeServices which impact the jdbc component. At present it is\n * possible that the DataSource will have been set but that its associated jdbc driver service will still be initialising\n */",
"// boolean refSet = false;",
"// while (!refSet)",
"// {",
"// if (tc.isDebugEnabled())",
"// Tr.debug(tc, \"getDataSource after sleep\");",
"// try {",
"//",
"// nonTranDataSource = (DataSource) dataSourceFactory.createResource(null);",
"// if (tc.isDebugEnabled())",
"// Tr.debug(tc, \"Non Tran dataSource is \" + nonTranDataSource);",
"// Connection conn = nonTranDataSource.getConnection();",
"// if (tc.isDebugEnabled())",
"// Tr.debug(tc, \"Established connection \" + conn);",
"//",
"// DatabaseMetaData mdata = conn.getMetaData();",
"//",
"// String dbName = mdata.getDatabaseProductName();",
"// if (tc.isDebugEnabled())",
"// Tr.debug(tc, \"Database name \" + dbName);",
"//",
"// String dbVersion = mdata.getDatabaseProductVersion();",
"// if (tc.isDebugEnabled())",
"// Tr.debug(tc, \"Database version \" + dbVersion);",
"// refSet = true;",
"// } catch (Exception e) {",
"// // We will catch an exception if the DataSource is not yet fully formed",
"// if (tc.isDebugEnabled())",
"// Tr.debug(tc, \"Caught exception: \" + e);",
"// }",
"//",
"// if (!refSet)",
"// Thread.sleep(200);",
"// }",
"// eof TEMPORARY",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getDataSource\"",
",",
"nonTranDataSource",
")",
";",
"return",
"nonTranDataSource",
";",
"}"
] | Locates a DataSource in config
@return The DataSource.
@exception | [
"Locates",
"a",
"DataSource",
"in",
"config"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.rls.jdbc/src/com/ibm/ws/recoverylog/custom/jdbc/impl/SQLNonTransactionalDataSource.java#L78-L148 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsTemporaryTopicImpl.java | JmsTemporaryTopicImpl.writeObject | private void writeObject(ObjectOutputStream out) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "writeObject", out);
throw new NotSerializableException("TemporaryTopic");
} | java | private void writeObject(ObjectOutputStream out) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "writeObject", out);
throw new NotSerializableException("TemporaryTopic");
} | [
"private",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"writeObject\"",
",",
"out",
")",
";",
"throw",
"new",
"NotSerializableException",
"(",
"\"TemporaryTopic\"",
")",
";",
"}"
] | The writeObject method for serialization.
JmsDestination is declared as Serializable, which makes this class
Serializable. However, a TemporaryQueue/Topic should never be copied and
can't be used outside the scope of its session. Hence it makes no sense
to even attempt to serialize so we just throw java.io.Serial
@param out The ObjectOutputStream for serialization.
@exception IOException A java.io.NotSerializablException is always thrown. | [
"The",
"writeObject",
"method",
"for",
"serialization",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsTemporaryTopicImpl.java#L91-L94 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service/src/com/ibm/ws/container/service/app/deploy/ManifestClassPathUtils.java | ManifestClassPathUtils.addCompleteJarEntryUrls | public static void addCompleteJarEntryUrls(List<ContainerInfo> containers, Entry jarEntry, Collection<String> resolved) throws UnableToAdaptException {
String entryIdentity = createEntryIdentity(jarEntry);
if (!entryIdentity.isEmpty() && !resolved.contains(entryIdentity)) {
resolved.add(entryIdentity);
processMFClasspath(jarEntry, containers, resolved);
}
} | java | public static void addCompleteJarEntryUrls(List<ContainerInfo> containers, Entry jarEntry, Collection<String> resolved) throws UnableToAdaptException {
String entryIdentity = createEntryIdentity(jarEntry);
if (!entryIdentity.isEmpty() && !resolved.contains(entryIdentity)) {
resolved.add(entryIdentity);
processMFClasspath(jarEntry, containers, resolved);
}
} | [
"public",
"static",
"void",
"addCompleteJarEntryUrls",
"(",
"List",
"<",
"ContainerInfo",
">",
"containers",
",",
"Entry",
"jarEntry",
",",
"Collection",
"<",
"String",
">",
"resolved",
")",
"throws",
"UnableToAdaptException",
"{",
"String",
"entryIdentity",
"=",
"createEntryIdentity",
"(",
"jarEntry",
")",
";",
"if",
"(",
"!",
"entryIdentity",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"resolved",
".",
"contains",
"(",
"entryIdentity",
")",
")",
"{",
"resolved",
".",
"add",
"(",
"entryIdentity",
")",
";",
"processMFClasspath",
"(",
"jarEntry",
",",
"containers",
",",
"resolved",
")",
";",
"}",
"}"
] | Add the jar entry URLs and its class path URLs.
We need deal with all the thrown exceptions so that it won't interrupt the caller's processing.
@param urls
@param jarEntry | [
"Add",
"the",
"jar",
"entry",
"URLs",
"and",
"its",
"class",
"path",
"URLs",
".",
"We",
"need",
"deal",
"with",
"all",
"the",
"thrown",
"exceptions",
"so",
"that",
"it",
"won",
"t",
"interrupt",
"the",
"caller",
"s",
"processing",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service/src/com/ibm/ws/container/service/app/deploy/ManifestClassPathUtils.java#L177-L183 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service/src/com/ibm/ws/container/service/app/deploy/ManifestClassPathUtils.java | ManifestClassPathUtils.findClassPathEntry | private static Entry findClassPathEntry(Entry jarEntry, URI pathUri) throws URISyntaxException, UnableToAdaptException {
URI relativeJarUri = new URI("/").relativize(new URI(jarEntry.getPath()));
URI targetUri = null;
targetUri = relativeJarUri.resolve(pathUri);
if (targetUri.toString().startsWith("..")) {
Entry rootEntry = jarEntry.getRoot().adapt(Entry.class);
if (rootEntry == null || rootEntry.getPath().isEmpty()) { //already at the outermost
return null;
}
return findClassPathEntry(rootEntry, new URI("..").relativize(targetUri)); // <----
} else {
return jarEntry.getRoot().getEntry(targetUri.toString());
}
} | java | private static Entry findClassPathEntry(Entry jarEntry, URI pathUri) throws URISyntaxException, UnableToAdaptException {
URI relativeJarUri = new URI("/").relativize(new URI(jarEntry.getPath()));
URI targetUri = null;
targetUri = relativeJarUri.resolve(pathUri);
if (targetUri.toString().startsWith("..")) {
Entry rootEntry = jarEntry.getRoot().adapt(Entry.class);
if (rootEntry == null || rootEntry.getPath().isEmpty()) { //already at the outermost
return null;
}
return findClassPathEntry(rootEntry, new URI("..").relativize(targetUri)); // <----
} else {
return jarEntry.getRoot().getEntry(targetUri.toString());
}
} | [
"private",
"static",
"Entry",
"findClassPathEntry",
"(",
"Entry",
"jarEntry",
",",
"URI",
"pathUri",
")",
"throws",
"URISyntaxException",
",",
"UnableToAdaptException",
"{",
"URI",
"relativeJarUri",
"=",
"new",
"URI",
"(",
"\"/\"",
")",
".",
"relativize",
"(",
"new",
"URI",
"(",
"jarEntry",
".",
"getPath",
"(",
")",
")",
")",
";",
"URI",
"targetUri",
"=",
"null",
";",
"targetUri",
"=",
"relativeJarUri",
".",
"resolve",
"(",
"pathUri",
")",
";",
"if",
"(",
"targetUri",
".",
"toString",
"(",
")",
".",
"startsWith",
"(",
"\"..\"",
")",
")",
"{",
"Entry",
"rootEntry",
"=",
"jarEntry",
".",
"getRoot",
"(",
")",
".",
"adapt",
"(",
"Entry",
".",
"class",
")",
";",
"if",
"(",
"rootEntry",
"==",
"null",
"||",
"rootEntry",
".",
"getPath",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"//already at the outermost",
"return",
"null",
";",
"}",
"return",
"findClassPathEntry",
"(",
"rootEntry",
",",
"new",
"URI",
"(",
"\"..\"",
")",
".",
"relativize",
"(",
"targetUri",
")",
")",
";",
"// <----",
"}",
"else",
"{",
"return",
"jarEntry",
".",
"getRoot",
"(",
")",
".",
"getEntry",
"(",
"targetUri",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] | calculate the class path entry based on the jar entry
@param jarEntry
@param pathUri
@return
@throws URISyntaxException
@throws UnableToAdaptException | [
"calculate",
"the",
"class",
"path",
"entry",
"based",
"on",
"the",
"jar",
"entry"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service/src/com/ibm/ws/container/service/app/deploy/ManifestClassPathUtils.java#L194-L208 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/channelfw/objectpool/LocalThreadObjectPool.java | LocalThreadObjectPool.purge | protected Object[] purge() {
Object[] data = new Object[getCurrentNumElements()];
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "LocalPool is purging " + data.length + " items. firstEntry: " + firstEntry + " lastEntry: " + lastEntry + " poolSize: " + poolSize);
}
if (0 < data.length) {
int out = 0;
if (lastEntry >= firstEntry) {
for (int i = firstEntry; i <= lastEntry; i++) {
data[out] = free[i];
free[i] = null;
out++;
}
} else {
for (int i = firstEntry; i < poolSize; i++) {
data[out] = free[i];
free[i] = null;
out++;
}
for (int i = 0; i <= lastEntry; i++) {
data[out] = free[i];
free[i] = null;
out++;
}
}
lastEntry = -1;
firstEntry = -1;
}
return data;
} | java | protected Object[] purge() {
Object[] data = new Object[getCurrentNumElements()];
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "LocalPool is purging " + data.length + " items. firstEntry: " + firstEntry + " lastEntry: " + lastEntry + " poolSize: " + poolSize);
}
if (0 < data.length) {
int out = 0;
if (lastEntry >= firstEntry) {
for (int i = firstEntry; i <= lastEntry; i++) {
data[out] = free[i];
free[i] = null;
out++;
}
} else {
for (int i = firstEntry; i < poolSize; i++) {
data[out] = free[i];
free[i] = null;
out++;
}
for (int i = 0; i <= lastEntry; i++) {
data[out] = free[i];
free[i] = null;
out++;
}
}
lastEntry = -1;
firstEntry = -1;
}
return data;
} | [
"protected",
"Object",
"[",
"]",
"purge",
"(",
")",
"{",
"Object",
"[",
"]",
"data",
"=",
"new",
"Object",
"[",
"getCurrentNumElements",
"(",
")",
"]",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"LocalPool is purging \"",
"+",
"data",
".",
"length",
"+",
"\" items. firstEntry: \"",
"+",
"firstEntry",
"+",
"\" lastEntry: \"",
"+",
"lastEntry",
"+",
"\" poolSize: \"",
"+",
"poolSize",
")",
";",
"}",
"if",
"(",
"0",
"<",
"data",
".",
"length",
")",
"{",
"int",
"out",
"=",
"0",
";",
"if",
"(",
"lastEntry",
">=",
"firstEntry",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"firstEntry",
";",
"i",
"<=",
"lastEntry",
";",
"i",
"++",
")",
"{",
"data",
"[",
"out",
"]",
"=",
"free",
"[",
"i",
"]",
";",
"free",
"[",
"i",
"]",
"=",
"null",
";",
"out",
"++",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"firstEntry",
";",
"i",
"<",
"poolSize",
";",
"i",
"++",
")",
"{",
"data",
"[",
"out",
"]",
"=",
"free",
"[",
"i",
"]",
";",
"free",
"[",
"i",
"]",
"=",
"null",
";",
"out",
"++",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"lastEntry",
";",
"i",
"++",
")",
"{",
"data",
"[",
"out",
"]",
"=",
"free",
"[",
"i",
"]",
";",
"free",
"[",
"i",
"]",
"=",
"null",
";",
"out",
"++",
";",
"}",
"}",
"lastEntry",
"=",
"-",
"1",
";",
"firstEntry",
"=",
"-",
"1",
";",
"}",
"return",
"data",
";",
"}"
] | Purge the contents and hand them to the calling pool that
owns this threadlocal version.
@return Object[] | [
"Purge",
"the",
"contents",
"and",
"hand",
"them",
"to",
"the",
"calling",
"pool",
"that",
"owns",
"this",
"threadlocal",
"version",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/channelfw/objectpool/LocalThreadObjectPool.java#L287-L319 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/AbstractCDIRuntime.java | AbstractCDIRuntime.skipCreatingBda | @Override
public final boolean skipCreatingBda(CDIArchive archive) {
//only skip this if it is a leaf archive
boolean skip = isImplicitBeanArchivesScanningDisabled(archive);
skip = skip && (archive.getBeansXml() == null);
skip = skip && (!(archive.getType() == ArchiveType.WEB_MODULE));
return skip;
} | java | @Override
public final boolean skipCreatingBda(CDIArchive archive) {
//only skip this if it is a leaf archive
boolean skip = isImplicitBeanArchivesScanningDisabled(archive);
skip = skip && (archive.getBeansXml() == null);
skip = skip && (!(archive.getType() == ArchiveType.WEB_MODULE));
return skip;
} | [
"@",
"Override",
"public",
"final",
"boolean",
"skipCreatingBda",
"(",
"CDIArchive",
"archive",
")",
"{",
"//only skip this if it is a leaf archive",
"boolean",
"skip",
"=",
"isImplicitBeanArchivesScanningDisabled",
"(",
"archive",
")",
";",
"skip",
"=",
"skip",
"&&",
"(",
"archive",
".",
"getBeansXml",
"(",
")",
"==",
"null",
")",
";",
"skip",
"=",
"skip",
"&&",
"(",
"!",
"(",
"archive",
".",
"getType",
"(",
")",
"==",
"ArchiveType",
".",
"WEB_MODULE",
")",
")",
";",
"return",
"skip",
";",
"}"
] | Determine whether this jar is completely ignored by CDI, so no need to create bda for it. The jar will be ignored if it does not contain beans.xml and
in the server.xml, implicit bean archive scanning is disabled.
@param moduleContainer the module container
@param type the module type
@return whether the jar will be ignored by CDI | [
"Determine",
"whether",
"this",
"jar",
"is",
"completely",
"ignored",
"by",
"CDI",
"so",
"no",
"need",
"to",
"create",
"bda",
"for",
"it",
".",
"The",
"jar",
"will",
"be",
"ignored",
"if",
"it",
"does",
"not",
"contain",
"beans",
".",
"xml",
"and",
"in",
"the",
"server",
".",
"xml",
"implicit",
"bean",
"archive",
"scanning",
"is",
"disabled",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/AbstractCDIRuntime.java#L101-L108 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultReaper.java | RemoteAsyncResultReaper.finalReap | public synchronized void finalReap() {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "finalReap : Remote Async Results = " + ivAllRemoteAsyncResults.size());
// Re-write the finalReap to use the LinkedHashSet, iterating thru the list removing
// all the entries no matter if they have timed out or not. Cancel alarm if set. d623593
if (ivFuture != null) {
ivIsCanceled = true;
ivFuture.cancel(false);
ivFuture = null;
}
for (Iterator<RemoteAsyncResultImpl> iterator = ivAllRemoteAsyncResults.iterator(); iterator.hasNext();) {
RemoteAsyncResultImpl asyncResult = iterator.next();
releaseResources(asyncResult); // d690014.3
iterator.remove();
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "finalReap : Remote Async Results = " + ivAllRemoteAsyncResults.size());
} | java | public synchronized void finalReap() {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "finalReap : Remote Async Results = " + ivAllRemoteAsyncResults.size());
// Re-write the finalReap to use the LinkedHashSet, iterating thru the list removing
// all the entries no matter if they have timed out or not. Cancel alarm if set. d623593
if (ivFuture != null) {
ivIsCanceled = true;
ivFuture.cancel(false);
ivFuture = null;
}
for (Iterator<RemoteAsyncResultImpl> iterator = ivAllRemoteAsyncResults.iterator(); iterator.hasNext();) {
RemoteAsyncResultImpl asyncResult = iterator.next();
releaseResources(asyncResult); // d690014.3
iterator.remove();
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "finalReap : Remote Async Results = " + ivAllRemoteAsyncResults.size());
} | [
"public",
"synchronized",
"void",
"finalReap",
"(",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"finalReap : Remote Async Results = \"",
"+",
"ivAllRemoteAsyncResults",
".",
"size",
"(",
")",
")",
";",
"// Re-write the finalReap to use the LinkedHashSet, iterating thru the list removing",
"// all the entries no matter if they have timed out or not. Cancel alarm if set. d623593",
"if",
"(",
"ivFuture",
"!=",
"null",
")",
"{",
"ivIsCanceled",
"=",
"true",
";",
"ivFuture",
".",
"cancel",
"(",
"false",
")",
";",
"ivFuture",
"=",
"null",
";",
"}",
"for",
"(",
"Iterator",
"<",
"RemoteAsyncResultImpl",
">",
"iterator",
"=",
"ivAllRemoteAsyncResults",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"RemoteAsyncResultImpl",
"asyncResult",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"releaseResources",
"(",
"asyncResult",
")",
";",
"// d690014.3",
"iterator",
".",
"remove",
"(",
")",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"finalReap : Remote Async Results = \"",
"+",
"ivAllRemoteAsyncResults",
".",
"size",
"(",
")",
")",
";",
"}"
] | This method is invoked just before container termination to clean
up server-side Future objects. | [
"This",
"method",
"is",
"invoked",
"just",
"before",
"container",
"termination",
"to",
"clean",
"up",
"server",
"-",
"side",
"Future",
"objects",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultReaper.java#L219-L241 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultReaper.java | RemoteAsyncResultReaper.add | public synchronized void add(RemoteAsyncResultImpl asyncResult) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
ivAllRemoteAsyncResults.add(asyncResult);
if (asyncResult.ivPmiBean != null) { // d690014.3
asyncResult.ivPmiBean.asyncFutureObjectIncrement();
}
int size = ivAllRemoteAsyncResults.size();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "add " + asyncResult + "; size=" + size);
// If this is the only entry in the list, setup the alarm. d623593
if (size == 1) {
ivFuture = ivScheduledExecutor.schedule(this, ivAlarmIntervalMillis, TimeUnit.MILLISECONDS);
} else if (size >= ivNearMaxResultsThreshold) {
// d690014.1 - Remove the oldest entry if we have exceeded the maximum
// number of results. Otherwise, issue a warning since we are near
// the maximum.
boolean warn = false;
if (size > ivMaxUnclaimedResults) {
if (!ivWarnedExceededMax) {
warn = ivWarnedExceededMax = true;
}
Iterator<RemoteAsyncResultImpl> iterator = ivAllRemoteAsyncResults.iterator();
RemoteAsyncResultImpl oldest = iterator.next();
releaseResources(oldest); // d690014.3
iterator.remove();
} else {
if (!ivWarnedNearMax) {
warn = ivWarnedNearMax = true;
}
}
if (warn) {
Tr.warning(tc, "MAXIMUM_UNCLAIMED_ASYNC_RESULTS_CNTR0328W",
size, ivMaxUnclaimedResults);
}
}
} | java | public synchronized void add(RemoteAsyncResultImpl asyncResult) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
ivAllRemoteAsyncResults.add(asyncResult);
if (asyncResult.ivPmiBean != null) { // d690014.3
asyncResult.ivPmiBean.asyncFutureObjectIncrement();
}
int size = ivAllRemoteAsyncResults.size();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "add " + asyncResult + "; size=" + size);
// If this is the only entry in the list, setup the alarm. d623593
if (size == 1) {
ivFuture = ivScheduledExecutor.schedule(this, ivAlarmIntervalMillis, TimeUnit.MILLISECONDS);
} else if (size >= ivNearMaxResultsThreshold) {
// d690014.1 - Remove the oldest entry if we have exceeded the maximum
// number of results. Otherwise, issue a warning since we are near
// the maximum.
boolean warn = false;
if (size > ivMaxUnclaimedResults) {
if (!ivWarnedExceededMax) {
warn = ivWarnedExceededMax = true;
}
Iterator<RemoteAsyncResultImpl> iterator = ivAllRemoteAsyncResults.iterator();
RemoteAsyncResultImpl oldest = iterator.next();
releaseResources(oldest); // d690014.3
iterator.remove();
} else {
if (!ivWarnedNearMax) {
warn = ivWarnedNearMax = true;
}
}
if (warn) {
Tr.warning(tc, "MAXIMUM_UNCLAIMED_ASYNC_RESULTS_CNTR0328W",
size, ivMaxUnclaimedResults);
}
}
} | [
"public",
"synchronized",
"void",
"add",
"(",
"RemoteAsyncResultImpl",
"asyncResult",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"ivAllRemoteAsyncResults",
".",
"add",
"(",
"asyncResult",
")",
";",
"if",
"(",
"asyncResult",
".",
"ivPmiBean",
"!=",
"null",
")",
"{",
"// d690014.3",
"asyncResult",
".",
"ivPmiBean",
".",
"asyncFutureObjectIncrement",
"(",
")",
";",
"}",
"int",
"size",
"=",
"ivAllRemoteAsyncResults",
".",
"size",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"add \"",
"+",
"asyncResult",
"+",
"\"; size=\"",
"+",
"size",
")",
";",
"// If this is the only entry in the list, setup the alarm. d623593",
"if",
"(",
"size",
"==",
"1",
")",
"{",
"ivFuture",
"=",
"ivScheduledExecutor",
".",
"schedule",
"(",
"this",
",",
"ivAlarmIntervalMillis",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}",
"else",
"if",
"(",
"size",
">=",
"ivNearMaxResultsThreshold",
")",
"{",
"// d690014.1 - Remove the oldest entry if we have exceeded the maximum",
"// number of results. Otherwise, issue a warning since we are near",
"// the maximum.",
"boolean",
"warn",
"=",
"false",
";",
"if",
"(",
"size",
">",
"ivMaxUnclaimedResults",
")",
"{",
"if",
"(",
"!",
"ivWarnedExceededMax",
")",
"{",
"warn",
"=",
"ivWarnedExceededMax",
"=",
"true",
";",
"}",
"Iterator",
"<",
"RemoteAsyncResultImpl",
">",
"iterator",
"=",
"ivAllRemoteAsyncResults",
".",
"iterator",
"(",
")",
";",
"RemoteAsyncResultImpl",
"oldest",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"releaseResources",
"(",
"oldest",
")",
";",
"// d690014.3",
"iterator",
".",
"remove",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"ivWarnedNearMax",
")",
"{",
"warn",
"=",
"ivWarnedNearMax",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"warn",
")",
"{",
"Tr",
".",
"warning",
"(",
"tc",
",",
"\"MAXIMUM_UNCLAIMED_ASYNC_RESULTS_CNTR0328W\"",
",",
"size",
",",
"ivMaxUnclaimedResults",
")",
";",
"}",
"}",
"}"
] | Add a new server-side Future object to the list to be checked for timeouts | [
"Add",
"a",
"new",
"server",
"-",
"side",
"Future",
"object",
"to",
"the",
"list",
"to",
"be",
"checked",
"for",
"timeouts"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultReaper.java#L246-L287 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultReaper.java | RemoteAsyncResultReaper.remove | public synchronized void remove(RemoteAsyncResultImpl asyncResult) {
ivAllRemoteAsyncResults.remove(asyncResult);
releaseResources(asyncResult); // d690014.3
// If no server-side Future objects and an alarm is set then cancel the alarm. d623593
if (ivAllRemoteAsyncResults.isEmpty() && ivFuture != null) {
ivFuture.cancel(false);
ivFuture = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "remove " + asyncResult + "; size=" + ivAllRemoteAsyncResults.size());
} | java | public synchronized void remove(RemoteAsyncResultImpl asyncResult) {
ivAllRemoteAsyncResults.remove(asyncResult);
releaseResources(asyncResult); // d690014.3
// If no server-side Future objects and an alarm is set then cancel the alarm. d623593
if (ivAllRemoteAsyncResults.isEmpty() && ivFuture != null) {
ivFuture.cancel(false);
ivFuture = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "remove " + asyncResult + "; size=" + ivAllRemoteAsyncResults.size());
} | [
"public",
"synchronized",
"void",
"remove",
"(",
"RemoteAsyncResultImpl",
"asyncResult",
")",
"{",
"ivAllRemoteAsyncResults",
".",
"remove",
"(",
"asyncResult",
")",
";",
"releaseResources",
"(",
"asyncResult",
")",
";",
"// d690014.3",
"// If no server-side Future objects and an alarm is set then cancel the alarm. d623593",
"if",
"(",
"ivAllRemoteAsyncResults",
".",
"isEmpty",
"(",
")",
"&&",
"ivFuture",
"!=",
"null",
")",
"{",
"ivFuture",
".",
"cancel",
"(",
"false",
")",
";",
"ivFuture",
"=",
"null",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"remove \"",
"+",
"asyncResult",
"+",
"\"; size=\"",
"+",
"ivAllRemoteAsyncResults",
".",
"size",
"(",
")",
")",
";",
"}"
] | Remove a server-side Future object from the reaper and release its
resources. | [
"Remove",
"a",
"server",
"-",
"side",
"Future",
"object",
"from",
"the",
"reaper",
"and",
"release",
"its",
"resources",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultReaper.java#L293-L305 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/collector/BurstDateFormat.java | BurstDateFormat.format | public String format(long timestamp) {
// If the format is unknown, use the default formatter.
if (invalidFormat) {
return formatter.format(timestamp);
}
try {
long delta = timestamp - refTimestamp;
// If we need to reformat
if (delta >= pdiff || delta < ndiff) {
StringBuffer refTime = new StringBuffer();
refTimestamp = timestamp;
formatter.format(timestamp, refTime, position);
refMilli = Long.parseLong(refTime.substring(position.getBeginIndex(), position.getEndIndex()));
refBeginning = refTime.substring(0, position.getBeginIndex());
refEnding = refTime.substring(position.getEndIndex());
pdiff = 1000 - refMilli;
ndiff = -refMilli;
return refTime.toString();
} else {
StringBuffer sb = new StringBuffer();
long newMilli = delta + refMilli;
if (newMilli >= 100)
sb.append(refBeginning).append(newMilli).append(refEnding);
else if (newMilli >= 10)
sb.append(refBeginning).append('0').append(newMilli).append(refEnding);
else
sb.append(refBeginning).append("00").append(newMilli).append(refEnding);
return sb.toString();
}
} catch (Exception e) {
// Throw FFDC in case anything goes wrong
// Still generate the date via the SimpleDateFormat
invalidFormat = true;
return formatter.format(timestamp);
}
} | java | public String format(long timestamp) {
// If the format is unknown, use the default formatter.
if (invalidFormat) {
return formatter.format(timestamp);
}
try {
long delta = timestamp - refTimestamp;
// If we need to reformat
if (delta >= pdiff || delta < ndiff) {
StringBuffer refTime = new StringBuffer();
refTimestamp = timestamp;
formatter.format(timestamp, refTime, position);
refMilli = Long.parseLong(refTime.substring(position.getBeginIndex(), position.getEndIndex()));
refBeginning = refTime.substring(0, position.getBeginIndex());
refEnding = refTime.substring(position.getEndIndex());
pdiff = 1000 - refMilli;
ndiff = -refMilli;
return refTime.toString();
} else {
StringBuffer sb = new StringBuffer();
long newMilli = delta + refMilli;
if (newMilli >= 100)
sb.append(refBeginning).append(newMilli).append(refEnding);
else if (newMilli >= 10)
sb.append(refBeginning).append('0').append(newMilli).append(refEnding);
else
sb.append(refBeginning).append("00").append(newMilli).append(refEnding);
return sb.toString();
}
} catch (Exception e) {
// Throw FFDC in case anything goes wrong
// Still generate the date via the SimpleDateFormat
invalidFormat = true;
return formatter.format(timestamp);
}
} | [
"public",
"String",
"format",
"(",
"long",
"timestamp",
")",
"{",
"// If the format is unknown, use the default formatter.",
"if",
"(",
"invalidFormat",
")",
"{",
"return",
"formatter",
".",
"format",
"(",
"timestamp",
")",
";",
"}",
"try",
"{",
"long",
"delta",
"=",
"timestamp",
"-",
"refTimestamp",
";",
"// If we need to reformat",
"if",
"(",
"delta",
">=",
"pdiff",
"||",
"delta",
"<",
"ndiff",
")",
"{",
"StringBuffer",
"refTime",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"refTimestamp",
"=",
"timestamp",
";",
"formatter",
".",
"format",
"(",
"timestamp",
",",
"refTime",
",",
"position",
")",
";",
"refMilli",
"=",
"Long",
".",
"parseLong",
"(",
"refTime",
".",
"substring",
"(",
"position",
".",
"getBeginIndex",
"(",
")",
",",
"position",
".",
"getEndIndex",
"(",
")",
")",
")",
";",
"refBeginning",
"=",
"refTime",
".",
"substring",
"(",
"0",
",",
"position",
".",
"getBeginIndex",
"(",
")",
")",
";",
"refEnding",
"=",
"refTime",
".",
"substring",
"(",
"position",
".",
"getEndIndex",
"(",
")",
")",
";",
"pdiff",
"=",
"1000",
"-",
"refMilli",
";",
"ndiff",
"=",
"-",
"refMilli",
";",
"return",
"refTime",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"long",
"newMilli",
"=",
"delta",
"+",
"refMilli",
";",
"if",
"(",
"newMilli",
">=",
"100",
")",
"sb",
".",
"append",
"(",
"refBeginning",
")",
".",
"append",
"(",
"newMilli",
")",
".",
"append",
"(",
"refEnding",
")",
";",
"else",
"if",
"(",
"newMilli",
">=",
"10",
")",
"sb",
".",
"append",
"(",
"refBeginning",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"newMilli",
")",
".",
"append",
"(",
"refEnding",
")",
";",
"else",
"sb",
".",
"append",
"(",
"refBeginning",
")",
".",
"append",
"(",
"\"00\"",
")",
".",
"append",
"(",
"newMilli",
")",
".",
"append",
"(",
"refEnding",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// Throw FFDC in case anything goes wrong",
"// Still generate the date via the SimpleDateFormat",
"invalidFormat",
"=",
"true",
";",
"return",
"formatter",
".",
"format",
"(",
"timestamp",
")",
";",
"}",
"}"
] | Formats a timestamp
@param timestamp
@return | [
"Formats",
"a",
"timestamp"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/collector/BurstDateFormat.java#L116-L158 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/PtoPLocalMsgsItemStream.java | PtoPLocalMsgsItemStream.setName | private void setName(String newName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setName", newName);
this._name = newName;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setName");
} | java | private void setName(String newName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setName", newName);
this._name = newName;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setName");
} | [
"private",
"void",
"setName",
"(",
"String",
"newName",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setName\"",
",",
"newName",
")",
";",
"this",
".",
"_name",
"=",
"newName",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setName\"",
")",
";",
"}"
] | Sets the name currently in use by this localization.
@param newIdentifier | [
"Sets",
"the",
"name",
"currently",
"in",
"use",
"by",
"this",
"localization",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/PtoPLocalMsgsItemStream.java#L786-L795 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/PtoPLocalMsgsItemStream.java | PtoPLocalMsgsItemStream.isSendAllowed | @Override
public boolean isSendAllowed()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isSendAllowed");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isSendAllowed", new Boolean(_isSendAllowed));
return _isSendAllowed;
} | java | @Override
public boolean isSendAllowed()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isSendAllowed");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isSendAllowed", new Boolean(_isSendAllowed));
return _isSendAllowed;
} | [
"@",
"Override",
"public",
"boolean",
"isSendAllowed",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"isSendAllowed\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"isSendAllowed\"",
",",
"new",
"Boolean",
"(",
"_isSendAllowed",
")",
")",
";",
"return",
"_isSendAllowed",
";",
"}"
] | Gets the current value of SendAllowed used by this localization.
@return | [
"Gets",
"the",
"current",
"value",
"of",
"SendAllowed",
"used",
"by",
"this",
"localization",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/PtoPLocalMsgsItemStream.java#L853-L863 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/PtoPLocalMsgsItemStream.java | PtoPLocalMsgsItemStream.setSendAllowed | public void setSendAllowed(boolean newIsSendAllowedValue)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setSendAllowed", new Boolean(newIsSendAllowedValue));
this._isSendAllowed = newIsSendAllowedValue;
updatePutRegistration(_isSendAllowed);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setSendAllowed");
} | java | public void setSendAllowed(boolean newIsSendAllowedValue)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setSendAllowed", new Boolean(newIsSendAllowedValue));
this._isSendAllowed = newIsSendAllowedValue;
updatePutRegistration(_isSendAllowed);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setSendAllowed");
} | [
"public",
"void",
"setSendAllowed",
"(",
"boolean",
"newIsSendAllowedValue",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setSendAllowed\"",
",",
"new",
"Boolean",
"(",
"newIsSendAllowedValue",
")",
")",
";",
"this",
".",
"_isSendAllowed",
"=",
"newIsSendAllowedValue",
";",
"updatePutRegistration",
"(",
"_isSendAllowed",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setSendAllowed\"",
")",
";",
"}"
] | Sets the current value of SendAllowed used by this localization.
@param newIsSendAllowedValue | [
"Sets",
"the",
"current",
"value",
"of",
"SendAllowed",
"used",
"by",
"this",
"localization",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/PtoPLocalMsgsItemStream.java#L870-L880 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/PtoPLocalMsgsItemStream.java | PtoPLocalMsgsItemStream.setAlterationTime | public void setAlterationTime(long newAlterationTime)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setAlterationTime", new Long(newAlterationTime));
this._alterationTime = newAlterationTime;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setAlterationTime");
} | java | public void setAlterationTime(long newAlterationTime)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setAlterationTime", new Long(newAlterationTime));
this._alterationTime = newAlterationTime;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setAlterationTime");
} | [
"public",
"void",
"setAlterationTime",
"(",
"long",
"newAlterationTime",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setAlterationTime\"",
",",
"new",
"Long",
"(",
"newAlterationTime",
")",
")",
";",
"this",
".",
"_alterationTime",
"=",
"newAlterationTime",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setAlterationTime\"",
")",
";",
"}"
] | Sets the current alteration time fro this localization.
@param newAlterationTime | [
"Sets",
"the",
"current",
"alteration",
"time",
"fro",
"this",
"localization",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/PtoPLocalMsgsItemStream.java#L904-L913 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/StaticCATSubscription.java | StaticCATSubscription.rcvDeleteDurableSub | public static void rcvDeleteDurableSub(CommsByteBuffer request, Conversation conversation,
int requestNumber, boolean allocatedFromBufferPool,
boolean partOfExchange)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvDeleteDurableSub",
new Object[]
{
request,
conversation,
""+requestNumber,
""+allocatedFromBufferPool
});
ConversationState convState = (ConversationState) conversation.getAttachment();
short connectionObjectID = request.getShort(); // BIT16 ConnectionObjectId
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "ConnectionObjectId:", connectionObjectID);
/**************************************************************/
/* Subscription Name */
/**************************************************************/
String subscriptionName = request.getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Subscription Name:", subscriptionName);
/**************************************************************/
/* Subscription Home */
/**************************************************************/
String subscriptionHome = request.getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Subscription Home:", subscriptionHome);
SICoreConnection connection =
((CATConnection) convState.getObject(connectionObjectID)).getSICoreConnection();
try
{
connection.deleteDurableSubscription(subscriptionName, subscriptionHome);
try
{
conversation.send(poolManager.allocate(),
JFapChannelConstants.SEG_DELETE_DURABLE_SUB_R,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
}
catch (SIException e)
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvDeleteDurableSub",
CommsConstants.STATICCATSUBSCRIPTION_DELETE_01);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2025", e);
}
}
catch (SINotAuthorizedException e)
{
// No FFDC Code Needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
null,
conversation, requestNumber);
}
catch (SIException e)
{
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event.
if(!convState.hasMETerminated())
{
com.ibm.ws.ffdc.FFDCFilter.processException(e,
CLASS_NAME + ".rcvDeleteDurableSub",
CommsConstants.STATICCATSUBSCRIPTION_DELETE_02);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.STATICCATSUBSCRIPTION_DELETE_02,
conversation, requestNumber);
}
request.release(allocatedFromBufferPool);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvDeleteDurableSub");
} | java | public static void rcvDeleteDurableSub(CommsByteBuffer request, Conversation conversation,
int requestNumber, boolean allocatedFromBufferPool,
boolean partOfExchange)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvDeleteDurableSub",
new Object[]
{
request,
conversation,
""+requestNumber,
""+allocatedFromBufferPool
});
ConversationState convState = (ConversationState) conversation.getAttachment();
short connectionObjectID = request.getShort(); // BIT16 ConnectionObjectId
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "ConnectionObjectId:", connectionObjectID);
/**************************************************************/
/* Subscription Name */
/**************************************************************/
String subscriptionName = request.getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Subscription Name:", subscriptionName);
/**************************************************************/
/* Subscription Home */
/**************************************************************/
String subscriptionHome = request.getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Subscription Home:", subscriptionHome);
SICoreConnection connection =
((CATConnection) convState.getObject(connectionObjectID)).getSICoreConnection();
try
{
connection.deleteDurableSubscription(subscriptionName, subscriptionHome);
try
{
conversation.send(poolManager.allocate(),
JFapChannelConstants.SEG_DELETE_DURABLE_SUB_R,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
}
catch (SIException e)
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvDeleteDurableSub",
CommsConstants.STATICCATSUBSCRIPTION_DELETE_01);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2025", e);
}
}
catch (SINotAuthorizedException e)
{
// No FFDC Code Needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
null,
conversation, requestNumber);
}
catch (SIException e)
{
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event.
if(!convState.hasMETerminated())
{
com.ibm.ws.ffdc.FFDCFilter.processException(e,
CLASS_NAME + ".rcvDeleteDurableSub",
CommsConstants.STATICCATSUBSCRIPTION_DELETE_02);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.STATICCATSUBSCRIPTION_DELETE_02,
conversation, requestNumber);
}
request.release(allocatedFromBufferPool);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvDeleteDurableSub");
} | [
"public",
"static",
"void",
"rcvDeleteDurableSub",
"(",
"CommsByteBuffer",
"request",
",",
"Conversation",
"conversation",
",",
"int",
"requestNumber",
",",
"boolean",
"allocatedFromBufferPool",
",",
"boolean",
"partOfExchange",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"rcvDeleteDurableSub\"",
",",
"new",
"Object",
"[",
"]",
"{",
"request",
",",
"conversation",
",",
"\"\"",
"+",
"requestNumber",
",",
"\"\"",
"+",
"allocatedFromBufferPool",
"}",
")",
";",
"ConversationState",
"convState",
"=",
"(",
"ConversationState",
")",
"conversation",
".",
"getAttachment",
"(",
")",
";",
"short",
"connectionObjectID",
"=",
"request",
".",
"getShort",
"(",
")",
";",
"// BIT16 ConnectionObjectId",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"ConnectionObjectId:\"",
",",
"connectionObjectID",
")",
";",
"/**************************************************************/",
"/* Subscription Name */",
"/**************************************************************/",
"String",
"subscriptionName",
"=",
"request",
".",
"getString",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Subscription Name:\"",
",",
"subscriptionName",
")",
";",
"/**************************************************************/",
"/* Subscription Home */",
"/**************************************************************/",
"String",
"subscriptionHome",
"=",
"request",
".",
"getString",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Subscription Home:\"",
",",
"subscriptionHome",
")",
";",
"SICoreConnection",
"connection",
"=",
"(",
"(",
"CATConnection",
")",
"convState",
".",
"getObject",
"(",
"connectionObjectID",
")",
")",
".",
"getSICoreConnection",
"(",
")",
";",
"try",
"{",
"connection",
".",
"deleteDurableSubscription",
"(",
"subscriptionName",
",",
"subscriptionHome",
")",
";",
"try",
"{",
"conversation",
".",
"send",
"(",
"poolManager",
".",
"allocate",
"(",
")",
",",
"JFapChannelConstants",
".",
"SEG_DELETE_DURABLE_SUB_R",
",",
"requestNumber",
",",
"JFapChannelConstants",
".",
"PRIORITY_MEDIUM",
",",
"true",
",",
"ThrottlingPolicy",
".",
"BLOCK_THREAD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".rcvDeleteDurableSub\"",
",",
"CommsConstants",
".",
"STATICCATSUBSCRIPTION_DELETE_01",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"COMMUNICATION_ERROR_SICO2025\"",
",",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"SINotAuthorizedException",
"e",
")",
"{",
"// No FFDC Code Needed",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"StaticCATHelper",
".",
"sendExceptionToClient",
"(",
"e",
",",
"null",
",",
"conversation",
",",
"requestNumber",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"//No FFDC code needed",
"//Only FFDC if we haven't received a meTerminated event.",
"if",
"(",
"!",
"convState",
".",
"hasMETerminated",
"(",
")",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"ffdc",
".",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".rcvDeleteDurableSub\"",
",",
"CommsConstants",
".",
"STATICCATSUBSCRIPTION_DELETE_02",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"StaticCATHelper",
".",
"sendExceptionToClient",
"(",
"e",
",",
"CommsConstants",
".",
"STATICCATSUBSCRIPTION_DELETE_02",
",",
"conversation",
",",
"requestNumber",
")",
";",
"}",
"request",
".",
"release",
"(",
"allocatedFromBufferPool",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"rcvDeleteDurableSub\"",
")",
";",
"}"
] | Deletes a durable subscription
BIT16 ConnectionObjectID
BIT16 SubscriptionNameLength
BYTE[] SubscriptionName
BIT16 SubscriptionHomeLength
BYTE[] SubscriptionHome
@param request
@param conversation
@param requestNumber
@param allocatedFromBufferPool
@param partOfExchange | [
"Deletes",
"a",
"durable",
"subscription"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/StaticCATSubscription.java#L517-L608 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config.schemagen/src/com/ibm/ws/config/schemagen/internal/Generator.java | Generator.main | public static void main(String[] args) {
Generator schemaGen = new Generator();
System.exit(schemaGen.createSchema(args));
} | java | public static void main(String[] args) {
Generator schemaGen = new Generator();
System.exit(schemaGen.createSchema(args));
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"Generator",
"schemaGen",
"=",
"new",
"Generator",
"(",
")",
";",
"System",
".",
"exit",
"(",
"schemaGen",
".",
"createSchema",
"(",
"args",
")",
")",
";",
"}"
] | The runtime main. String arguments are treated and parsed as
command line parameters.
@param args
Command line arguments. | [
"The",
"runtime",
"main",
".",
"String",
"arguments",
"are",
"treated",
"and",
"parsed",
"as",
"command",
"line",
"parameters",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config.schemagen/src/com/ibm/ws/config/schemagen/internal/Generator.java#L82-L85 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config.schemagen/src/com/ibm/ws/config/schemagen/internal/Generator.java | Generator.generate | private void generate(List<MetaTypeInformationSpecification> metatype) {
XMLOutputFactory factory = XMLOutputFactory.newInstance();
try {
PrintWriter writer = new PrintWriter(generatorOptions.getOutputFile(), generatorOptions.getEncoding());
XMLStreamWriter xmlWriter = null;
if (generatorOptions.getCompactOutput()) {
xmlWriter = new CompactOutputXMLStreamWriter(factory.createXMLStreamWriter(writer));
} else {
xmlWriter = new IndentingXMLStreamWriter(factory.createXMLStreamWriter(writer), writer);
}
SchemaWriter schemaWriter = new SchemaWriter(xmlWriter);
schemaWriter.setIgnoredPids(generatorOptions.getIgnoredPids());
schemaWriter.setGenerateDocumentation(true);
schemaWriter.setEncoding(generatorOptions.getEncoding());
schemaWriter.setLocale(generatorOptions.getLocale());
schemaWriter.setSchemaVersion(generatorOptions.getSchemaVersion());
schemaWriter.setOutputVersion(generatorOptions.getOutputVersion());
for (MetaTypeInformationSpecification item : metatype) {
schemaWriter.add(item);
}
schemaWriter.generate(true);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | private void generate(List<MetaTypeInformationSpecification> metatype) {
XMLOutputFactory factory = XMLOutputFactory.newInstance();
try {
PrintWriter writer = new PrintWriter(generatorOptions.getOutputFile(), generatorOptions.getEncoding());
XMLStreamWriter xmlWriter = null;
if (generatorOptions.getCompactOutput()) {
xmlWriter = new CompactOutputXMLStreamWriter(factory.createXMLStreamWriter(writer));
} else {
xmlWriter = new IndentingXMLStreamWriter(factory.createXMLStreamWriter(writer), writer);
}
SchemaWriter schemaWriter = new SchemaWriter(xmlWriter);
schemaWriter.setIgnoredPids(generatorOptions.getIgnoredPids());
schemaWriter.setGenerateDocumentation(true);
schemaWriter.setEncoding(generatorOptions.getEncoding());
schemaWriter.setLocale(generatorOptions.getLocale());
schemaWriter.setSchemaVersion(generatorOptions.getSchemaVersion());
schemaWriter.setOutputVersion(generatorOptions.getOutputVersion());
for (MetaTypeInformationSpecification item : metatype) {
schemaWriter.add(item);
}
schemaWriter.generate(true);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"private",
"void",
"generate",
"(",
"List",
"<",
"MetaTypeInformationSpecification",
">",
"metatype",
")",
"{",
"XMLOutputFactory",
"factory",
"=",
"XMLOutputFactory",
".",
"newInstance",
"(",
")",
";",
"try",
"{",
"PrintWriter",
"writer",
"=",
"new",
"PrintWriter",
"(",
"generatorOptions",
".",
"getOutputFile",
"(",
")",
",",
"generatorOptions",
".",
"getEncoding",
"(",
")",
")",
";",
"XMLStreamWriter",
"xmlWriter",
"=",
"null",
";",
"if",
"(",
"generatorOptions",
".",
"getCompactOutput",
"(",
")",
")",
"{",
"xmlWriter",
"=",
"new",
"CompactOutputXMLStreamWriter",
"(",
"factory",
".",
"createXMLStreamWriter",
"(",
"writer",
")",
")",
";",
"}",
"else",
"{",
"xmlWriter",
"=",
"new",
"IndentingXMLStreamWriter",
"(",
"factory",
".",
"createXMLStreamWriter",
"(",
"writer",
")",
",",
"writer",
")",
";",
"}",
"SchemaWriter",
"schemaWriter",
"=",
"new",
"SchemaWriter",
"(",
"xmlWriter",
")",
";",
"schemaWriter",
".",
"setIgnoredPids",
"(",
"generatorOptions",
".",
"getIgnoredPids",
"(",
")",
")",
";",
"schemaWriter",
".",
"setGenerateDocumentation",
"(",
"true",
")",
";",
"schemaWriter",
".",
"setEncoding",
"(",
"generatorOptions",
".",
"getEncoding",
"(",
")",
")",
";",
"schemaWriter",
".",
"setLocale",
"(",
"generatorOptions",
".",
"getLocale",
"(",
")",
")",
";",
"schemaWriter",
".",
"setSchemaVersion",
"(",
"generatorOptions",
".",
"getSchemaVersion",
"(",
")",
")",
";",
"schemaWriter",
".",
"setOutputVersion",
"(",
"generatorOptions",
".",
"getOutputVersion",
"(",
")",
")",
";",
"for",
"(",
"MetaTypeInformationSpecification",
"item",
":",
"metatype",
")",
"{",
"schemaWriter",
".",
"add",
"(",
"item",
")",
";",
"}",
"schemaWriter",
".",
"generate",
"(",
"true",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] | Pass the constructed metatypinformation to SchemaWriter for the actual generation
@param metatype
@param outputFile | [
"Pass",
"the",
"constructed",
"metatypinformation",
"to",
"SchemaWriter",
"for",
"the",
"actual",
"generation"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config.schemagen/src/com/ibm/ws/config/schemagen/internal/Generator.java#L175-L202 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java | JsMsgPart.setField | void setField(int accessor, Object value) {
try {
jmfPart.setValue(accessor, value);
} catch (JMFException e) {
FFDCFilter.processException(e, "setField", "87", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "setField failed: " + e);
}
} | java | void setField(int accessor, Object value) {
try {
jmfPart.setValue(accessor, value);
} catch (JMFException e) {
FFDCFilter.processException(e, "setField", "87", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "setField failed: " + e);
}
} | [
"void",
"setField",
"(",
"int",
"accessor",
",",
"Object",
"value",
")",
"{",
"try",
"{",
"jmfPart",
".",
"setValue",
"(",
"accessor",
",",
"value",
")",
";",
"}",
"catch",
"(",
"JMFException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"setField\"",
",",
"\"87\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"setField failed: \"",
"+",
"e",
")",
";",
"}",
"}"
] | General field access | [
"General",
"field",
"access"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java#L64-L71 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java | JsMsgPart.setIntField | void setIntField(int accessor, int value) {
try {
jmfPart.setInt(accessor, value);
} catch (JMFException e) {
FFDCFilter.processException(e, "setIntField", "109", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "setIntField failed: " + e);
}
} | java | void setIntField(int accessor, int value) {
try {
jmfPart.setInt(accessor, value);
} catch (JMFException e) {
FFDCFilter.processException(e, "setIntField", "109", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "setIntField failed: " + e);
}
} | [
"void",
"setIntField",
"(",
"int",
"accessor",
",",
"int",
"value",
")",
"{",
"try",
"{",
"jmfPart",
".",
"setInt",
"(",
"accessor",
",",
"value",
")",
";",
"}",
"catch",
"(",
"JMFException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"setIntField\"",
",",
"\"109\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"setIntField failed: \"",
"+",
"e",
")",
";",
"}",
"}"
] | Convenience access to primitive type fields | [
"Convenience",
"access",
"to",
"primitive",
"type",
"fields"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java#L86-L93 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java | JsMsgPart.setChoiceField | void setChoiceField(int accessor, int variant) {
try {
jmfPart.setInt(accessor, variant);
} catch (JMFException e) {
FFDCFilter.processException(e, "setChoiceField", "173", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "setChoiceField failed: " + e);
}
} | java | void setChoiceField(int accessor, int variant) {
try {
jmfPart.setInt(accessor, variant);
} catch (JMFException e) {
FFDCFilter.processException(e, "setChoiceField", "173", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "setChoiceField failed: " + e);
}
} | [
"void",
"setChoiceField",
"(",
"int",
"accessor",
",",
"int",
"variant",
")",
"{",
"try",
"{",
"jmfPart",
".",
"setInt",
"(",
"accessor",
",",
"variant",
")",
";",
"}",
"catch",
"(",
"JMFException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"setChoiceField\"",
",",
"\"173\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"setChoiceField failed: \"",
"+",
"e",
")",
";",
"}",
"}"
] | Set a choice field to a specific variant | [
"Set",
"a",
"choice",
"field",
"to",
"a",
"specific",
"variant"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java#L150-L157 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java | JsMsgPart.getChoiceField | int getChoiceField(int accessor) {
int result = 0;
try {
if (jmfPart.isPresent(accessor))
result = jmfPart.getInt(accessor);
} catch (JMFException e) {
FFDCFilter.processException(e, "getChoiceField", "185", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "getChoiceField failed: " + e);
}
return result;
} | java | int getChoiceField(int accessor) {
int result = 0;
try {
if (jmfPart.isPresent(accessor))
result = jmfPart.getInt(accessor);
} catch (JMFException e) {
FFDCFilter.processException(e, "getChoiceField", "185", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "getChoiceField failed: " + e);
}
return result;
} | [
"int",
"getChoiceField",
"(",
"int",
"accessor",
")",
"{",
"int",
"result",
"=",
"0",
";",
"try",
"{",
"if",
"(",
"jmfPart",
".",
"isPresent",
"(",
"accessor",
")",
")",
"result",
"=",
"jmfPart",
".",
"getInt",
"(",
"accessor",
")",
";",
"}",
"catch",
"(",
"JMFException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"getChoiceField\"",
",",
"\"185\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"getChoiceField failed: \"",
"+",
"e",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Get a choice field which determines which variant is set | [
"Get",
"a",
"choice",
"field",
"which",
"determines",
"which",
"variant",
"is",
"set"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java#L160-L170 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java | JsMsgPart.setPart | void setPart(int accessor, JMFSchema schema) {
try {
jmfPart.setValue(accessor, jmfPart.newNativePart(schema));
} catch (JMFException e) {
FFDCFilter.processException(e, "setDynamicField", "196", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "setDynamicField failed: " + e);
}
} | java | void setPart(int accessor, JMFSchema schema) {
try {
jmfPart.setValue(accessor, jmfPart.newNativePart(schema));
} catch (JMFException e) {
FFDCFilter.processException(e, "setDynamicField", "196", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "setDynamicField failed: " + e);
}
} | [
"void",
"setPart",
"(",
"int",
"accessor",
",",
"JMFSchema",
"schema",
")",
"{",
"try",
"{",
"jmfPart",
".",
"setValue",
"(",
"accessor",
",",
"jmfPart",
".",
"newNativePart",
"(",
"schema",
")",
")",
";",
"}",
"catch",
"(",
"JMFException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"setDynamicField\"",
",",
"\"196\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"setDynamicField failed: \"",
"+",
"e",
")",
";",
"}",
"}"
] | Set a dynamic field to an empty message of appropriate type | [
"Set",
"a",
"dynamic",
"field",
"to",
"an",
"empty",
"message",
"of",
"appropriate",
"type"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java#L173-L180 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java | JsMsgPart.getPart | JsMsgPart getPart(int accessor, JMFSchema schema) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getPart", new Object[]{accessor, schema});
JsMsgPart result = null;
try {
if (jmfPart.isPresent(accessor))
result = new JsMsgPart(jmfPart.getNativePart(accessor, schema));
} catch (JMFException e) {
FFDCFilter.processException(e, "getPart", "208", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "getPart failed: " + e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getPart", result);
return result;
} | java | JsMsgPart getPart(int accessor, JMFSchema schema) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getPart", new Object[]{accessor, schema});
JsMsgPart result = null;
try {
if (jmfPart.isPresent(accessor))
result = new JsMsgPart(jmfPart.getNativePart(accessor, schema));
} catch (JMFException e) {
FFDCFilter.processException(e, "getPart", "208", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "getPart failed: " + e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getPart", result);
return result;
} | [
"JsMsgPart",
"getPart",
"(",
"int",
"accessor",
",",
"JMFSchema",
"schema",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getPart\"",
",",
"new",
"Object",
"[",
"]",
"{",
"accessor",
",",
"schema",
"}",
")",
";",
"JsMsgPart",
"result",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"jmfPart",
".",
"isPresent",
"(",
"accessor",
")",
")",
"result",
"=",
"new",
"JsMsgPart",
"(",
"jmfPart",
".",
"getNativePart",
"(",
"accessor",
",",
"schema",
")",
")",
";",
"}",
"catch",
"(",
"JMFException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"getPart\"",
",",
"\"208\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"getPart failed: \"",
"+",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getPart\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Obtain a nested message part | [
"Obtain",
"a",
"nested",
"message",
"part"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java#L183-L195 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java | JsMsgPart.estimateFieldValueSize | int estimateFieldValueSize(int accessor) {
int size = 0;
try {
if (jmfPart.isPresent(accessor)) {
size = jmfPart.estimateUnassembledValueSize(accessor);
}
}
catch (JMFException e) {
FFDCFilter.processException(e, "estimateFieldValueSize", "221", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "estimateFieldValueSize failed: " + e);
}
return size;
} | java | int estimateFieldValueSize(int accessor) {
int size = 0;
try {
if (jmfPart.isPresent(accessor)) {
size = jmfPart.estimateUnassembledValueSize(accessor);
}
}
catch (JMFException e) {
FFDCFilter.processException(e, "estimateFieldValueSize", "221", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "estimateFieldValueSize failed: " + e);
}
return size;
} | [
"int",
"estimateFieldValueSize",
"(",
"int",
"accessor",
")",
"{",
"int",
"size",
"=",
"0",
";",
"try",
"{",
"if",
"(",
"jmfPart",
".",
"isPresent",
"(",
"accessor",
")",
")",
"{",
"size",
"=",
"jmfPart",
".",
"estimateUnassembledValueSize",
"(",
"accessor",
")",
";",
"}",
"}",
"catch",
"(",
"JMFException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"estimateFieldValueSize\"",
",",
"\"221\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"estimateFieldValueSize failed: \"",
"+",
"e",
")",
";",
"}",
"return",
"size",
";",
"}"
] | Get the estimated size of the fluffed=up value of the field | [
"Get",
"the",
"estimated",
"size",
"of",
"the",
"fluffed",
"=",
"up",
"value",
"of",
"the",
"field"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java#L198-L210 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java | JsMsgPart.isNotEMPTYlist | public boolean isNotEMPTYlist(int accessor) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "isNotEMPTYlist", accessor);
// The answer is true, unless an EMPTY is found.
boolean isNotAnEMPTY = true;
// The field can't be an EMPTY singleton unless the part is a JMFMessageData
// as it is impossible for Encapsulations to hold an EMPTY.
// Note the JMF call is the reverse - i.e. isEMPTY rather than isNot
if (jmfPart instanceof JMFMessage) {
isNotAnEMPTY = !((JMFMessage)jmfPart).isEMPTYlist(accessor);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "isNotEMPTYlist", isNotAnEMPTY);
return isNotAnEMPTY;
} | java | public boolean isNotEMPTYlist(int accessor) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "isNotEMPTYlist", accessor);
// The answer is true, unless an EMPTY is found.
boolean isNotAnEMPTY = true;
// The field can't be an EMPTY singleton unless the part is a JMFMessageData
// as it is impossible for Encapsulations to hold an EMPTY.
// Note the JMF call is the reverse - i.e. isEMPTY rather than isNot
if (jmfPart instanceof JMFMessage) {
isNotAnEMPTY = !((JMFMessage)jmfPart).isEMPTYlist(accessor);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "isNotEMPTYlist", isNotAnEMPTY);
return isNotAnEMPTY;
} | [
"public",
"boolean",
"isNotEMPTYlist",
"(",
"int",
"accessor",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"isNotEMPTYlist\"",
",",
"accessor",
")",
";",
"// The answer is true, unless an EMPTY is found.",
"boolean",
"isNotAnEMPTY",
"=",
"true",
";",
"// The field can't be an EMPTY singleton unless the part is a JMFMessageData",
"// as it is impossible for Encapsulations to hold an EMPTY.",
"// Note the JMF call is the reverse - i.e. isEMPTY rather than isNot",
"if",
"(",
"jmfPart",
"instanceof",
"JMFMessage",
")",
"{",
"isNotAnEMPTY",
"=",
"!",
"(",
"(",
"JMFMessage",
")",
"jmfPart",
")",
".",
"isEMPTYlist",
"(",
"accessor",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"isNotEMPTYlist\"",
",",
"isNotAnEMPTY",
")",
";",
"return",
"isNotAnEMPTY",
";",
"}"
] | isNotEMPTYlist
Return false if the value of the given field is one of the singleton
EMPTY lists, otherwise true.
@param accessor The aceesor value of the field of interest.
@return boolean True if the field is NOT a singleton JMF empty list | [
"isNotEMPTYlist",
"Return",
"false",
"if",
"the",
"value",
"of",
"the",
"given",
"field",
"is",
"one",
"of",
"the",
"singleton",
"EMPTY",
"lists",
"otherwise",
"true",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgPart.java#L243-L257 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java | StateUtils.construct | public static final String construct(Object object, ExternalContext ctx)
{
byte[] bytes = getAsByteArray(object, ctx);
if( enableCompression(ctx) )
{
bytes = compress(bytes);
}
if(isSecure(ctx))
{
bytes = encrypt(bytes, ctx);
}
bytes = encode(bytes);
try
{
return new String(bytes, ZIP_CHARSET);
}
catch (UnsupportedEncodingException e)
{
throw new FacesException(e);
}
} | java | public static final String construct(Object object, ExternalContext ctx)
{
byte[] bytes = getAsByteArray(object, ctx);
if( enableCompression(ctx) )
{
bytes = compress(bytes);
}
if(isSecure(ctx))
{
bytes = encrypt(bytes, ctx);
}
bytes = encode(bytes);
try
{
return new String(bytes, ZIP_CHARSET);
}
catch (UnsupportedEncodingException e)
{
throw new FacesException(e);
}
} | [
"public",
"static",
"final",
"String",
"construct",
"(",
"Object",
"object",
",",
"ExternalContext",
"ctx",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"getAsByteArray",
"(",
"object",
",",
"ctx",
")",
";",
"if",
"(",
"enableCompression",
"(",
"ctx",
")",
")",
"{",
"bytes",
"=",
"compress",
"(",
"bytes",
")",
";",
"}",
"if",
"(",
"isSecure",
"(",
"ctx",
")",
")",
"{",
"bytes",
"=",
"encrypt",
"(",
"bytes",
",",
"ctx",
")",
";",
"}",
"bytes",
"=",
"encode",
"(",
"bytes",
")",
";",
"try",
"{",
"return",
"new",
"String",
"(",
"bytes",
",",
"ZIP_CHARSET",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"FacesException",
"(",
"e",
")",
";",
"}",
"}"
] | This fires during the Render Response phase, saving state. | [
"This",
"fires",
"during",
"the",
"Render",
"Response",
"phase",
"saving",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java#L245-L265 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java | StateUtils.getAsByteArray | public static final byte[] getAsByteArray(Object object, ExternalContext ctx)
{
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
// get the Factory that was instantiated @ startup
SerialFactory serialFactory = (SerialFactory) ctx.getApplicationMap().get(SERIAL_FACTORY);
if(serialFactory == null)
{
throw new NullPointerException("serialFactory");
}
try
{
ObjectOutputStream writer = serialFactory.getObjectOutputStream(outputStream);
writer.writeObject(object);
byte[] bytes = outputStream.toByteArray();
writer.close();
outputStream.close();
writer = null;
outputStream = null;
return bytes;
}
catch (IOException e)
{
throw new FacesException(e);
}
} | java | public static final byte[] getAsByteArray(Object object, ExternalContext ctx)
{
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
// get the Factory that was instantiated @ startup
SerialFactory serialFactory = (SerialFactory) ctx.getApplicationMap().get(SERIAL_FACTORY);
if(serialFactory == null)
{
throw new NullPointerException("serialFactory");
}
try
{
ObjectOutputStream writer = serialFactory.getObjectOutputStream(outputStream);
writer.writeObject(object);
byte[] bytes = outputStream.toByteArray();
writer.close();
outputStream.close();
writer = null;
outputStream = null;
return bytes;
}
catch (IOException e)
{
throw new FacesException(e);
}
} | [
"public",
"static",
"final",
"byte",
"[",
"]",
"getAsByteArray",
"(",
"Object",
"object",
",",
"ExternalContext",
"ctx",
")",
"{",
"ByteArrayOutputStream",
"outputStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"// get the Factory that was instantiated @ startup",
"SerialFactory",
"serialFactory",
"=",
"(",
"SerialFactory",
")",
"ctx",
".",
"getApplicationMap",
"(",
")",
".",
"get",
"(",
"SERIAL_FACTORY",
")",
";",
"if",
"(",
"serialFactory",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"serialFactory\"",
")",
";",
"}",
"try",
"{",
"ObjectOutputStream",
"writer",
"=",
"serialFactory",
".",
"getObjectOutputStream",
"(",
"outputStream",
")",
";",
"writer",
".",
"writeObject",
"(",
"object",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"outputStream",
".",
"toByteArray",
"(",
")",
";",
"writer",
".",
"close",
"(",
")",
";",
"outputStream",
".",
"close",
"(",
")",
";",
"writer",
"=",
"null",
";",
"outputStream",
"=",
"null",
";",
"return",
"bytes",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"FacesException",
"(",
"e",
")",
";",
"}",
"}"
] | Performs serialization with the serialization provider created by the
SerialFactory.
@param object
@param ctx
@return | [
"Performs",
"serialization",
"with",
"the",
"serialization",
"provider",
"created",
"by",
"the",
"SerialFactory",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java#L276-L303 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java | StateUtils.reconstruct | public static final Object reconstruct(String string, ExternalContext ctx)
{
byte[] bytes;
try
{
if(log.isLoggable(Level.FINE))
{
log.fine("Processing state : " + string);
}
bytes = string.getBytes(ZIP_CHARSET);
bytes = decode(bytes);
if(isSecure(ctx))
{
bytes = decrypt(bytes, ctx);
}
if( enableCompression(ctx) )
{
bytes = decompress(bytes);
}
return getAsObject(bytes, ctx);
}
catch (Throwable e)
{
if (log.isLoggable(Level.FINE))
{
log.log(Level.FINE, "View State cannot be reconstructed", e);
}
return null;
}
} | java | public static final Object reconstruct(String string, ExternalContext ctx)
{
byte[] bytes;
try
{
if(log.isLoggable(Level.FINE))
{
log.fine("Processing state : " + string);
}
bytes = string.getBytes(ZIP_CHARSET);
bytes = decode(bytes);
if(isSecure(ctx))
{
bytes = decrypt(bytes, ctx);
}
if( enableCompression(ctx) )
{
bytes = decompress(bytes);
}
return getAsObject(bytes, ctx);
}
catch (Throwable e)
{
if (log.isLoggable(Level.FINE))
{
log.log(Level.FINE, "View State cannot be reconstructed", e);
}
return null;
}
} | [
"public",
"static",
"final",
"Object",
"reconstruct",
"(",
"String",
"string",
",",
"ExternalContext",
"ctx",
")",
"{",
"byte",
"[",
"]",
"bytes",
";",
"try",
"{",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"log",
".",
"fine",
"(",
"\"Processing state : \"",
"+",
"string",
")",
";",
"}",
"bytes",
"=",
"string",
".",
"getBytes",
"(",
"ZIP_CHARSET",
")",
";",
"bytes",
"=",
"decode",
"(",
"bytes",
")",
";",
"if",
"(",
"isSecure",
"(",
"ctx",
")",
")",
"{",
"bytes",
"=",
"decrypt",
"(",
"bytes",
",",
"ctx",
")",
";",
"}",
"if",
"(",
"enableCompression",
"(",
"ctx",
")",
")",
"{",
"bytes",
"=",
"decompress",
"(",
"bytes",
")",
";",
"}",
"return",
"getAsObject",
"(",
"bytes",
",",
"ctx",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"log",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"View State cannot be reconstructed\"",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"}"
] | This fires during the Restore View phase, restoring state. | [
"This",
"fires",
"during",
"the",
"Restore",
"View",
"phase",
"restoring",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java#L387-L417 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java | StateUtils.getAsObject | public static final Object getAsObject(byte[] bytes, ExternalContext ctx)
{
ByteArrayInputStream input = null;
try
{
input = new ByteArrayInputStream(bytes);
// get the Factory that was instantiated @ startup
SerialFactory serialFactory = (SerialFactory) ctx.getApplicationMap().get(SERIAL_FACTORY);
if(serialFactory == null)
{
throw new NullPointerException("serialFactory");
}
ObjectInputStream s = null;
Exception pendingException = null;
try
{
s = serialFactory.getObjectInputStream(input);
Object object = null;
if (System.getSecurityManager() != null)
{
final ObjectInputStream ois = s;
object = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
{
//Put IOException and ClassNotFoundException as "checked" exceptions,
//so AccessController wrap them in a PrivilegedActionException
public Object run() throws PrivilegedActionException,
IOException, ClassNotFoundException
{
return ois.readObject();
}
});
// Since s has the same instance as ois,
// we don't need to close it here, rather
// close it on the finally block related to s
// and avoid duplicate close exceptions
// finally
// {
// ois.close();
// }
}
else
{
object = s.readObject();
}
return object;
}
catch (Exception e)
{
pendingException = e;
throw new FacesException(e);
}
finally
{
if (s != null)
{
try
{
s.close();
}
catch (IOException e)
{
// If a previous exception is thrown
// ignore this, but if not, wrap it in a
// FacesException and throw it. In this way
// we preserve the original semantic of this
// method, but we handle correctly the case
// when we close a stream. Obviously, the
// information about this exception is lost,
// but note that the interesting information
// is always on pendingException, since we
// only do a readObject() on the outer try block.
if (pendingException == null)
{
throw new FacesException(e);
}
}
finally
{
s = null;
}
}
}
}
finally
{
if (input != null)
{
try
{
input.close();
}
catch (IOException e)
{
//ignore it, because ByteArrayInputStream.close has
//no effect, but it is better to call close and preserve
//semantic from previous code.
}
finally
{
input = null;
}
}
}
} | java | public static final Object getAsObject(byte[] bytes, ExternalContext ctx)
{
ByteArrayInputStream input = null;
try
{
input = new ByteArrayInputStream(bytes);
// get the Factory that was instantiated @ startup
SerialFactory serialFactory = (SerialFactory) ctx.getApplicationMap().get(SERIAL_FACTORY);
if(serialFactory == null)
{
throw new NullPointerException("serialFactory");
}
ObjectInputStream s = null;
Exception pendingException = null;
try
{
s = serialFactory.getObjectInputStream(input);
Object object = null;
if (System.getSecurityManager() != null)
{
final ObjectInputStream ois = s;
object = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
{
//Put IOException and ClassNotFoundException as "checked" exceptions,
//so AccessController wrap them in a PrivilegedActionException
public Object run() throws PrivilegedActionException,
IOException, ClassNotFoundException
{
return ois.readObject();
}
});
// Since s has the same instance as ois,
// we don't need to close it here, rather
// close it on the finally block related to s
// and avoid duplicate close exceptions
// finally
// {
// ois.close();
// }
}
else
{
object = s.readObject();
}
return object;
}
catch (Exception e)
{
pendingException = e;
throw new FacesException(e);
}
finally
{
if (s != null)
{
try
{
s.close();
}
catch (IOException e)
{
// If a previous exception is thrown
// ignore this, but if not, wrap it in a
// FacesException and throw it. In this way
// we preserve the original semantic of this
// method, but we handle correctly the case
// when we close a stream. Obviously, the
// information about this exception is lost,
// but note that the interesting information
// is always on pendingException, since we
// only do a readObject() on the outer try block.
if (pendingException == null)
{
throw new FacesException(e);
}
}
finally
{
s = null;
}
}
}
}
finally
{
if (input != null)
{
try
{
input.close();
}
catch (IOException e)
{
//ignore it, because ByteArrayInputStream.close has
//no effect, but it is better to call close and preserve
//semantic from previous code.
}
finally
{
input = null;
}
}
}
} | [
"public",
"static",
"final",
"Object",
"getAsObject",
"(",
"byte",
"[",
"]",
"bytes",
",",
"ExternalContext",
"ctx",
")",
"{",
"ByteArrayInputStream",
"input",
"=",
"null",
";",
"try",
"{",
"input",
"=",
"new",
"ByteArrayInputStream",
"(",
"bytes",
")",
";",
"// get the Factory that was instantiated @ startup",
"SerialFactory",
"serialFactory",
"=",
"(",
"SerialFactory",
")",
"ctx",
".",
"getApplicationMap",
"(",
")",
".",
"get",
"(",
"SERIAL_FACTORY",
")",
";",
"if",
"(",
"serialFactory",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"serialFactory\"",
")",
";",
"}",
"ObjectInputStream",
"s",
"=",
"null",
";",
"Exception",
"pendingException",
"=",
"null",
";",
"try",
"{",
"s",
"=",
"serialFactory",
".",
"getObjectInputStream",
"(",
"input",
")",
";",
"Object",
"object",
"=",
"null",
";",
"if",
"(",
"System",
".",
"getSecurityManager",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"ObjectInputStream",
"ois",
"=",
"s",
";",
"object",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedExceptionAction",
"<",
"Object",
">",
"(",
")",
"{",
"//Put IOException and ClassNotFoundException as \"checked\" exceptions,",
"//so AccessController wrap them in a PrivilegedActionException",
"public",
"Object",
"run",
"(",
")",
"throws",
"PrivilegedActionException",
",",
"IOException",
",",
"ClassNotFoundException",
"{",
"return",
"ois",
".",
"readObject",
"(",
")",
";",
"}",
"}",
")",
";",
"// Since s has the same instance as ois,",
"// we don't need to close it here, rather",
"// close it on the finally block related to s",
"// and avoid duplicate close exceptions",
"// finally",
"// {",
"// ois.close();",
"// }",
"}",
"else",
"{",
"object",
"=",
"s",
".",
"readObject",
"(",
")",
";",
"}",
"return",
"object",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"pendingException",
"=",
"e",
";",
"throw",
"new",
"FacesException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"try",
"{",
"s",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// If a previous exception is thrown ",
"// ignore this, but if not, wrap it in a",
"// FacesException and throw it. In this way",
"// we preserve the original semantic of this",
"// method, but we handle correctly the case",
"// when we close a stream. Obviously, the ",
"// information about this exception is lost,",
"// but note that the interesting information ",
"// is always on pendingException, since we",
"// only do a readObject() on the outer try block.",
"if",
"(",
"pendingException",
"==",
"null",
")",
"{",
"throw",
"new",
"FacesException",
"(",
"e",
")",
";",
"}",
"}",
"finally",
"{",
"s",
"=",
"null",
";",
"}",
"}",
"}",
"}",
"finally",
"{",
"if",
"(",
"input",
"!=",
"null",
")",
"{",
"try",
"{",
"input",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"//ignore it, because ByteArrayInputStream.close has",
"//no effect, but it is better to call close and preserve",
"//semantic from previous code.",
"}",
"finally",
"{",
"input",
"=",
"null",
";",
"}",
"}",
"}",
"}"
] | Performs deserialization with the serialization provider created from the
SerialFactory.
@param bytes
@param ctx
@return | [
"Performs",
"deserialization",
"with",
"the",
"serialization",
"provider",
"created",
"from",
"the",
"SerialFactory",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java#L539-L646 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java | StateUtils.main | public static void main (String[] args) throws UnsupportedEncodingException
{
byte[] bytes = encode(args[0].getBytes(ZIP_CHARSET));
System.out.println(new String(bytes, ZIP_CHARSET));
} | java | public static void main (String[] args) throws UnsupportedEncodingException
{
byte[] bytes = encode(args[0].getBytes(ZIP_CHARSET));
System.out.println(new String(bytes, ZIP_CHARSET));
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"UnsupportedEncodingException",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"encode",
"(",
"args",
"[",
"0",
"]",
".",
"getBytes",
"(",
"ZIP_CHARSET",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"new",
"String",
"(",
"bytes",
",",
"ZIP_CHARSET",
")",
")",
";",
"}"
] | Utility method for generating base 64 encoded strings.
@param args
@throws UnsupportedEncodingException | [
"Utility",
"method",
"for",
"generating",
"base",
"64",
"encoded",
"strings",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java#L654-L658 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java | StateUtils.initSecret | public static void initSecret(ServletContext ctx)
{
if(ctx == null)
{
throw new NullPointerException("ServletContext ctx");
}
if (log.isLoggable(Level.FINE))
{
log.fine("Storing SecretKey @ " + INIT_SECRET_KEY_CACHE);
}
// Create and store SecretKey on application scope
String cache = ctx.getInitParameter(INIT_SECRET_KEY_CACHE);
if(cache == null)
{
cache = ctx.getInitParameter(INIT_SECRET_KEY_CACHE.toLowerCase());
}
if (!"false".equals(cache))
{
String algorithm = findAlgorithm(ctx);
// you want to create this as few times as possible
ctx.setAttribute(INIT_SECRET_KEY_CACHE, new SecretKeySpec(
findSecret(ctx, algorithm), algorithm));
}
if (log.isLoggable(Level.FINE))
{
log.fine("Storing SecretKey @ " + INIT_MAC_SECRET_KEY_CACHE);
}
String macCache = ctx.getInitParameter(INIT_MAC_SECRET_KEY_CACHE);
if(macCache == null)
{
macCache = ctx.getInitParameter(INIT_MAC_SECRET_KEY_CACHE.toLowerCase());
}
if (!"false".equals(macCache))
{
String macAlgorithm = findMacAlgorithm(ctx);
// init mac secret and algorithm
ctx.setAttribute(INIT_MAC_SECRET_KEY_CACHE, new SecretKeySpec(
findMacSecret(ctx, macAlgorithm), macAlgorithm));
}
} | java | public static void initSecret(ServletContext ctx)
{
if(ctx == null)
{
throw new NullPointerException("ServletContext ctx");
}
if (log.isLoggable(Level.FINE))
{
log.fine("Storing SecretKey @ " + INIT_SECRET_KEY_CACHE);
}
// Create and store SecretKey on application scope
String cache = ctx.getInitParameter(INIT_SECRET_KEY_CACHE);
if(cache == null)
{
cache = ctx.getInitParameter(INIT_SECRET_KEY_CACHE.toLowerCase());
}
if (!"false".equals(cache))
{
String algorithm = findAlgorithm(ctx);
// you want to create this as few times as possible
ctx.setAttribute(INIT_SECRET_KEY_CACHE, new SecretKeySpec(
findSecret(ctx, algorithm), algorithm));
}
if (log.isLoggable(Level.FINE))
{
log.fine("Storing SecretKey @ " + INIT_MAC_SECRET_KEY_CACHE);
}
String macCache = ctx.getInitParameter(INIT_MAC_SECRET_KEY_CACHE);
if(macCache == null)
{
macCache = ctx.getInitParameter(INIT_MAC_SECRET_KEY_CACHE.toLowerCase());
}
if (!"false".equals(macCache))
{
String macAlgorithm = findMacAlgorithm(ctx);
// init mac secret and algorithm
ctx.setAttribute(INIT_MAC_SECRET_KEY_CACHE, new SecretKeySpec(
findMacSecret(ctx, macAlgorithm), macAlgorithm));
}
} | [
"public",
"static",
"void",
"initSecret",
"(",
"ServletContext",
"ctx",
")",
"{",
"if",
"(",
"ctx",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"ServletContext ctx\"",
")",
";",
"}",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"log",
".",
"fine",
"(",
"\"Storing SecretKey @ \"",
"+",
"INIT_SECRET_KEY_CACHE",
")",
";",
"}",
"// Create and store SecretKey on application scope",
"String",
"cache",
"=",
"ctx",
".",
"getInitParameter",
"(",
"INIT_SECRET_KEY_CACHE",
")",
";",
"if",
"(",
"cache",
"==",
"null",
")",
"{",
"cache",
"=",
"ctx",
".",
"getInitParameter",
"(",
"INIT_SECRET_KEY_CACHE",
".",
"toLowerCase",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"\"false\"",
".",
"equals",
"(",
"cache",
")",
")",
"{",
"String",
"algorithm",
"=",
"findAlgorithm",
"(",
"ctx",
")",
";",
"// you want to create this as few times as possible",
"ctx",
".",
"setAttribute",
"(",
"INIT_SECRET_KEY_CACHE",
",",
"new",
"SecretKeySpec",
"(",
"findSecret",
"(",
"ctx",
",",
"algorithm",
")",
",",
"algorithm",
")",
")",
";",
"}",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"log",
".",
"fine",
"(",
"\"Storing SecretKey @ \"",
"+",
"INIT_MAC_SECRET_KEY_CACHE",
")",
";",
"}",
"String",
"macCache",
"=",
"ctx",
".",
"getInitParameter",
"(",
"INIT_MAC_SECRET_KEY_CACHE",
")",
";",
"if",
"(",
"macCache",
"==",
"null",
")",
"{",
"macCache",
"=",
"ctx",
".",
"getInitParameter",
"(",
"INIT_MAC_SECRET_KEY_CACHE",
".",
"toLowerCase",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"\"false\"",
".",
"equals",
"(",
"macCache",
")",
")",
"{",
"String",
"macAlgorithm",
"=",
"findMacAlgorithm",
"(",
"ctx",
")",
";",
"// init mac secret and algorithm ",
"ctx",
".",
"setAttribute",
"(",
"INIT_MAC_SECRET_KEY_CACHE",
",",
"new",
"SecretKeySpec",
"(",
"findMacSecret",
"(",
"ctx",
",",
"macAlgorithm",
")",
",",
"macAlgorithm",
")",
")",
";",
"}",
"}"
] | Does nothing if the user has disabled the SecretKey cache. This is
useful when dealing with a JCA provider whose SecretKey
implementation is not thread safe.
Instantiates a SecretKey instance based upon what the user has
specified in the deployment descriptor. The SecretKey is then
stored in application scope where it can be used for all requests. | [
"Does",
"nothing",
"if",
"the",
"user",
"has",
"disabled",
"the",
"SecretKey",
"cache",
".",
"This",
"is",
"useful",
"when",
"dealing",
"with",
"a",
"JCA",
"provider",
"whose",
"SecretKey",
"implementation",
"is",
"not",
"thread",
"safe",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java#L755-L803 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/java/EnvironmentVariables.java | EnvironmentVariables.getEnvironment | private Map<String, String> getEnvironment() {
return AccessController.doPrivileged(new PrivilegedAction<Map<String, String>>() {
@Override
public Map<String, String> run() {
return System.getenv();
}
});
} | java | private Map<String, String> getEnvironment() {
return AccessController.doPrivileged(new PrivilegedAction<Map<String, String>>() {
@Override
public Map<String, String> run() {
return System.getenv();
}
});
} | [
"private",
"Map",
"<",
"String",
",",
"String",
">",
"getEnvironment",
"(",
")",
"{",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"String",
">",
"run",
"(",
")",
"{",
"return",
"System",
".",
"getenv",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Get the system environment variables in a doPrivileged block.
@return the process environment variables | [
"Get",
"the",
"system",
"environment",
"variables",
"in",
"a",
"doPrivileged",
"block",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/java/EnvironmentVariables.java#L54-L61 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ConfigManager.java | ConfigManager.getDefaultParentForEntityInRealm | public String getDefaultParentForEntityInRealm(String entType, String realmName) throws WIMException {
String defaultParent = getDefaultParent(entType);
if (realmName != null) {
validateRealmName(realmName);
String parent = null;
RealmConfig realmConfig = getRealmConfig(realmName);
Map defaultParentsMap = realmConfig.getDefaultParentMapping();
if (defaultParentsMap != null) {
parent = (String) defaultParentsMap.get(entType);
if (parent != null) {
defaultParent = parent;
}
}
if (parent == null && !isUniqueNameInRealm(defaultParent, realmName)) {
defaultParent = null;
}
}
return defaultParent;
} | java | public String getDefaultParentForEntityInRealm(String entType, String realmName) throws WIMException {
String defaultParent = getDefaultParent(entType);
if (realmName != null) {
validateRealmName(realmName);
String parent = null;
RealmConfig realmConfig = getRealmConfig(realmName);
Map defaultParentsMap = realmConfig.getDefaultParentMapping();
if (defaultParentsMap != null) {
parent = (String) defaultParentsMap.get(entType);
if (parent != null) {
defaultParent = parent;
}
}
if (parent == null && !isUniqueNameInRealm(defaultParent, realmName)) {
defaultParent = null;
}
}
return defaultParent;
} | [
"public",
"String",
"getDefaultParentForEntityInRealm",
"(",
"String",
"entType",
",",
"String",
"realmName",
")",
"throws",
"WIMException",
"{",
"String",
"defaultParent",
"=",
"getDefaultParent",
"(",
"entType",
")",
";",
"if",
"(",
"realmName",
"!=",
"null",
")",
"{",
"validateRealmName",
"(",
"realmName",
")",
";",
"String",
"parent",
"=",
"null",
";",
"RealmConfig",
"realmConfig",
"=",
"getRealmConfig",
"(",
"realmName",
")",
";",
"Map",
"defaultParentsMap",
"=",
"realmConfig",
".",
"getDefaultParentMapping",
"(",
")",
";",
"if",
"(",
"defaultParentsMap",
"!=",
"null",
")",
"{",
"parent",
"=",
"(",
"String",
")",
"defaultParentsMap",
".",
"get",
"(",
"entType",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"defaultParent",
"=",
"parent",
";",
"}",
"}",
"if",
"(",
"parent",
"==",
"null",
"&&",
"!",
"isUniqueNameInRealm",
"(",
"defaultParent",
",",
"realmName",
")",
")",
"{",
"defaultParent",
"=",
"null",
";",
"}",
"}",
"return",
"defaultParent",
";",
"}"
] | Gets the default parent node that is for the specified entity type in specified realm.
@param entType The entity type. e.g. Person, Group...
@param realmName The name of the realm
@return The default parent node. | [
"Gets",
"the",
"default",
"parent",
"node",
"that",
"is",
"for",
"the",
"specified",
"entity",
"type",
"in",
"specified",
"realm",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ConfigManager.java#L367-L385 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ConfigManager.java | ConfigManager.getDefaultParent | public String getDefaultParent(String entityTypeName) {
SupportedEntityConfig entityConfig = entityTypeMap.get(entityTypeName);
if (entityConfig != null) {
return entityConfig.getDefaultParent();
}
return null;
} | java | public String getDefaultParent(String entityTypeName) {
SupportedEntityConfig entityConfig = entityTypeMap.get(entityTypeName);
if (entityConfig != null) {
return entityConfig.getDefaultParent();
}
return null;
} | [
"public",
"String",
"getDefaultParent",
"(",
"String",
"entityTypeName",
")",
"{",
"SupportedEntityConfig",
"entityConfig",
"=",
"entityTypeMap",
".",
"get",
"(",
"entityTypeName",
")",
";",
"if",
"(",
"entityConfig",
"!=",
"null",
")",
"{",
"return",
"entityConfig",
".",
"getDefaultParent",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Returns the default parent for the given prefixed entity type.
Entity types under WIM package should not have any name space prefix. For example, "Person".
@param entityTypeName The prefixed entity type.
@return The unique name of the default parent of this entity type. If the entity type is not supported, null will be returned. | [
"Returns",
"the",
"default",
"parent",
"for",
"the",
"given",
"prefixed",
"entity",
"type",
".",
"Entity",
"types",
"under",
"WIM",
"package",
"should",
"not",
"have",
"any",
"name",
"space",
"prefix",
".",
"For",
"example",
"Person",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ConfigManager.java#L394-L400 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/FaultToleranceCDIExtension.java | FaultToleranceCDIExtension.processMethod | private <T> boolean processMethod(AnnotatedMethod<T> method, Class<?> clazz, Asynchronous classLevelAsync) {
FTEnablementConfig config = FaultToleranceCDIComponent.getEnablementConfig();
Method javaMethod = method.getJavaMember();
if (javaMethod.isBridge()) {
// Skip all validation for bridge methods
// Bridge methods are created when a class overrides a method but provides more specific return or parameter types
// (usually when implementing a generic interface)
// In these cases, the bridge method matches the signature of the overridden method after type erasure and delegates directly to the overriding method
// In some cases, the signature of the overriding method is valid for some microprofile annotation, but the signature of the bridge method is not
// However, the user's code is valid, and weld seems to make sure that any interceptors get called with the real method in the InvocationContext.
return false;
}
if (classLevelAsync != null) {
AsynchronousConfig asynchronous = annotationConfigFactory.createAsynchronousConfig(javaMethod, clazz, classLevelAsync);
asynchronous.validate();
}
boolean needsIntercepting = false;
Set<Annotation> annotations = method.getAnnotations();
for (Annotation annotation : annotations) {
if (config.isFaultTolerance(annotation)) {
if (config.isAnnotationEnabled(annotation, clazz, method.getJavaMember())) {
needsIntercepting = true;
if (annotation.annotationType() == Asynchronous.class) {
AsynchronousConfig asynchronous = annotationConfigFactory.createAsynchronousConfig(javaMethod, clazz, (Asynchronous) annotation);
asynchronous.validate();
} else if (annotation.annotationType() == Fallback.class) {
FallbackConfig fallback = new FallbackConfig(javaMethod, clazz, (Fallback) annotation);
fallback.validate();
} else if (annotation.annotationType() == Retry.class) {
RetryConfig retry = new RetryConfig(javaMethod, clazz, (Retry) annotation);
retry.validate();
} else if (annotation.annotationType() == Timeout.class) {
TimeoutConfig timeout = new TimeoutConfig(javaMethod, clazz, (Timeout) annotation);
timeout.validate();
} else if (annotation.annotationType() == CircuitBreaker.class) {
CircuitBreakerConfig circuitBreaker = new CircuitBreakerConfig(javaMethod, clazz, (CircuitBreaker) annotation);
circuitBreaker.validate();
} else if (annotation.annotationType() == Bulkhead.class) {
BulkheadConfig bulkhead = new BulkheadConfig(javaMethod, clazz, (Bulkhead) annotation);
bulkhead.validate();
}
} else {
if (isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Annotation {0} on {1} was disabled and will be ignored", annotation.annotationType().getSimpleName(),
clazz.getCanonicalName() + "." + method.getJavaMember().getName());
}
}
}
}
return needsIntercepting;
} | java | private <T> boolean processMethod(AnnotatedMethod<T> method, Class<?> clazz, Asynchronous classLevelAsync) {
FTEnablementConfig config = FaultToleranceCDIComponent.getEnablementConfig();
Method javaMethod = method.getJavaMember();
if (javaMethod.isBridge()) {
// Skip all validation for bridge methods
// Bridge methods are created when a class overrides a method but provides more specific return or parameter types
// (usually when implementing a generic interface)
// In these cases, the bridge method matches the signature of the overridden method after type erasure and delegates directly to the overriding method
// In some cases, the signature of the overriding method is valid for some microprofile annotation, but the signature of the bridge method is not
// However, the user's code is valid, and weld seems to make sure that any interceptors get called with the real method in the InvocationContext.
return false;
}
if (classLevelAsync != null) {
AsynchronousConfig asynchronous = annotationConfigFactory.createAsynchronousConfig(javaMethod, clazz, classLevelAsync);
asynchronous.validate();
}
boolean needsIntercepting = false;
Set<Annotation> annotations = method.getAnnotations();
for (Annotation annotation : annotations) {
if (config.isFaultTolerance(annotation)) {
if (config.isAnnotationEnabled(annotation, clazz, method.getJavaMember())) {
needsIntercepting = true;
if (annotation.annotationType() == Asynchronous.class) {
AsynchronousConfig asynchronous = annotationConfigFactory.createAsynchronousConfig(javaMethod, clazz, (Asynchronous) annotation);
asynchronous.validate();
} else if (annotation.annotationType() == Fallback.class) {
FallbackConfig fallback = new FallbackConfig(javaMethod, clazz, (Fallback) annotation);
fallback.validate();
} else if (annotation.annotationType() == Retry.class) {
RetryConfig retry = new RetryConfig(javaMethod, clazz, (Retry) annotation);
retry.validate();
} else if (annotation.annotationType() == Timeout.class) {
TimeoutConfig timeout = new TimeoutConfig(javaMethod, clazz, (Timeout) annotation);
timeout.validate();
} else if (annotation.annotationType() == CircuitBreaker.class) {
CircuitBreakerConfig circuitBreaker = new CircuitBreakerConfig(javaMethod, clazz, (CircuitBreaker) annotation);
circuitBreaker.validate();
} else if (annotation.annotationType() == Bulkhead.class) {
BulkheadConfig bulkhead = new BulkheadConfig(javaMethod, clazz, (Bulkhead) annotation);
bulkhead.validate();
}
} else {
if (isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Annotation {0} on {1} was disabled and will be ignored", annotation.annotationType().getSimpleName(),
clazz.getCanonicalName() + "." + method.getJavaMember().getName());
}
}
}
}
return needsIntercepting;
} | [
"private",
"<",
"T",
">",
"boolean",
"processMethod",
"(",
"AnnotatedMethod",
"<",
"T",
">",
"method",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"Asynchronous",
"classLevelAsync",
")",
"{",
"FTEnablementConfig",
"config",
"=",
"FaultToleranceCDIComponent",
".",
"getEnablementConfig",
"(",
")",
";",
"Method",
"javaMethod",
"=",
"method",
".",
"getJavaMember",
"(",
")",
";",
"if",
"(",
"javaMethod",
".",
"isBridge",
"(",
")",
")",
"{",
"// Skip all validation for bridge methods",
"// Bridge methods are created when a class overrides a method but provides more specific return or parameter types",
"// (usually when implementing a generic interface)",
"// In these cases, the bridge method matches the signature of the overridden method after type erasure and delegates directly to the overriding method",
"// In some cases, the signature of the overriding method is valid for some microprofile annotation, but the signature of the bridge method is not",
"// However, the user's code is valid, and weld seems to make sure that any interceptors get called with the real method in the InvocationContext.",
"return",
"false",
";",
"}",
"if",
"(",
"classLevelAsync",
"!=",
"null",
")",
"{",
"AsynchronousConfig",
"asynchronous",
"=",
"annotationConfigFactory",
".",
"createAsynchronousConfig",
"(",
"javaMethod",
",",
"clazz",
",",
"classLevelAsync",
")",
";",
"asynchronous",
".",
"validate",
"(",
")",
";",
"}",
"boolean",
"needsIntercepting",
"=",
"false",
";",
"Set",
"<",
"Annotation",
">",
"annotations",
"=",
"method",
".",
"getAnnotations",
"(",
")",
";",
"for",
"(",
"Annotation",
"annotation",
":",
"annotations",
")",
"{",
"if",
"(",
"config",
".",
"isFaultTolerance",
"(",
"annotation",
")",
")",
"{",
"if",
"(",
"config",
".",
"isAnnotationEnabled",
"(",
"annotation",
",",
"clazz",
",",
"method",
".",
"getJavaMember",
"(",
")",
")",
")",
"{",
"needsIntercepting",
"=",
"true",
";",
"if",
"(",
"annotation",
".",
"annotationType",
"(",
")",
"==",
"Asynchronous",
".",
"class",
")",
"{",
"AsynchronousConfig",
"asynchronous",
"=",
"annotationConfigFactory",
".",
"createAsynchronousConfig",
"(",
"javaMethod",
",",
"clazz",
",",
"(",
"Asynchronous",
")",
"annotation",
")",
";",
"asynchronous",
".",
"validate",
"(",
")",
";",
"}",
"else",
"if",
"(",
"annotation",
".",
"annotationType",
"(",
")",
"==",
"Fallback",
".",
"class",
")",
"{",
"FallbackConfig",
"fallback",
"=",
"new",
"FallbackConfig",
"(",
"javaMethod",
",",
"clazz",
",",
"(",
"Fallback",
")",
"annotation",
")",
";",
"fallback",
".",
"validate",
"(",
")",
";",
"}",
"else",
"if",
"(",
"annotation",
".",
"annotationType",
"(",
")",
"==",
"Retry",
".",
"class",
")",
"{",
"RetryConfig",
"retry",
"=",
"new",
"RetryConfig",
"(",
"javaMethod",
",",
"clazz",
",",
"(",
"Retry",
")",
"annotation",
")",
";",
"retry",
".",
"validate",
"(",
")",
";",
"}",
"else",
"if",
"(",
"annotation",
".",
"annotationType",
"(",
")",
"==",
"Timeout",
".",
"class",
")",
"{",
"TimeoutConfig",
"timeout",
"=",
"new",
"TimeoutConfig",
"(",
"javaMethod",
",",
"clazz",
",",
"(",
"Timeout",
")",
"annotation",
")",
";",
"timeout",
".",
"validate",
"(",
")",
";",
"}",
"else",
"if",
"(",
"annotation",
".",
"annotationType",
"(",
")",
"==",
"CircuitBreaker",
".",
"class",
")",
"{",
"CircuitBreakerConfig",
"circuitBreaker",
"=",
"new",
"CircuitBreakerConfig",
"(",
"javaMethod",
",",
"clazz",
",",
"(",
"CircuitBreaker",
")",
"annotation",
")",
";",
"circuitBreaker",
".",
"validate",
"(",
")",
";",
"}",
"else",
"if",
"(",
"annotation",
".",
"annotationType",
"(",
")",
"==",
"Bulkhead",
".",
"class",
")",
"{",
"BulkheadConfig",
"bulkhead",
"=",
"new",
"BulkheadConfig",
"(",
"javaMethod",
",",
"clazz",
",",
"(",
"Bulkhead",
")",
"annotation",
")",
";",
"bulkhead",
".",
"validate",
"(",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Annotation {0} on {1} was disabled and will be ignored\"",
",",
"annotation",
".",
"annotationType",
"(",
")",
".",
"getSimpleName",
"(",
")",
",",
"clazz",
".",
"getCanonicalName",
"(",
")",
"+",
"\".\"",
"+",
"method",
".",
"getJavaMember",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"return",
"needsIntercepting",
";",
"}"
] | Validate a method and return whether it has fault tolerance annotations which require us to add the FT interceptor
@param method the method to process
@param clazz the class which declares the method
@param classLevelAsync whether the declaring class is annotated with {@code @Asynchronous}
@return true if the method requries the FT interceptor, false otherwise | [
"Validate",
"a",
"method",
"and",
"return",
"whether",
"it",
"has",
"fault",
"tolerance",
"annotations",
"which",
"require",
"us",
"to",
"add",
"the",
"FT",
"interceptor"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/FaultToleranceCDIExtension.java#L156-L211 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/ws/Transaction/JTS/Configuration.java | Configuration.setServerName | public static final void setServerName(String name)
{
if (tc.isDebugEnabled())
Tr.debug(tc, "setServerName", name);
// Store the server name.
serverName = name;
} | java | public static final void setServerName(String name)
{
if (tc.isDebugEnabled())
Tr.debug(tc, "setServerName", name);
// Store the server name.
serverName = name;
} | [
"public",
"static",
"final",
"void",
"setServerName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setServerName\"",
",",
"name",
")",
";",
"// Store the server name.",
"serverName",
"=",
"name",
";",
"}"
] | Sets the name of the server.
@param name The server name. Non-recoverable servers have null. | [
"Sets",
"the",
"name",
"of",
"the",
"server",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/ws/Transaction/JTS/Configuration.java#L43-L50 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/ws/Transaction/JTS/Configuration.java | Configuration.isRecoverable | public static final boolean isRecoverable()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "isRecoverable");
// This JTS is recoverable if there is a server name.
// boolean result = (serverName != null);
// JTA2 - we are recoverable if we have a working log...
// We can have a serverName but no working log either because
// a) the log config or store is invalid
// b) the log config indicates no logging.
//
boolean result = false;
if (_failureScopeController != null)
{
result = (_failureScopeController.getTransactionLog() != null);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "isRecoverable", Boolean.valueOf(result));
return result;
} | java | public static final boolean isRecoverable()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "isRecoverable");
// This JTS is recoverable if there is a server name.
// boolean result = (serverName != null);
// JTA2 - we are recoverable if we have a working log...
// We can have a serverName but no working log either because
// a) the log config or store is invalid
// b) the log config indicates no logging.
//
boolean result = false;
if (_failureScopeController != null)
{
result = (_failureScopeController.getTransactionLog() != null);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "isRecoverable", Boolean.valueOf(result));
return result;
} | [
"public",
"static",
"final",
"boolean",
"isRecoverable",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"isRecoverable\"",
")",
";",
"// This JTS is recoverable if there is a server name.",
"// boolean result = (serverName != null);",
"// JTA2 - we are recoverable if we have a working log...",
"// We can have a serverName but no working log either because",
"// a) the log config or store is invalid",
"// b) the log config indicates no logging.",
"//",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"_failureScopeController",
"!=",
"null",
")",
"{",
"result",
"=",
"(",
"_failureScopeController",
".",
"getTransactionLog",
"(",
")",
"!=",
"null",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"isRecoverable\"",
",",
"Boolean",
".",
"valueOf",
"(",
"result",
")",
")",
";",
"return",
"result",
";",
"}"
] | Determines whether the JTS instance is recoverable.
@return Indicates whether the JTS is recoverable. | [
"Determines",
"whether",
"the",
"JTS",
"instance",
"is",
"recoverable",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/ws/Transaction/JTS/Configuration.java#L72-L93 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/ws/Transaction/JTS/Configuration.java | Configuration.setCurrentEpoch | public static final void setCurrentEpoch(int number)
{
if (tc.isDebugEnabled())
Tr.debug(tc, "setCurrentEpoch", number);
currentEpoch = number;
} | java | public static final void setCurrentEpoch(int number)
{
if (tc.isDebugEnabled())
Tr.debug(tc, "setCurrentEpoch", number);
currentEpoch = number;
} | [
"public",
"static",
"final",
"void",
"setCurrentEpoch",
"(",
"int",
"number",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setCurrentEpoch\"",
",",
"number",
")",
";",
"currentEpoch",
"=",
"number",
";",
"}"
] | Sets the current epoch value for this server instance.
Initially on a cold start the valus is 1, and this is
incremented on each warm start after extracting the previous
value from the transactions log. The epoch value is used to
create unique global transaction identifiers. On each cold
start we also create a new applId, so the applid and epoch
will guarantee uniqueness of a server instance.
@param number The new retry count. | [
"Sets",
"the",
"current",
"epoch",
"value",
"for",
"this",
"server",
"instance",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/ws/Transaction/JTS/Configuration.java#L107-L113 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/ws/Transaction/JTS/Configuration.java | Configuration.setApplId | public static final void setApplId(byte[] name)
{
if (tc.isDebugEnabled())
Tr.debug(tc, "setApplId", name);
// Store the applId.
applId = name;
} | java | public static final void setApplId(byte[] name)
{
if (tc.isDebugEnabled())
Tr.debug(tc, "setApplId", name);
// Store the applId.
applId = name;
} | [
"public",
"static",
"final",
"void",
"setApplId",
"(",
"byte",
"[",
"]",
"name",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setApplId\"",
",",
"name",
")",
";",
"// Store the applId.",
"applId",
"=",
"name",
";",
"}"
] | Sets the applId of the server.
@param name The applId. Non-recoverable servers may have an applId but no name. | [
"Sets",
"the",
"applId",
"of",
"the",
"server",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/ws/Transaction/JTS/Configuration.java#L132-L139 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/ConversionManager.java | ConversionManager.convertCompatible | protected ConversionStatus convertCompatible(String rawString, Class<?> type) {
ConversionStatus status = new ConversionStatus();
for (PriorityConverter con : converters.getAll()) {
Type key = con.getType();
if (key instanceof Class) {
Class<?> clazz = (Class<?>) key;
if (type.isAssignableFrom(clazz)) {
Object converted = convert(rawString, key);
status.setConverted(converted);
break;
}
} else if (key instanceof TypeVariable) {
TypeVariable<?> typeVariable = (TypeVariable<?>) key;
status = convertGenericClazz(rawString, type, typeVariable);
if (status.isConverterFound()) {
break;
}
}
}
return status;
} | java | protected ConversionStatus convertCompatible(String rawString, Class<?> type) {
ConversionStatus status = new ConversionStatus();
for (PriorityConverter con : converters.getAll()) {
Type key = con.getType();
if (key instanceof Class) {
Class<?> clazz = (Class<?>) key;
if (type.isAssignableFrom(clazz)) {
Object converted = convert(rawString, key);
status.setConverted(converted);
break;
}
} else if (key instanceof TypeVariable) {
TypeVariable<?> typeVariable = (TypeVariable<?>) key;
status = convertGenericClazz(rawString, type, typeVariable);
if (status.isConverterFound()) {
break;
}
}
}
return status;
} | [
"protected",
"ConversionStatus",
"convertCompatible",
"(",
"String",
"rawString",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"ConversionStatus",
"status",
"=",
"new",
"ConversionStatus",
"(",
")",
";",
"for",
"(",
"PriorityConverter",
"con",
":",
"converters",
".",
"getAll",
"(",
")",
")",
"{",
"Type",
"key",
"=",
"con",
".",
"getType",
"(",
")",
";",
"if",
"(",
"key",
"instanceof",
"Class",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"(",
"Class",
"<",
"?",
">",
")",
"key",
";",
"if",
"(",
"type",
".",
"isAssignableFrom",
"(",
"clazz",
")",
")",
"{",
"Object",
"converted",
"=",
"convert",
"(",
"rawString",
",",
"key",
")",
";",
"status",
".",
"setConverted",
"(",
"converted",
")",
";",
"break",
";",
"}",
"}",
"else",
"if",
"(",
"key",
"instanceof",
"TypeVariable",
")",
"{",
"TypeVariable",
"<",
"?",
">",
"typeVariable",
"=",
"(",
"TypeVariable",
"<",
"?",
">",
")",
"key",
";",
"status",
"=",
"convertGenericClazz",
"(",
"rawString",
",",
"type",
",",
"typeVariable",
")",
";",
"if",
"(",
"status",
".",
"isConverterFound",
"(",
")",
")",
"{",
"break",
";",
"}",
"}",
"}",
"return",
"status",
";",
"}"
] | Converts from String based on isAssignableFrom or instanceof
@param rawString
@param type
@return ConversionStatus<T> whether a converter is found and the converted value | [
"Converts",
"from",
"String",
"based",
"on",
"isAssignableFrom",
"or",
"instanceof"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/ConversionManager.java#L213-L234 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/ConversionManager.java | ConversionManager.convertArray | public <T> T[] convertArray(String rawString, Class<T> arrayType) {
String[] elements = split(rawString);
T[] array = convertArray(elements, arrayType);
return array;
} | java | public <T> T[] convertArray(String rawString, Class<T> arrayType) {
String[] elements = split(rawString);
T[] array = convertArray(elements, arrayType);
return array;
} | [
"public",
"<",
"T",
">",
"T",
"[",
"]",
"convertArray",
"(",
"String",
"rawString",
",",
"Class",
"<",
"T",
">",
"arrayType",
")",
"{",
"String",
"[",
"]",
"elements",
"=",
"split",
"(",
"rawString",
")",
";",
"T",
"[",
"]",
"array",
"=",
"convertArray",
"(",
"elements",
",",
"arrayType",
")",
";",
"return",
"array",
";",
"}"
] | Apply convert across an array
@param rawString
@param arrayType
@return an array of converted T objects. | [
"Apply",
"convert",
"across",
"an",
"array"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/ConversionManager.java#L270-L275 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/utils/JspTranslatorUtil.java | JspTranslatorUtil.toClass | public static Class toClass(String type, ClassLoader loader)
throws ClassNotFoundException {
if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINER)){
logger.logp(Level.FINER, CLASS_NAME, "toClass(String, ClassLoader)"," type= ["+type+"] loader= ["+loader+"]");
}
Class c = null;
int i0 = type.indexOf('[');
int dims = 0;
if (i0 > 0) {
// This is an array. Count the dimensions
for (int i = 0; i < type.length(); i++) {
if (type.charAt(i) == '[')
dims++;
}
type = type.substring(0, i0);
}else if (i0==0) {
//PM12828 start
//check for a type like this "[Lcom.ibm.sample.TagsAttr;" This means it is an array type.
//a two dimensional array might look like [[Lcom.ibm.sample.TagsAttr;
int bracketL = type.indexOf("[L");
if (bracketL>-1 && type.endsWith(";")) {
type = type.substring(bracketL+2,(type.length() - 1));
dims+=(bracketL+1);
}
}
//PM12828 end
if ("boolean".equals(type))
c = boolean.class;
else if ("char".equals(type))
c = char.class;
else if ("byte".equals(type))
c = byte.class;
else if ("short".equals(type))
c = short.class;
else if ("int".equals(type))
c = int.class;
else if ("long".equals(type))
c = long.class;
else if ("float".equals(type))
c = float.class;
else if ("double".equals(type))
c = double.class;
else if ("void".equals(type)) {
return Void.class;
}
else if (type.indexOf('[') < 0)
c = loader.loadClass(type);
if (dims == 0)
return c;
if (dims == 1)
return java.lang.reflect.Array.newInstance(c, 1).getClass();
// Array of more than i dimension
return java.lang.reflect.Array.newInstance(c, new int[dims]).getClass();
} | java | public static Class toClass(String type, ClassLoader loader)
throws ClassNotFoundException {
if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINER)){
logger.logp(Level.FINER, CLASS_NAME, "toClass(String, ClassLoader)"," type= ["+type+"] loader= ["+loader+"]");
}
Class c = null;
int i0 = type.indexOf('[');
int dims = 0;
if (i0 > 0) {
// This is an array. Count the dimensions
for (int i = 0; i < type.length(); i++) {
if (type.charAt(i) == '[')
dims++;
}
type = type.substring(0, i0);
}else if (i0==0) {
//PM12828 start
//check for a type like this "[Lcom.ibm.sample.TagsAttr;" This means it is an array type.
//a two dimensional array might look like [[Lcom.ibm.sample.TagsAttr;
int bracketL = type.indexOf("[L");
if (bracketL>-1 && type.endsWith(";")) {
type = type.substring(bracketL+2,(type.length() - 1));
dims+=(bracketL+1);
}
}
//PM12828 end
if ("boolean".equals(type))
c = boolean.class;
else if ("char".equals(type))
c = char.class;
else if ("byte".equals(type))
c = byte.class;
else if ("short".equals(type))
c = short.class;
else if ("int".equals(type))
c = int.class;
else if ("long".equals(type))
c = long.class;
else if ("float".equals(type))
c = float.class;
else if ("double".equals(type))
c = double.class;
else if ("void".equals(type)) {
return Void.class;
}
else if (type.indexOf('[') < 0)
c = loader.loadClass(type);
if (dims == 0)
return c;
if (dims == 1)
return java.lang.reflect.Array.newInstance(c, 1).getClass();
// Array of more than i dimension
return java.lang.reflect.Array.newInstance(c, new int[dims]).getClass();
} | [
"public",
"static",
"Class",
"toClass",
"(",
"String",
"type",
",",
"ClassLoader",
"loader",
")",
"throws",
"ClassNotFoundException",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINER",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINER",
",",
"CLASS_NAME",
",",
"\"toClass(String, ClassLoader)\"",
",",
"\" type= [\"",
"+",
"type",
"+",
"\"] loader= [\"",
"+",
"loader",
"+",
"\"]\"",
")",
";",
"}",
"Class",
"c",
"=",
"null",
";",
"int",
"i0",
"=",
"type",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"int",
"dims",
"=",
"0",
";",
"if",
"(",
"i0",
">",
"0",
")",
"{",
"// This is an array. Count the dimensions",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"type",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"type",
".",
"charAt",
"(",
"i",
")",
"==",
"'",
"'",
")",
"dims",
"++",
";",
"}",
"type",
"=",
"type",
".",
"substring",
"(",
"0",
",",
"i0",
")",
";",
"}",
"else",
"if",
"(",
"i0",
"==",
"0",
")",
"{",
"//PM12828 start",
"//check for a type like this \"[Lcom.ibm.sample.TagsAttr;\" This means it is an array type.",
"//a two dimensional array might look like [[Lcom.ibm.sample.TagsAttr;",
"int",
"bracketL",
"=",
"type",
".",
"indexOf",
"(",
"\"[L\"",
")",
";",
"if",
"(",
"bracketL",
">",
"-",
"1",
"&&",
"type",
".",
"endsWith",
"(",
"\";\"",
")",
")",
"{",
"type",
"=",
"type",
".",
"substring",
"(",
"bracketL",
"+",
"2",
",",
"(",
"type",
".",
"length",
"(",
")",
"-",
"1",
")",
")",
";",
"dims",
"+=",
"(",
"bracketL",
"+",
"1",
")",
";",
"}",
"}",
"//PM12828 end",
"if",
"(",
"\"boolean\"",
".",
"equals",
"(",
"type",
")",
")",
"c",
"=",
"boolean",
".",
"class",
";",
"else",
"if",
"(",
"\"char\"",
".",
"equals",
"(",
"type",
")",
")",
"c",
"=",
"char",
".",
"class",
";",
"else",
"if",
"(",
"\"byte\"",
".",
"equals",
"(",
"type",
")",
")",
"c",
"=",
"byte",
".",
"class",
";",
"else",
"if",
"(",
"\"short\"",
".",
"equals",
"(",
"type",
")",
")",
"c",
"=",
"short",
".",
"class",
";",
"else",
"if",
"(",
"\"int\"",
".",
"equals",
"(",
"type",
")",
")",
"c",
"=",
"int",
".",
"class",
";",
"else",
"if",
"(",
"\"long\"",
".",
"equals",
"(",
"type",
")",
")",
"c",
"=",
"long",
".",
"class",
";",
"else",
"if",
"(",
"\"float\"",
".",
"equals",
"(",
"type",
")",
")",
"c",
"=",
"float",
".",
"class",
";",
"else",
"if",
"(",
"\"double\"",
".",
"equals",
"(",
"type",
")",
")",
"c",
"=",
"double",
".",
"class",
";",
"else",
"if",
"(",
"\"void\"",
".",
"equals",
"(",
"type",
")",
")",
"{",
"return",
"Void",
".",
"class",
";",
"}",
"else",
"if",
"(",
"type",
".",
"indexOf",
"(",
"'",
"'",
")",
"<",
"0",
")",
"c",
"=",
"loader",
".",
"loadClass",
"(",
"type",
")",
";",
"if",
"(",
"dims",
"==",
"0",
")",
"return",
"c",
";",
"if",
"(",
"dims",
"==",
"1",
")",
"return",
"java",
".",
"lang",
".",
"reflect",
".",
"Array",
".",
"newInstance",
"(",
"c",
",",
"1",
")",
".",
"getClass",
"(",
")",
";",
"// Array of more than i dimension",
"return",
"java",
".",
"lang",
".",
"reflect",
".",
"Array",
".",
"newInstance",
"(",
"c",
",",
"new",
"int",
"[",
"dims",
"]",
")",
".",
"getClass",
"(",
")",
";",
"}"
] | PM12828 - need to account for a case where type is [Lcom.ibm.sample.TagsAttr; | [
"PM12828",
"-",
"need",
"to",
"account",
"for",
"a",
"case",
"where",
"type",
"is",
"[",
"Lcom",
".",
"ibm",
".",
"sample",
".",
"TagsAttr",
";"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/utils/JspTranslatorUtil.java#L560-L618 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java | DefaultFaceletFactory.getFacelet | @Override
public Facelet getFacelet(URL url) throws IOException, FaceletException, FacesException, ELException
{
return _faceletCache.getFacelet(url);
} | java | @Override
public Facelet getFacelet(URL url) throws IOException, FaceletException, FacesException, ELException
{
return _faceletCache.getFacelet(url);
} | [
"@",
"Override",
"public",
"Facelet",
"getFacelet",
"(",
"URL",
"url",
")",
"throws",
"IOException",
",",
"FaceletException",
",",
"FacesException",
",",
"ELException",
"{",
"return",
"_faceletCache",
".",
"getFacelet",
"(",
"url",
")",
";",
"}"
] | Create a Facelet from the passed URL. This method checks if the cached Facelet needs to be refreshed before
returning. If so, uses the passed URL to build a new instance;
@param url
source url
@return Facelet instance
@throws IOException
@throws FaceletException
@throws FacesException
@throws ELException | [
"Create",
"a",
"Facelet",
"from",
"the",
"passed",
"URL",
".",
"This",
"method",
"checks",
"if",
"the",
"cached",
"Facelet",
"needs",
"to",
"be",
"refreshed",
"before",
"returning",
".",
"If",
"so",
"uses",
"the",
"passed",
"URL",
"to",
"build",
"a",
"new",
"instance",
";"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java#L261-L265 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java | DefaultFaceletFactory._removeFirst | private String _removeFirst(String string, String toRemove)
{
// do exactly what String.replaceFirst(toRemove, "") internally does,
// except treating the search as literal text and not as regex
return Pattern.compile(toRemove, Pattern.LITERAL).matcher(string).replaceFirst("");
} | java | private String _removeFirst(String string, String toRemove)
{
// do exactly what String.replaceFirst(toRemove, "") internally does,
// except treating the search as literal text and not as regex
return Pattern.compile(toRemove, Pattern.LITERAL).matcher(string).replaceFirst("");
} | [
"private",
"String",
"_removeFirst",
"(",
"String",
"string",
",",
"String",
"toRemove",
")",
"{",
"// do exactly what String.replaceFirst(toRemove, \"\") internally does,",
"// except treating the search as literal text and not as regex",
"return",
"Pattern",
".",
"compile",
"(",
"toRemove",
",",
"Pattern",
".",
"LITERAL",
")",
".",
"matcher",
"(",
"string",
")",
".",
"replaceFirst",
"(",
"\"\"",
")",
";",
"}"
] | Removes the first appearance of toRemove in string.
Works just like string.replaceFirst(toRemove, ""), except that toRemove
is not treated as a regex (which could cause problems with filenames).
@param string
@param toRemove
@return | [
"Removes",
"the",
"first",
"appearance",
"of",
"toRemove",
"in",
"string",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java#L613-L619 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/MessageDrivenBeanO.java | MessageDrivenBeanO.initialize | @Override
protected void initialize(boolean reactivate) throws RemoteException, InvocationTargetException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "initialize");
}
BeanMetaData bmd = home.beanMetaData;
ivCallbackKind = bmd.ivCallbackKind;
state = PRE_CREATE; // d159152
CallbackContextHelper contextHelper = new CallbackContextHelper(this); // d630940
try {
// Disallow setRollbackOnly until create is done.
allowRollbackOnly = false;
// Set the BeanId for this MDB. Just like we do for SLSB,
// we use the BeanId for the home bean so that the same ID
// is used for all MDB instances. Note the ivStatelessId is
// for the home bean, which is implemented as a SLSB.
if (home != null) {
setId(home.ivStatelessId); // d140003.12
}
// Note that the local transaction surrounds injection methods and
// PostConstruct lifecycle callbacks.
contextHelper.begin(CallbackContextHelper.Tx.CompatLTC,
CallbackContextHelper.Contexts.CallbackBean); // d630940
InterceptorMetaData imd = bmd.ivInterceptorMetaData;
createInterceptorsAndInstance(contextHelper);
// Now set the MessageDrivenContext and/or do the dependency injection.
// Note that dependency injection must occur while in PRE_CREATE state.
injectInstance(ivManagedObject, ivEjbInstance, this);
//---------------------------------------------------------
// Now that the MessageDrivenContext is set and/or dependencies
// injection has occured, change state to CREATING state to allow
// additional methods to be called by the ejbCreate or
// PostConstruct interceptor methods (e.g. getEJBObject).
//---------------------------------------------------------
setState(CREATING); //d399469.2
// Determine of life cycle callback to make if any.
if (ivCallbackKind == CallbackKind.MessageDrivenBean) {
Method m = bmd.ivEjbCreateMethod; //d453778
if (m != null) //d453778
{
// This is a 2.x MDB that has a ejbCreate method in it.
try {
if (isTraceOn && // d527372
TEBeanLifeCycleInfo.isTraceEnabled()) {
TEBeanLifeCycleInfo.traceEJBCallEntry("ejbCreate");
}
m.invoke(ivEjbInstance, new Object[] {});
} catch (InvocationTargetException itex) {
//FFDCFilter.processException(itex, CLASS_NAME + ".MessageDrivenBeanO", "96", this);
// All exceptions returned through a reflect method call
// are wrapped... making it difficult to debug a problem
// since InovcationTargetException does not print the root
// exception. Unwrap the 'target' exception so that the
// client will see it as the cause of the
// CreateFailureException. d534353.1
Throwable targetEx = itex.getCause();
if (targetEx == null)
targetEx = itex;
// MDB 2.x is allowed to throw application exceptions as well as
// javax.ejb.CreateException. Continue to wrap with a CreateFailureException
// to ensure no behavior change with prior releases.
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "MDB ejbCreate failure", targetEx);
}
throw new CreateFailureException(targetEx);
} catch (Throwable ex) {
//FFDCFilter.processException(ex, CLASS_NAME + ".MessageDrivenBeanO", "96", this);
// MDB 2.x is allowed to throw application exceptions as well as
// javax.ejb.CreateException. Continue to wrap with a CreateFailureException
// to ensure no behavior change with prior releases.
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "MDB ejbCreate failure", ex);
}
throw new CreateFailureException(ex);
} finally {
if (isTraceOn && // d527372
TEBeanLifeCycleInfo.isTraceEnabled()) {
TEBeanLifeCycleInfo.traceEJBCallExit("ejbCreate");
}
}
}
} else if (ivCallbackKind == CallbackKind.InvocationContext) {
// This is a MDB 3 that may have one or more PostConstruct interceptors
// methods. Invoke PostContruct interceptors if there is atleast 1
// PostConstruct interceptor.
try {
if (imd != null) // d402681
{
InterceptorProxy[] proxies = imd.ivPostConstructInterceptors;
if (proxies != null) {
if (isTraceOn && // d527372
TEBeanLifeCycleInfo.isTraceEnabled()) {
TEBeanLifeCycleInfo.traceEJBCallEntry("PostConstruct");
}
InvocationContextImpl<?> inv = getInvocationContext();
inv.doLifeCycle(proxies, bmd._moduleMetaData); //d450431, F743-14982
}
}
} catch (Throwable t) {
//FFDCFilter.processException(t, CLASS_NAME + ".MessageDrivenBeanO", "281", this);
// PostConstruct interceptors are allowed to throw system runtime exceptions,
// but NOT application exceptions. Therefore, wrap the caught Throwable
// in a javax.ejb.EJBException so that it gets handled as an unchecked
// exception.
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "MDB PostConstruct failure", t);
}
throw ExceptionUtil.EJBException("MDB PostConstruct failure", t);
} finally {
if (isTraceOn && // d527372
TEBeanLifeCycleInfo.isTraceEnabled() &&
imd != null &&
imd.ivPostConstructInterceptors != null) {
TEBeanLifeCycleInfo.traceEJBCallExit("PostConstruct");
}
}
} // d367572.1 end
//---------------------------------------------------------
// Now that create has completed, allow setRollbackOnly to
// be called on the SessionContext and change state to the
// POOLED state to indicate the MDB is in the method-ready
// pool state and message listener methods are now allowed to be
// invoked on this MDB.
//---------------------------------------------------------
allowRollbackOnly = true;
setState(POOLED);
} finally // d399469
{
contextHelper.complete(true);
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "initialize");
}
} | java | @Override
protected void initialize(boolean reactivate) throws RemoteException, InvocationTargetException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "initialize");
}
BeanMetaData bmd = home.beanMetaData;
ivCallbackKind = bmd.ivCallbackKind;
state = PRE_CREATE; // d159152
CallbackContextHelper contextHelper = new CallbackContextHelper(this); // d630940
try {
// Disallow setRollbackOnly until create is done.
allowRollbackOnly = false;
// Set the BeanId for this MDB. Just like we do for SLSB,
// we use the BeanId for the home bean so that the same ID
// is used for all MDB instances. Note the ivStatelessId is
// for the home bean, which is implemented as a SLSB.
if (home != null) {
setId(home.ivStatelessId); // d140003.12
}
// Note that the local transaction surrounds injection methods and
// PostConstruct lifecycle callbacks.
contextHelper.begin(CallbackContextHelper.Tx.CompatLTC,
CallbackContextHelper.Contexts.CallbackBean); // d630940
InterceptorMetaData imd = bmd.ivInterceptorMetaData;
createInterceptorsAndInstance(contextHelper);
// Now set the MessageDrivenContext and/or do the dependency injection.
// Note that dependency injection must occur while in PRE_CREATE state.
injectInstance(ivManagedObject, ivEjbInstance, this);
//---------------------------------------------------------
// Now that the MessageDrivenContext is set and/or dependencies
// injection has occured, change state to CREATING state to allow
// additional methods to be called by the ejbCreate or
// PostConstruct interceptor methods (e.g. getEJBObject).
//---------------------------------------------------------
setState(CREATING); //d399469.2
// Determine of life cycle callback to make if any.
if (ivCallbackKind == CallbackKind.MessageDrivenBean) {
Method m = bmd.ivEjbCreateMethod; //d453778
if (m != null) //d453778
{
// This is a 2.x MDB that has a ejbCreate method in it.
try {
if (isTraceOn && // d527372
TEBeanLifeCycleInfo.isTraceEnabled()) {
TEBeanLifeCycleInfo.traceEJBCallEntry("ejbCreate");
}
m.invoke(ivEjbInstance, new Object[] {});
} catch (InvocationTargetException itex) {
//FFDCFilter.processException(itex, CLASS_NAME + ".MessageDrivenBeanO", "96", this);
// All exceptions returned through a reflect method call
// are wrapped... making it difficult to debug a problem
// since InovcationTargetException does not print the root
// exception. Unwrap the 'target' exception so that the
// client will see it as the cause of the
// CreateFailureException. d534353.1
Throwable targetEx = itex.getCause();
if (targetEx == null)
targetEx = itex;
// MDB 2.x is allowed to throw application exceptions as well as
// javax.ejb.CreateException. Continue to wrap with a CreateFailureException
// to ensure no behavior change with prior releases.
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "MDB ejbCreate failure", targetEx);
}
throw new CreateFailureException(targetEx);
} catch (Throwable ex) {
//FFDCFilter.processException(ex, CLASS_NAME + ".MessageDrivenBeanO", "96", this);
// MDB 2.x is allowed to throw application exceptions as well as
// javax.ejb.CreateException. Continue to wrap with a CreateFailureException
// to ensure no behavior change with prior releases.
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "MDB ejbCreate failure", ex);
}
throw new CreateFailureException(ex);
} finally {
if (isTraceOn && // d527372
TEBeanLifeCycleInfo.isTraceEnabled()) {
TEBeanLifeCycleInfo.traceEJBCallExit("ejbCreate");
}
}
}
} else if (ivCallbackKind == CallbackKind.InvocationContext) {
// This is a MDB 3 that may have one or more PostConstruct interceptors
// methods. Invoke PostContruct interceptors if there is atleast 1
// PostConstruct interceptor.
try {
if (imd != null) // d402681
{
InterceptorProxy[] proxies = imd.ivPostConstructInterceptors;
if (proxies != null) {
if (isTraceOn && // d527372
TEBeanLifeCycleInfo.isTraceEnabled()) {
TEBeanLifeCycleInfo.traceEJBCallEntry("PostConstruct");
}
InvocationContextImpl<?> inv = getInvocationContext();
inv.doLifeCycle(proxies, bmd._moduleMetaData); //d450431, F743-14982
}
}
} catch (Throwable t) {
//FFDCFilter.processException(t, CLASS_NAME + ".MessageDrivenBeanO", "281", this);
// PostConstruct interceptors are allowed to throw system runtime exceptions,
// but NOT application exceptions. Therefore, wrap the caught Throwable
// in a javax.ejb.EJBException so that it gets handled as an unchecked
// exception.
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "MDB PostConstruct failure", t);
}
throw ExceptionUtil.EJBException("MDB PostConstruct failure", t);
} finally {
if (isTraceOn && // d527372
TEBeanLifeCycleInfo.isTraceEnabled() &&
imd != null &&
imd.ivPostConstructInterceptors != null) {
TEBeanLifeCycleInfo.traceEJBCallExit("PostConstruct");
}
}
} // d367572.1 end
//---------------------------------------------------------
// Now that create has completed, allow setRollbackOnly to
// be called on the SessionContext and change state to the
// POOLED state to indicate the MDB is in the method-ready
// pool state and message listener methods are now allowed to be
// invoked on this MDB.
//---------------------------------------------------------
allowRollbackOnly = true;
setState(POOLED);
} finally // d399469
{
contextHelper.complete(true);
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "initialize");
}
} | [
"@",
"Override",
"protected",
"void",
"initialize",
"(",
"boolean",
"reactivate",
")",
"throws",
"RemoteException",
",",
"InvocationTargetException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"initialize\"",
")",
";",
"}",
"BeanMetaData",
"bmd",
"=",
"home",
".",
"beanMetaData",
";",
"ivCallbackKind",
"=",
"bmd",
".",
"ivCallbackKind",
";",
"state",
"=",
"PRE_CREATE",
";",
"// d159152",
"CallbackContextHelper",
"contextHelper",
"=",
"new",
"CallbackContextHelper",
"(",
"this",
")",
";",
"// d630940",
"try",
"{",
"// Disallow setRollbackOnly until create is done.",
"allowRollbackOnly",
"=",
"false",
";",
"// Set the BeanId for this MDB. Just like we do for SLSB,",
"// we use the BeanId for the home bean so that the same ID",
"// is used for all MDB instances. Note the ivStatelessId is",
"// for the home bean, which is implemented as a SLSB.",
"if",
"(",
"home",
"!=",
"null",
")",
"{",
"setId",
"(",
"home",
".",
"ivStatelessId",
")",
";",
"// d140003.12",
"}",
"// Note that the local transaction surrounds injection methods and",
"// PostConstruct lifecycle callbacks.",
"contextHelper",
".",
"begin",
"(",
"CallbackContextHelper",
".",
"Tx",
".",
"CompatLTC",
",",
"CallbackContextHelper",
".",
"Contexts",
".",
"CallbackBean",
")",
";",
"// d630940",
"InterceptorMetaData",
"imd",
"=",
"bmd",
".",
"ivInterceptorMetaData",
";",
"createInterceptorsAndInstance",
"(",
"contextHelper",
")",
";",
"// Now set the MessageDrivenContext and/or do the dependency injection.",
"// Note that dependency injection must occur while in PRE_CREATE state.",
"injectInstance",
"(",
"ivManagedObject",
",",
"ivEjbInstance",
",",
"this",
")",
";",
"//---------------------------------------------------------",
"// Now that the MessageDrivenContext is set and/or dependencies",
"// injection has occured, change state to CREATING state to allow",
"// additional methods to be called by the ejbCreate or",
"// PostConstruct interceptor methods (e.g. getEJBObject).",
"//---------------------------------------------------------",
"setState",
"(",
"CREATING",
")",
";",
"//d399469.2",
"// Determine of life cycle callback to make if any.",
"if",
"(",
"ivCallbackKind",
"==",
"CallbackKind",
".",
"MessageDrivenBean",
")",
"{",
"Method",
"m",
"=",
"bmd",
".",
"ivEjbCreateMethod",
";",
"//d453778",
"if",
"(",
"m",
"!=",
"null",
")",
"//d453778",
"{",
"// This is a 2.x MDB that has a ejbCreate method in it.",
"try",
"{",
"if",
"(",
"isTraceOn",
"&&",
"// d527372",
"TEBeanLifeCycleInfo",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"TEBeanLifeCycleInfo",
".",
"traceEJBCallEntry",
"(",
"\"ejbCreate\"",
")",
";",
"}",
"m",
".",
"invoke",
"(",
"ivEjbInstance",
",",
"new",
"Object",
"[",
"]",
"{",
"}",
")",
";",
"}",
"catch",
"(",
"InvocationTargetException",
"itex",
")",
"{",
"//FFDCFilter.processException(itex, CLASS_NAME + \".MessageDrivenBeanO\", \"96\", this);",
"// All exceptions returned through a reflect method call",
"// are wrapped... making it difficult to debug a problem",
"// since InovcationTargetException does not print the root",
"// exception. Unwrap the 'target' exception so that the",
"// client will see it as the cause of the",
"// CreateFailureException. d534353.1",
"Throwable",
"targetEx",
"=",
"itex",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"targetEx",
"==",
"null",
")",
"targetEx",
"=",
"itex",
";",
"// MDB 2.x is allowed to throw application exceptions as well as",
"// javax.ejb.CreateException. Continue to wrap with a CreateFailureException",
"// to ensure no behavior change with prior releases.",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"MDB ejbCreate failure\"",
",",
"targetEx",
")",
";",
"}",
"throw",
"new",
"CreateFailureException",
"(",
"targetEx",
")",
";",
"}",
"catch",
"(",
"Throwable",
"ex",
")",
"{",
"//FFDCFilter.processException(ex, CLASS_NAME + \".MessageDrivenBeanO\", \"96\", this);",
"// MDB 2.x is allowed to throw application exceptions as well as",
"// javax.ejb.CreateException. Continue to wrap with a CreateFailureException",
"// to ensure no behavior change with prior releases.",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"MDB ejbCreate failure\"",
",",
"ex",
")",
";",
"}",
"throw",
"new",
"CreateFailureException",
"(",
"ex",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"isTraceOn",
"&&",
"// d527372",
"TEBeanLifeCycleInfo",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"TEBeanLifeCycleInfo",
".",
"traceEJBCallExit",
"(",
"\"ejbCreate\"",
")",
";",
"}",
"}",
"}",
"}",
"else",
"if",
"(",
"ivCallbackKind",
"==",
"CallbackKind",
".",
"InvocationContext",
")",
"{",
"// This is a MDB 3 that may have one or more PostConstruct interceptors",
"// methods. Invoke PostContruct interceptors if there is atleast 1",
"// PostConstruct interceptor.",
"try",
"{",
"if",
"(",
"imd",
"!=",
"null",
")",
"// d402681",
"{",
"InterceptorProxy",
"[",
"]",
"proxies",
"=",
"imd",
".",
"ivPostConstructInterceptors",
";",
"if",
"(",
"proxies",
"!=",
"null",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"// d527372",
"TEBeanLifeCycleInfo",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"TEBeanLifeCycleInfo",
".",
"traceEJBCallEntry",
"(",
"\"PostConstruct\"",
")",
";",
"}",
"InvocationContextImpl",
"<",
"?",
">",
"inv",
"=",
"getInvocationContext",
"(",
")",
";",
"inv",
".",
"doLifeCycle",
"(",
"proxies",
",",
"bmd",
".",
"_moduleMetaData",
")",
";",
"//d450431, F743-14982",
"}",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"//FFDCFilter.processException(t, CLASS_NAME + \".MessageDrivenBeanO\", \"281\", this);",
"// PostConstruct interceptors are allowed to throw system runtime exceptions,",
"// but NOT application exceptions. Therefore, wrap the caught Throwable",
"// in a javax.ejb.EJBException so that it gets handled as an unchecked",
"// exception.",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"MDB PostConstruct failure\"",
",",
"t",
")",
";",
"}",
"throw",
"ExceptionUtil",
".",
"EJBException",
"(",
"\"MDB PostConstruct failure\"",
",",
"t",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"isTraceOn",
"&&",
"// d527372",
"TEBeanLifeCycleInfo",
".",
"isTraceEnabled",
"(",
")",
"&&",
"imd",
"!=",
"null",
"&&",
"imd",
".",
"ivPostConstructInterceptors",
"!=",
"null",
")",
"{",
"TEBeanLifeCycleInfo",
".",
"traceEJBCallExit",
"(",
"\"PostConstruct\"",
")",
";",
"}",
"}",
"}",
"// d367572.1 end",
"//---------------------------------------------------------",
"// Now that create has completed, allow setRollbackOnly to",
"// be called on the SessionContext and change state to the",
"// POOLED state to indicate the MDB is in the method-ready",
"// pool state and message listener methods are now allowed to be",
"// invoked on this MDB.",
"//---------------------------------------------------------",
"allowRollbackOnly",
"=",
"true",
";",
"setState",
"(",
"POOLED",
")",
";",
"}",
"finally",
"// d399469",
"{",
"contextHelper",
".",
"complete",
"(",
"true",
")",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"initialize\"",
")",
";",
"}",
"}"
] | d399469.2 - added entire method. | [
"d399469",
".",
"2",
"-",
"added",
"entire",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/MessageDrivenBeanO.java#L111-L260 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/MessageDrivenBeanO.java | MessageDrivenBeanO.discard | @Override
public void discard() {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "discard");
}
discarded = true;
if (state == DESTROYED) {
return;
}
setState(DESTROYED);
destroyHandleList();
// Release any JCDI creational contexts that may exist. F743-29174
this.releaseManagedObjectContext();
if (pmiBean != null) {
pmiBean.discardCount(); // F743-27070
pmiBean.beanDestroyed();
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "discard");
}
} | java | @Override
public void discard() {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "discard");
}
discarded = true;
if (state == DESTROYED) {
return;
}
setState(DESTROYED);
destroyHandleList();
// Release any JCDI creational contexts that may exist. F743-29174
this.releaseManagedObjectContext();
if (pmiBean != null) {
pmiBean.discardCount(); // F743-27070
pmiBean.beanDestroyed();
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "discard");
}
} | [
"@",
"Override",
"public",
"void",
"discard",
"(",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"discard\"",
")",
";",
"}",
"discarded",
"=",
"true",
";",
"if",
"(",
"state",
"==",
"DESTROYED",
")",
"{",
"return",
";",
"}",
"setState",
"(",
"DESTROYED",
")",
";",
"destroyHandleList",
"(",
")",
";",
"// Release any JCDI creational contexts that may exist. F743-29174",
"this",
".",
"releaseManagedObjectContext",
"(",
")",
";",
"if",
"(",
"pmiBean",
"!=",
"null",
")",
"{",
"pmiBean",
".",
"discardCount",
"(",
")",
";",
"// F743-27070",
"pmiBean",
".",
"beanDestroyed",
"(",
")",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"discard\"",
")",
";",
"}",
"}"
] | 167937 - rewrote entire method. | [
"167937",
"-",
"rewrote",
"entire",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/MessageDrivenBeanO.java#L300-L328 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/MessageDrivenBeanO.java | MessageDrivenBeanO.remove | @Override
public final void remove() throws RemoteException, RemoveException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "remove");
throw new InvalidBeanOStateException(StateStrs[state], "NONE" +
": Msg Bean remove not allowed");
} | java | @Override
public final void remove() throws RemoteException, RemoveException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "remove");
throw new InvalidBeanOStateException(StateStrs[state], "NONE" +
": Msg Bean remove not allowed");
} | [
"@",
"Override",
"public",
"final",
"void",
"remove",
"(",
")",
"throws",
"RemoteException",
",",
"RemoveException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"remove\"",
")",
";",
"throw",
"new",
"InvalidBeanOStateException",
"(",
"StateStrs",
"[",
"state",
"]",
",",
"\"NONE\"",
"+",
"\": Msg Bean remove not allowed\"",
")",
";",
"}"
] | This method should never really get invoked for message driven
beans, there is no home interface on which to invoke it. | [
"This",
"method",
"should",
"never",
"really",
"get",
"invoked",
"for",
"message",
"driven",
"beans",
"there",
"is",
"no",
"home",
"interface",
"on",
"which",
"to",
"invoke",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/MessageDrivenBeanO.java#L476-L482 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/MessageDrivenBeanO.java | MessageDrivenBeanO.getIsolationLevel | @Override
public int getIsolationLevel() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getIsolationLevel : " + currentIsolationLevel);
return currentIsolationLevel;
} | java | @Override
public int getIsolationLevel() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getIsolationLevel : " + currentIsolationLevel);
return currentIsolationLevel;
} | [
"@",
"Override",
"public",
"int",
"getIsolationLevel",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getIsolationLevel : \"",
"+",
"currentIsolationLevel",
")",
";",
"return",
"currentIsolationLevel",
";",
"}"
] | Get isolation level currently associated with this session
bean instance. This is used for determining the isolation level
to use in a bean managed transaction.
The current isolation level is maintained in a stack with the
assistance of the EJSDeployedSupport instance passed to
preInvoke/postInvoke. | [
"Get",
"isolation",
"level",
"currently",
"associated",
"with",
"this",
"session",
"bean",
"instance",
".",
"This",
"is",
"used",
"for",
"determining",
"the",
"isolation",
"level",
"to",
"use",
"in",
"a",
"bean",
"managed",
"transaction",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/MessageDrivenBeanO.java#L506-L511 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/MessageDrivenBeanO.java | MessageDrivenBeanO.getUserTransaction | @Override
public synchronized UserTransaction getUserTransaction() {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getUserTransaction");
// Calling getUserTransaction is not allowed from setMessageDrivenContext
// per the EJB Specification. d159152
if ((state == PRE_CREATE)) {
IllegalStateException ise;
ise = new IllegalStateException("MessageDrivenBean: getUserTransaction " +
"not allowed from state = " +
getStateName(state));
if (isTraceOn && tc.isDebugEnabled())
Tr.exit(tc, "getUserTransaction", ise);
throw ise;
}
UserTransaction userTransactionWrapper = UserTransactionWrapper.INSTANCE; // d631349
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getUserTransaction", userTransactionWrapper);
return userTransactionWrapper;
} | java | @Override
public synchronized UserTransaction getUserTransaction() {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getUserTransaction");
// Calling getUserTransaction is not allowed from setMessageDrivenContext
// per the EJB Specification. d159152
if ((state == PRE_CREATE)) {
IllegalStateException ise;
ise = new IllegalStateException("MessageDrivenBean: getUserTransaction " +
"not allowed from state = " +
getStateName(state));
if (isTraceOn && tc.isDebugEnabled())
Tr.exit(tc, "getUserTransaction", ise);
throw ise;
}
UserTransaction userTransactionWrapper = UserTransactionWrapper.INSTANCE; // d631349
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getUserTransaction", userTransactionWrapper);
return userTransactionWrapper;
} | [
"@",
"Override",
"public",
"synchronized",
"UserTransaction",
"getUserTransaction",
"(",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getUserTransaction\"",
")",
";",
"// Calling getUserTransaction is not allowed from setMessageDrivenContext",
"// per the EJB Specification. d159152",
"if",
"(",
"(",
"state",
"==",
"PRE_CREATE",
")",
")",
"{",
"IllegalStateException",
"ise",
";",
"ise",
"=",
"new",
"IllegalStateException",
"(",
"\"MessageDrivenBean: getUserTransaction \"",
"+",
"\"not allowed from state = \"",
"+",
"getStateName",
"(",
"state",
")",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getUserTransaction\"",
",",
"ise",
")",
";",
"throw",
"ise",
";",
"}",
"UserTransaction",
"userTransactionWrapper",
"=",
"UserTransactionWrapper",
".",
"INSTANCE",
";",
"// d631349",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getUserTransaction\"",
",",
"userTransactionWrapper",
")",
";",
"return",
"userTransactionWrapper",
";",
"}"
] | Get user transaction object bean can use to demarcate transactions | [
"Get",
"user",
"transaction",
"object",
"bean",
"can",
"use",
"to",
"demarcate",
"transactions"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/MessageDrivenBeanO.java#L694-L719 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/MessageDrivenBeanO.java | MessageDrivenBeanO.getEJBHome | @Override
public EJBHome getEJBHome() //d116376
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getEJBHome");
Tr.error(tc, "METHOD_NOT_ALLOWED_CNTR0047E", "MessageDrivenBeanO.getEJBHome()");
throw new IllegalStateException("Method Not Allowed Exception: See Message-drive Bean Component Contract section of the applicable EJB Specification.");
} | java | @Override
public EJBHome getEJBHome() //d116376
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getEJBHome");
Tr.error(tc, "METHOD_NOT_ALLOWED_CNTR0047E", "MessageDrivenBeanO.getEJBHome()");
throw new IllegalStateException("Method Not Allowed Exception: See Message-drive Bean Component Contract section of the applicable EJB Specification.");
} | [
"@",
"Override",
"public",
"EJBHome",
"getEJBHome",
"(",
")",
"//d116376",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getEJBHome\"",
")",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"METHOD_NOT_ALLOWED_CNTR0047E\"",
",",
"\"MessageDrivenBeanO.getEJBHome()\"",
")",
";",
"throw",
"new",
"IllegalStateException",
"(",
"\"Method Not Allowed Exception: See Message-drive Bean Component Contract section of the applicable EJB Specification.\"",
")",
";",
"}"
] | getEJBHome - It is illegal to call this method
message-driven bean methods because there is no EJBHome object
for message-driven beans. | [
"getEJBHome",
"-",
"It",
"is",
"illegal",
"to",
"call",
"this",
"method",
"message",
"-",
"driven",
"bean",
"methods",
"because",
"there",
"is",
"no",
"EJBHome",
"object",
"for",
"message",
"-",
"driven",
"beans",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/MessageDrivenBeanO.java#L852-L859 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/MessageDrivenBeanO.java | MessageDrivenBeanO.getEJBLocalHome | @Override
public EJBLocalHome getEJBLocalHome() //d116376
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getEJBLocalHome");
Tr.error(tc, "METHOD_NOT_ALLOWED_CNTR0047E",
"MessageDrivenBeanO.getEJBLocalHome()");
throw new IllegalStateException("Method Not Allowed Exception: See Message-drive Bean Component Contract section of the applicable EJB Specification.");
} | java | @Override
public EJBLocalHome getEJBLocalHome() //d116376
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getEJBLocalHome");
Tr.error(tc, "METHOD_NOT_ALLOWED_CNTR0047E",
"MessageDrivenBeanO.getEJBLocalHome()");
throw new IllegalStateException("Method Not Allowed Exception: See Message-drive Bean Component Contract section of the applicable EJB Specification.");
} | [
"@",
"Override",
"public",
"EJBLocalHome",
"getEJBLocalHome",
"(",
")",
"//d116376",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getEJBLocalHome\"",
")",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"METHOD_NOT_ALLOWED_CNTR0047E\"",
",",
"\"MessageDrivenBeanO.getEJBLocalHome()\"",
")",
";",
"throw",
"new",
"IllegalStateException",
"(",
"\"Method Not Allowed Exception: See Message-drive Bean Component Contract section of the applicable EJB Specification.\"",
")",
";",
"}"
] | getEJBLocalHome - It is illegal to call this method
message-driven bean methods because there is no EJBLocalHome object
for message-driven beans. | [
"getEJBLocalHome",
"-",
"It",
"is",
"illegal",
"to",
"call",
"this",
"method",
"message",
"-",
"driven",
"bean",
"methods",
"because",
"there",
"is",
"no",
"EJBLocalHome",
"object",
"for",
"message",
"-",
"driven",
"beans",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/MessageDrivenBeanO.java#L866-L874 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfig.java | KeystoreConfig.updateRegistration | synchronized void updateRegistration(BundleContext ctx) {
if (registration == null) {
registration = ctx.registerService(KeystoreConfig.class, this, properties);
} else {
registration.setProperties(properties);
}
} | java | synchronized void updateRegistration(BundleContext ctx) {
if (registration == null) {
registration = ctx.registerService(KeystoreConfig.class, this, properties);
} else {
registration.setProperties(properties);
}
} | [
"synchronized",
"void",
"updateRegistration",
"(",
"BundleContext",
"ctx",
")",
"{",
"if",
"(",
"registration",
"==",
"null",
")",
"{",
"registration",
"=",
"ctx",
".",
"registerService",
"(",
"KeystoreConfig",
".",
"class",
",",
"this",
",",
"properties",
")",
";",
"}",
"else",
"{",
"registration",
".",
"setProperties",
"(",
"properties",
")",
";",
"}",
"}"
] | Register this as a service in the service registry.
Package private.
@param ctx Bundle context to register service with. | [
"Register",
"this",
"as",
"a",
"service",
"in",
"the",
"service",
"registry",
".",
"Package",
"private",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfig.java#L109-L115 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.utility/src/com/ibm/ws/security/utility/tasks/HelpTask.java | HelpTask.taskHelp | private String taskHelp(SecurityUtilityTask task) {
StringBuffer taskUsage = new StringBuffer(NL);
taskUsage.append(task.getTaskHelp());
taskUsage.append(NL);
return taskUsage.toString();
} | java | private String taskHelp(SecurityUtilityTask task) {
StringBuffer taskUsage = new StringBuffer(NL);
taskUsage.append(task.getTaskHelp());
taskUsage.append(NL);
return taskUsage.toString();
} | [
"private",
"String",
"taskHelp",
"(",
"SecurityUtilityTask",
"task",
")",
"{",
"StringBuffer",
"taskUsage",
"=",
"new",
"StringBuffer",
"(",
"NL",
")",
";",
"taskUsage",
".",
"append",
"(",
"task",
".",
"getTaskHelp",
"(",
")",
")",
";",
"taskUsage",
".",
"append",
"(",
"NL",
")",
";",
"return",
"taskUsage",
".",
"toString",
"(",
")",
";",
"}"
] | Constructs a string to represent the help for a particular task.
@param task
@return | [
"Constructs",
"a",
"string",
"to",
"represent",
"the",
"help",
"for",
"a",
"particular",
"task",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.utility/src/com/ibm/ws/security/utility/tasks/HelpTask.java#L123-L128 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ComponentAttributesMap.java | _ComponentAttributesMap.getComponentProperty | private Object getComponentProperty(_PropertyDescriptorHolder propertyDescriptor)
{
Method readMethod = propertyDescriptor.getReadMethod();
if (readMethod == null)
{
throw new IllegalArgumentException("Component property " + propertyDescriptor.getName()
+ " is not readable");
}
try
{
return readMethod.invoke(_component, EMPTY_ARGS);
}
catch (Exception e)
{
FacesContext facesContext = _component.getFacesContext();
throw new FacesException("Could not get property " + propertyDescriptor.getName() + " of component "
+ _component.getClientId(facesContext), e);
}
} | java | private Object getComponentProperty(_PropertyDescriptorHolder propertyDescriptor)
{
Method readMethod = propertyDescriptor.getReadMethod();
if (readMethod == null)
{
throw new IllegalArgumentException("Component property " + propertyDescriptor.getName()
+ " is not readable");
}
try
{
return readMethod.invoke(_component, EMPTY_ARGS);
}
catch (Exception e)
{
FacesContext facesContext = _component.getFacesContext();
throw new FacesException("Could not get property " + propertyDescriptor.getName() + " of component "
+ _component.getClientId(facesContext), e);
}
} | [
"private",
"Object",
"getComponentProperty",
"(",
"_PropertyDescriptorHolder",
"propertyDescriptor",
")",
"{",
"Method",
"readMethod",
"=",
"propertyDescriptor",
".",
"getReadMethod",
"(",
")",
";",
"if",
"(",
"readMethod",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Component property \"",
"+",
"propertyDescriptor",
".",
"getName",
"(",
")",
"+",
"\" is not readable\"",
")",
";",
"}",
"try",
"{",
"return",
"readMethod",
".",
"invoke",
"(",
"_component",
",",
"EMPTY_ARGS",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"FacesContext",
"facesContext",
"=",
"_component",
".",
"getFacesContext",
"(",
")",
";",
"throw",
"new",
"FacesException",
"(",
"\"Could not get property \"",
"+",
"propertyDescriptor",
".",
"getName",
"(",
")",
"+",
"\" of component \"",
"+",
"_component",
".",
"getClientId",
"(",
"facesContext",
")",
",",
"e",
")",
";",
"}",
"}"
] | Execute the getter method of the specified property on the underlying
component.
@param propertyDescriptor specifies which property to read.
@return the value returned by the getter method.
@throws IllegalArgumentException if the property is not readable.
@throws FacesException if any other problem occurs while invoking
the getter method. | [
"Execute",
"the",
"getter",
"method",
"of",
"the",
"specified",
"property",
"on",
"the",
"underlying",
"component",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ComponentAttributesMap.java#L676-L694 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ComponentAttributesMap.java | _ComponentAttributesMap.setComponentProperty | private void setComponentProperty(_PropertyDescriptorHolder propertyDescriptor, Object value)
{
Method writeMethod = propertyDescriptor.getWriteMethod();
if (writeMethod == null)
{
throw new IllegalArgumentException("Component property " + propertyDescriptor.getName()
+ " is not writable");
}
try
{
writeMethod.invoke(_component, new Object[]{value});
}
catch (Exception e)
{
FacesContext facesContext = _component.getFacesContext();
throw new FacesException("Could not set property " + propertyDescriptor.getName() +
" of component " + _component.getClientId(facesContext) + " to value : " + value + " with type : " +
(value == null ? "null" : value.getClass().getName()), e);
}
} | java | private void setComponentProperty(_PropertyDescriptorHolder propertyDescriptor, Object value)
{
Method writeMethod = propertyDescriptor.getWriteMethod();
if (writeMethod == null)
{
throw new IllegalArgumentException("Component property " + propertyDescriptor.getName()
+ " is not writable");
}
try
{
writeMethod.invoke(_component, new Object[]{value});
}
catch (Exception e)
{
FacesContext facesContext = _component.getFacesContext();
throw new FacesException("Could not set property " + propertyDescriptor.getName() +
" of component " + _component.getClientId(facesContext) + " to value : " + value + " with type : " +
(value == null ? "null" : value.getClass().getName()), e);
}
} | [
"private",
"void",
"setComponentProperty",
"(",
"_PropertyDescriptorHolder",
"propertyDescriptor",
",",
"Object",
"value",
")",
"{",
"Method",
"writeMethod",
"=",
"propertyDescriptor",
".",
"getWriteMethod",
"(",
")",
";",
"if",
"(",
"writeMethod",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Component property \"",
"+",
"propertyDescriptor",
".",
"getName",
"(",
")",
"+",
"\" is not writable\"",
")",
";",
"}",
"try",
"{",
"writeMethod",
".",
"invoke",
"(",
"_component",
",",
"new",
"Object",
"[",
"]",
"{",
"value",
"}",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"FacesContext",
"facesContext",
"=",
"_component",
".",
"getFacesContext",
"(",
")",
";",
"throw",
"new",
"FacesException",
"(",
"\"Could not set property \"",
"+",
"propertyDescriptor",
".",
"getName",
"(",
")",
"+",
"\" of component \"",
"+",
"_component",
".",
"getClientId",
"(",
"facesContext",
")",
"+",
"\" to value : \"",
"+",
"value",
"+",
"\" with type : \"",
"+",
"(",
"value",
"==",
"null",
"?",
"\"null\"",
":",
"value",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"}"
] | Execute the setter method of the specified property on the underlying
component.
@param propertyDescriptor specifies which property to write.
@throws IllegalArgumentException if the property is not writable.
@throws FacesException if any other problem occurs while invoking
the getter method. | [
"Execute",
"the",
"setter",
"method",
"of",
"the",
"specified",
"property",
"on",
"the",
"underlying",
"component",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ComponentAttributesMap.java#L705-L724 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/metadata/builder/EndpointInfoBuilder.java | EndpointInfoBuilder.build | public EndpointInfo build(EndpointInfoBuilderContext ctx, String serviceImplBeanClassName, EndpointType endpointType) throws UnableToAdaptException {
EndpointInfo endpointInfo = new EndpointInfo(serviceImplBeanClassName, endpointType);
endpointInfo.setBeanName((String) ctx.getContextEnv(JaxWsConstants.ENV_ATTRIBUTE_ENDPOINT_BEAN_NAME));
endpointInfo.setServletName((String) ctx.getContextEnv(JaxWsConstants.ENV_ATTRIBUTE_ENDPOINT_SERVLET_NAME));
invokeConfigurators(ctx, ConfigMethod.PREPARE, endpointInfo);
invokeConfigurators(ctx, ConfigMethod.CONFIG, endpointInfo);
validate(ctx, endpointInfo);
ctx.clearContextEnv();
return endpointInfo;
} | java | public EndpointInfo build(EndpointInfoBuilderContext ctx, String serviceImplBeanClassName, EndpointType endpointType) throws UnableToAdaptException {
EndpointInfo endpointInfo = new EndpointInfo(serviceImplBeanClassName, endpointType);
endpointInfo.setBeanName((String) ctx.getContextEnv(JaxWsConstants.ENV_ATTRIBUTE_ENDPOINT_BEAN_NAME));
endpointInfo.setServletName((String) ctx.getContextEnv(JaxWsConstants.ENV_ATTRIBUTE_ENDPOINT_SERVLET_NAME));
invokeConfigurators(ctx, ConfigMethod.PREPARE, endpointInfo);
invokeConfigurators(ctx, ConfigMethod.CONFIG, endpointInfo);
validate(ctx, endpointInfo);
ctx.clearContextEnv();
return endpointInfo;
} | [
"public",
"EndpointInfo",
"build",
"(",
"EndpointInfoBuilderContext",
"ctx",
",",
"String",
"serviceImplBeanClassName",
",",
"EndpointType",
"endpointType",
")",
"throws",
"UnableToAdaptException",
"{",
"EndpointInfo",
"endpointInfo",
"=",
"new",
"EndpointInfo",
"(",
"serviceImplBeanClassName",
",",
"endpointType",
")",
";",
"endpointInfo",
".",
"setBeanName",
"(",
"(",
"String",
")",
"ctx",
".",
"getContextEnv",
"(",
"JaxWsConstants",
".",
"ENV_ATTRIBUTE_ENDPOINT_BEAN_NAME",
")",
")",
";",
"endpointInfo",
".",
"setServletName",
"(",
"(",
"String",
")",
"ctx",
".",
"getContextEnv",
"(",
"JaxWsConstants",
".",
"ENV_ATTRIBUTE_ENDPOINT_SERVLET_NAME",
")",
")",
";",
"invokeConfigurators",
"(",
"ctx",
",",
"ConfigMethod",
".",
"PREPARE",
",",
"endpointInfo",
")",
";",
"invokeConfigurators",
"(",
"ctx",
",",
"ConfigMethod",
".",
"CONFIG",
",",
"endpointInfo",
")",
";",
"validate",
"(",
"ctx",
",",
"endpointInfo",
")",
";",
"ctx",
".",
"clearContextEnv",
"(",
")",
";",
"return",
"endpointInfo",
";",
"}"
] | build the endpointInfo
@param ctx
@return
@throws Exception | [
"build",
"the",
"endpointInfo"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/metadata/builder/EndpointInfoBuilder.java#L88-L102 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.collector.manager/src/com/ibm/ws/collector/manager/internal/SourceManager.java | SourceManager.addSubscriber | public void addSubscriber(Handler handler) {
String handlerId = CollectorManagerUtils.getHandlerId(handler);
//temporary exception for audit Source //must change later
if (source.getSourceName().trim().equals("audit") && subscribers.isEmpty()) {
//First subscriber, assign a buffer.
bufferMgr = new BufferManagerImpl(BUFFER_SIZE, sourceId, false);
//Inform the source that a buffer is now available
//and it can start sending events to this buffer.
source.setBufferManager(this.bufferMgr);
}
subscribers.add(handlerId);
/*
* Inform the handler that this source/buffer/conduit is now available:
* Synchronous Handler - Add handler as synchronous handler to the Buffer/Conduit's sync handler set
* Asynchronous Handler - Add handler as asynchronous handler into the Buffer/Conduit
*
*/
if (handler instanceof SynchronousHandler) {
bufferMgr.addSyncHandler((SynchronousHandler) handler);
} else {
bufferMgr.addHandler(handlerId);
}
} | java | public void addSubscriber(Handler handler) {
String handlerId = CollectorManagerUtils.getHandlerId(handler);
//temporary exception for audit Source //must change later
if (source.getSourceName().trim().equals("audit") && subscribers.isEmpty()) {
//First subscriber, assign a buffer.
bufferMgr = new BufferManagerImpl(BUFFER_SIZE, sourceId, false);
//Inform the source that a buffer is now available
//and it can start sending events to this buffer.
source.setBufferManager(this.bufferMgr);
}
subscribers.add(handlerId);
/*
* Inform the handler that this source/buffer/conduit is now available:
* Synchronous Handler - Add handler as synchronous handler to the Buffer/Conduit's sync handler set
* Asynchronous Handler - Add handler as asynchronous handler into the Buffer/Conduit
*
*/
if (handler instanceof SynchronousHandler) {
bufferMgr.addSyncHandler((SynchronousHandler) handler);
} else {
bufferMgr.addHandler(handlerId);
}
} | [
"public",
"void",
"addSubscriber",
"(",
"Handler",
"handler",
")",
"{",
"String",
"handlerId",
"=",
"CollectorManagerUtils",
".",
"getHandlerId",
"(",
"handler",
")",
";",
"//temporary exception for audit Source //must change later",
"if",
"(",
"source",
".",
"getSourceName",
"(",
")",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"\"audit\"",
")",
"&&",
"subscribers",
".",
"isEmpty",
"(",
")",
")",
"{",
"//First subscriber, assign a buffer.",
"bufferMgr",
"=",
"new",
"BufferManagerImpl",
"(",
"BUFFER_SIZE",
",",
"sourceId",
",",
"false",
")",
";",
"//Inform the source that a buffer is now available",
"//and it can start sending events to this buffer.",
"source",
".",
"setBufferManager",
"(",
"this",
".",
"bufferMgr",
")",
";",
"}",
"subscribers",
".",
"add",
"(",
"handlerId",
")",
";",
"/*\n * Inform the handler that this source/buffer/conduit is now available:\n * Synchronous Handler - Add handler as synchronous handler to the Buffer/Conduit's sync handler set\n * Asynchronous Handler - Add handler as asynchronous handler into the Buffer/Conduit\n *\n */",
"if",
"(",
"handler",
"instanceof",
"SynchronousHandler",
")",
"{",
"bufferMgr",
".",
"addSyncHandler",
"(",
"(",
"SynchronousHandler",
")",
"handler",
")",
";",
"}",
"else",
"{",
"bufferMgr",
".",
"addHandler",
"(",
"handlerId",
")",
";",
"}",
"}"
] | Method to add a subscriber to the source
Source manager will allocate a buffer when the source has
atleast one subscriber.
@param handler The handler that is to be added as subscriber | [
"Method",
"to",
"add",
"a",
"subscriber",
"to",
"the",
"source",
"Source",
"manager",
"will",
"allocate",
"a",
"buffer",
"when",
"the",
"source",
"has",
"atleast",
"one",
"subscriber",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.collector.manager/src/com/ibm/ws/collector/manager/internal/SourceManager.java#L84-L108 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.collector.manager/src/com/ibm/ws/collector/manager/internal/SourceManager.java | SourceManager.removeSubscriber | public boolean removeSubscriber(Handler handler) {
String handlerId = CollectorManagerUtils.getHandlerId(handler);
subscribers.remove(handlerId);
/*
* Inform the handler that this source/buffer will no longer be available:
* Synchronous Handler: Remove the synchronous handler from the Buffer/Conduit's sync handler set
* Asynchronous Handler: Remove the asynchronous handler from the the Buffer/Conduit
*/
if (handler instanceof SynchronousHandler) {
bufferMgr.removeSyncHandler((SynchronousHandler) handler);
} else {
bufferMgr.removeHandler(handlerId);
}
if (subscribers.isEmpty()) {
/*
* Can not set bufferMgr to null (in here or in the source )if this SrcMgr belongs
* to LogSource or TraceSource
*/
if (!sourceId.contains(CollectorConstants.MESSAGES_SOURCE) && !sourceId.contains(CollectorConstants.TRACE_SOURCE)) {
/*
* Last subscriber, unassign the buffer
* Inform the source that buffer will no longer be available
* and it should stop sending events to this buffer.
*/
source.unsetBufferManager(bufferMgr);
bufferMgr = null;
}
return true;
}
return false;
} | java | public boolean removeSubscriber(Handler handler) {
String handlerId = CollectorManagerUtils.getHandlerId(handler);
subscribers.remove(handlerId);
/*
* Inform the handler that this source/buffer will no longer be available:
* Synchronous Handler: Remove the synchronous handler from the Buffer/Conduit's sync handler set
* Asynchronous Handler: Remove the asynchronous handler from the the Buffer/Conduit
*/
if (handler instanceof SynchronousHandler) {
bufferMgr.removeSyncHandler((SynchronousHandler) handler);
} else {
bufferMgr.removeHandler(handlerId);
}
if (subscribers.isEmpty()) {
/*
* Can not set bufferMgr to null (in here or in the source )if this SrcMgr belongs
* to LogSource or TraceSource
*/
if (!sourceId.contains(CollectorConstants.MESSAGES_SOURCE) && !sourceId.contains(CollectorConstants.TRACE_SOURCE)) {
/*
* Last subscriber, unassign the buffer
* Inform the source that buffer will no longer be available
* and it should stop sending events to this buffer.
*/
source.unsetBufferManager(bufferMgr);
bufferMgr = null;
}
return true;
}
return false;
} | [
"public",
"boolean",
"removeSubscriber",
"(",
"Handler",
"handler",
")",
"{",
"String",
"handlerId",
"=",
"CollectorManagerUtils",
".",
"getHandlerId",
"(",
"handler",
")",
";",
"subscribers",
".",
"remove",
"(",
"handlerId",
")",
";",
"/*\n * Inform the handler that this source/buffer will no longer be available:\n * Synchronous Handler: Remove the synchronous handler from the Buffer/Conduit's sync handler set\n * Asynchronous Handler: Remove the asynchronous handler from the the Buffer/Conduit\n */",
"if",
"(",
"handler",
"instanceof",
"SynchronousHandler",
")",
"{",
"bufferMgr",
".",
"removeSyncHandler",
"(",
"(",
"SynchronousHandler",
")",
"handler",
")",
";",
"}",
"else",
"{",
"bufferMgr",
".",
"removeHandler",
"(",
"handlerId",
")",
";",
"}",
"if",
"(",
"subscribers",
".",
"isEmpty",
"(",
")",
")",
"{",
"/*\n * Can not set bufferMgr to null (in here or in the source )if this SrcMgr belongs\n * to LogSource or TraceSource\n */",
"if",
"(",
"!",
"sourceId",
".",
"contains",
"(",
"CollectorConstants",
".",
"MESSAGES_SOURCE",
")",
"&&",
"!",
"sourceId",
".",
"contains",
"(",
"CollectorConstants",
".",
"TRACE_SOURCE",
")",
")",
"{",
"/*\n * Last subscriber, unassign the buffer\n * Inform the source that buffer will no longer be available\n * and it should stop sending events to this buffer.\n */",
"source",
".",
"unsetBufferManager",
"(",
"bufferMgr",
")",
";",
"bufferMgr",
"=",
"null",
";",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Method to remove a subscriber from the source
Source manager deallocate BufferManager when last subscriber goes away
@param handler The handler that is to be removed as subscriber
@return a boolean to indicate whether last subscriber has been removed, true for yes false for no | [
"Method",
"to",
"remove",
"a",
"subscriber",
"from",
"the",
"source",
"Source",
"manager",
"deallocate",
"BufferManager",
"when",
"last",
"subscriber",
"goes",
"away"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.collector.manager/src/com/ibm/ws/collector/manager/internal/SourceManager.java#L117-L149 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/JwtTokenException.java | JwtTokenException.handleFfdc | public void handleFfdc() {
if (!bFfdcAlready) {
com.ibm.ws.ffdc.FFDCFilter.processException(this, "com.ibm.websphere.security.jwt.JwtTokenException", "155", this);
bFfdcAlready = true;
}
} | java | public void handleFfdc() {
if (!bFfdcAlready) {
com.ibm.ws.ffdc.FFDCFilter.processException(this, "com.ibm.websphere.security.jwt.JwtTokenException", "155", this);
bFfdcAlready = true;
}
} | [
"public",
"void",
"handleFfdc",
"(",
")",
"{",
"if",
"(",
"!",
"bFfdcAlready",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"ffdc",
".",
"FFDCFilter",
".",
"processException",
"(",
"this",
",",
"\"com.ibm.websphere.security.jwt.JwtTokenException\"",
",",
"\"155\"",
",",
"this",
")",
";",
"bFfdcAlready",
"=",
"true",
";",
"}",
"}"
] | in case we need to do the ffdc | [
"in",
"case",
"we",
"need",
"to",
"do",
"the",
"ffdc"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/JwtTokenException.java#L152-L157 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/impl/ResponseImpl.java | ResponseImpl.toListOfStrings | private List<String> toListOfStrings(String headerName, List<Object> values) {
if (values == null) {
return null;
}
List<String> stringValues = new ArrayList<>(values.size());
HeaderDelegate<Object> hd = HttpUtils.getHeaderDelegate(values.get(0));
for (Object value : values) {
String actualValue = hd == null ? value.toString() : hd.toString(value);
stringValues.add(actualValue);
}
return stringValues;
} | java | private List<String> toListOfStrings(String headerName, List<Object> values) {
if (values == null) {
return null;
}
List<String> stringValues = new ArrayList<>(values.size());
HeaderDelegate<Object> hd = HttpUtils.getHeaderDelegate(values.get(0));
for (Object value : values) {
String actualValue = hd == null ? value.toString() : hd.toString(value);
stringValues.add(actualValue);
}
return stringValues;
} | [
"private",
"List",
"<",
"String",
">",
"toListOfStrings",
"(",
"String",
"headerName",
",",
"List",
"<",
"Object",
">",
"values",
")",
"{",
"if",
"(",
"values",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"List",
"<",
"String",
">",
"stringValues",
"=",
"new",
"ArrayList",
"<>",
"(",
"values",
".",
"size",
"(",
")",
")",
";",
"HeaderDelegate",
"<",
"Object",
">",
"hd",
"=",
"HttpUtils",
".",
"getHeaderDelegate",
"(",
"values",
".",
"get",
"(",
"0",
")",
")",
";",
"for",
"(",
"Object",
"value",
":",
"values",
")",
"{",
"String",
"actualValue",
"=",
"hd",
"==",
"null",
"?",
"value",
".",
"toString",
"(",
")",
":",
"hd",
".",
"toString",
"(",
"value",
")",
";",
"stringValues",
".",
"add",
"(",
"actualValue",
")",
";",
"}",
"return",
"stringValues",
";",
"}"
] | This conversion is needed as some values may not be Strings | [
"This",
"conversion",
"is",
"needed",
"as",
"some",
"values",
"may",
"not",
"be",
"Strings"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/impl/ResponseImpl.java#L224-L235 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/impl/ResponseImpl.java | ResponseImpl.doReadEntity | public <T> T doReadEntity(Class<T> cls, Type t, Annotation[] anns) throws ProcessingException, IllegalStateException {
return doReadEntity(cls, t, anns, false);
} | java | public <T> T doReadEntity(Class<T> cls, Type t, Annotation[] anns) throws ProcessingException, IllegalStateException {
return doReadEntity(cls, t, anns, false);
} | [
"public",
"<",
"T",
">",
"T",
"doReadEntity",
"(",
"Class",
"<",
"T",
">",
"cls",
",",
"Type",
"t",
",",
"Annotation",
"[",
"]",
"anns",
")",
"throws",
"ProcessingException",
",",
"IllegalStateException",
"{",
"return",
"doReadEntity",
"(",
"cls",
",",
"t",
",",
"anns",
",",
"false",
")",
";",
"}"
] | convenience method for classes that have not been overwritten with liberty-specific changes | [
"convenience",
"method",
"for",
"classes",
"that",
"have",
"not",
"been",
"overwritten",
"with",
"liberty",
"-",
"specific",
"changes"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/impl/ResponseImpl.java#L392-L394 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.javaee.ddmodel/src/com/ibm/ws/javaee/ddmodel/DDReader.java | DDReader.read | public static String read(Container container, String ddPath) {
if (container == null || ddPath == null) {
return "";
}
Entry entry = container.getEntry(ddPath);
if (entry == null) {
throw new IllegalStateException(ddPath);
}
InputStream input;
try {
input = entry.adapt(InputStream.class);
} catch (UnableToAdaptException e) {
throw new IllegalStateException(e);
}
try {
SAXParserFactory parserFactory = SAXParserFactory.newInstance();
SAXParser parser = parserFactory.newSAXParser();
XMLReader xmlReader = parser.getXMLReader();
xmlReader.setEntityResolver(new EntityResolver() {
@Override
public InputSource resolveEntity(String arg0, String arg1) throws SAXException, IOException {
return new InputSource(new ByteArrayInputStream(new byte[0]));
}
});
Source saxSource = new SAXSource(xmlReader, new InputSource(input));
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
StringWriter writer = new StringWriter();
Result result = new StreamResult(writer);
transformer.transform(saxSource, result);
return writer.toString();
} catch (ParserConfigurationException e) {
throw new IllegalStateException(e);
} catch (SAXException e) {
throw new IllegalStateException(e);
} catch (TransformerConfigurationException e) {
throw new IllegalStateException(e);
} catch (TransformerException e) {
throw new IllegalStateException(e);
} finally {
try {
input.close();
} catch (IOException e) {
}
}
} | java | public static String read(Container container, String ddPath) {
if (container == null || ddPath == null) {
return "";
}
Entry entry = container.getEntry(ddPath);
if (entry == null) {
throw new IllegalStateException(ddPath);
}
InputStream input;
try {
input = entry.adapt(InputStream.class);
} catch (UnableToAdaptException e) {
throw new IllegalStateException(e);
}
try {
SAXParserFactory parserFactory = SAXParserFactory.newInstance();
SAXParser parser = parserFactory.newSAXParser();
XMLReader xmlReader = parser.getXMLReader();
xmlReader.setEntityResolver(new EntityResolver() {
@Override
public InputSource resolveEntity(String arg0, String arg1) throws SAXException, IOException {
return new InputSource(new ByteArrayInputStream(new byte[0]));
}
});
Source saxSource = new SAXSource(xmlReader, new InputSource(input));
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
StringWriter writer = new StringWriter();
Result result = new StreamResult(writer);
transformer.transform(saxSource, result);
return writer.toString();
} catch (ParserConfigurationException e) {
throw new IllegalStateException(e);
} catch (SAXException e) {
throw new IllegalStateException(e);
} catch (TransformerConfigurationException e) {
throw new IllegalStateException(e);
} catch (TransformerException e) {
throw new IllegalStateException(e);
} finally {
try {
input.close();
} catch (IOException e) {
}
}
} | [
"public",
"static",
"String",
"read",
"(",
"Container",
"container",
",",
"String",
"ddPath",
")",
"{",
"if",
"(",
"container",
"==",
"null",
"||",
"ddPath",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"Entry",
"entry",
"=",
"container",
".",
"getEntry",
"(",
"ddPath",
")",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"ddPath",
")",
";",
"}",
"InputStream",
"input",
";",
"try",
"{",
"input",
"=",
"entry",
".",
"adapt",
"(",
"InputStream",
".",
"class",
")",
";",
"}",
"catch",
"(",
"UnableToAdaptException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"try",
"{",
"SAXParserFactory",
"parserFactory",
"=",
"SAXParserFactory",
".",
"newInstance",
"(",
")",
";",
"SAXParser",
"parser",
"=",
"parserFactory",
".",
"newSAXParser",
"(",
")",
";",
"XMLReader",
"xmlReader",
"=",
"parser",
".",
"getXMLReader",
"(",
")",
";",
"xmlReader",
".",
"setEntityResolver",
"(",
"new",
"EntityResolver",
"(",
")",
"{",
"@",
"Override",
"public",
"InputSource",
"resolveEntity",
"(",
"String",
"arg0",
",",
"String",
"arg1",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"return",
"new",
"InputSource",
"(",
"new",
"ByteArrayInputStream",
"(",
"new",
"byte",
"[",
"0",
"]",
")",
")",
";",
"}",
"}",
")",
";",
"Source",
"saxSource",
"=",
"new",
"SAXSource",
"(",
"xmlReader",
",",
"new",
"InputSource",
"(",
"input",
")",
")",
";",
"TransformerFactory",
"transformerFactory",
"=",
"TransformerFactory",
".",
"newInstance",
"(",
")",
";",
"Transformer",
"transformer",
"=",
"transformerFactory",
".",
"newTransformer",
"(",
")",
";",
"StringWriter",
"writer",
"=",
"new",
"StringWriter",
"(",
")",
";",
"Result",
"result",
"=",
"new",
"StreamResult",
"(",
"writer",
")",
";",
"transformer",
".",
"transform",
"(",
"saxSource",
",",
"result",
")",
";",
"return",
"writer",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"ParserConfigurationException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"SAXException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"TransformerConfigurationException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"TransformerException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"input",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"}",
"}"
] | Read a deployment descriptor into a string.
@param container the module container
@param ddPath the deployment descriptor path
@return the deployment descriptor as a string, or the empty string if there was no deployment descriptor
@throws IllegalStateException if an unexpected error occurs | [
"Read",
"a",
"deployment",
"descriptor",
"into",
"a",
"string",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javaee.ddmodel/src/com/ibm/ws/javaee/ddmodel/DDReader.java#L48-L98 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/AppMessageHelper.java | AppMessageHelper.audit | public void audit(String key, Object... params) {
Tr.audit(tc, key, params);
} | java | public void audit(String key, Object... params) {
Tr.audit(tc, key, params);
} | [
"public",
"void",
"audit",
"(",
"String",
"key",
",",
"Object",
"...",
"params",
")",
"{",
"Tr",
".",
"audit",
"(",
"tc",
",",
"key",
",",
"params",
")",
";",
"}"
] | Log an audit message.
@param key message key for the application manager messages file.
@param params message parameters. | [
"Log",
"an",
"audit",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/AppMessageHelper.java#L37-L39 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/AppMessageHelper.java | AppMessageHelper.formatMessage | public String formatMessage(String key, Object... params) {
return Tr.formatMessage(tc, key, params);
} | java | public String formatMessage(String key, Object... params) {
return Tr.formatMessage(tc, key, params);
} | [
"public",
"String",
"formatMessage",
"(",
"String",
"key",
",",
"Object",
"...",
"params",
")",
"{",
"return",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"key",
",",
"params",
")",
";",
"}"
] | Format a message.
@param key message key for the application manager messages file.
@param params message parameters.
@return the translated message. | [
"Format",
"a",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/AppMessageHelper.java#L48-L50 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/AppMessageHelper.java | AppMessageHelper.info | public void info(String key, Object... params) {
Tr.info(tc, key, params);
} | java | public void info(String key, Object... params) {
Tr.info(tc, key, params);
} | [
"public",
"void",
"info",
"(",
"String",
"key",
",",
"Object",
"...",
"params",
")",
"{",
"Tr",
".",
"info",
"(",
"tc",
",",
"key",
",",
"params",
")",
";",
"}"
] | Log an informational message.
@param key message key for the application manager messages file.
@param params message parameters. | [
"Log",
"an",
"informational",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/AppMessageHelper.java#L79-L81 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java | JmsJcaManagedConnection.getConnection | @Override
final public Object getConnection(final Subject requestSubject,
final ConnectionRequestInfo requestInfo) throws ResourceException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "getConnection", new Object[] {
subjectToString(requestSubject), requestInfo });
}
// Ensure that the credentials for this request match those passed to
// the constructor (as we don't support reauthentication)
final JmsJcaUserDetails requestUserDetails = _managedConnectionFactory
.getUserDetails(requestSubject, requestInfo);
if (_userDetails != null) {
if (!(_userDetails.equals(requestUserDetails))) {
throw new ResourceException(NLS.getFormattedMessage(
("AUTHENTICATION_ERROR_CWSJR1103"), new Object[] {
"JmsJcaManagedConnection.getConnection",
_userDetails.getUserName(),
(requestUserDetails == null) ? null
: requestUserDetails.getUserName() },
null));
}
} else {
if (!(_subject.equals(requestSubject))) {
throw new ResourceException(
NLS
.getFormattedMessage(
("AUTHENTICATION_ERROR_CWSJR1117"),
new Object[] { "JmsJcaManagedConnection.getConnection" },
null));
}
}
JmsJcaSessionImpl session = null;
if (requestInfo == null || requestInfo instanceof JmsJcaConnectionRequestInfo) {
session = new JmsJcaSessionImpl(this, (JmsJcaConnectionRequestInfo) requestInfo);
_sessions.add(session);
} else {
throw new ResourceAdapterInternalException(NLS.getFormattedMessage(
("EXCEPTION_RECEIVED_CWSJR1101"), new Object[] {
"getConnection",
JmsJcaConnectionRequestInfo.class.getName(),
requestInfo.getClass().getName() }, null));
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "getConnection", session);
}
return session;
} | java | @Override
final public Object getConnection(final Subject requestSubject,
final ConnectionRequestInfo requestInfo) throws ResourceException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "getConnection", new Object[] {
subjectToString(requestSubject), requestInfo });
}
// Ensure that the credentials for this request match those passed to
// the constructor (as we don't support reauthentication)
final JmsJcaUserDetails requestUserDetails = _managedConnectionFactory
.getUserDetails(requestSubject, requestInfo);
if (_userDetails != null) {
if (!(_userDetails.equals(requestUserDetails))) {
throw new ResourceException(NLS.getFormattedMessage(
("AUTHENTICATION_ERROR_CWSJR1103"), new Object[] {
"JmsJcaManagedConnection.getConnection",
_userDetails.getUserName(),
(requestUserDetails == null) ? null
: requestUserDetails.getUserName() },
null));
}
} else {
if (!(_subject.equals(requestSubject))) {
throw new ResourceException(
NLS
.getFormattedMessage(
("AUTHENTICATION_ERROR_CWSJR1117"),
new Object[] { "JmsJcaManagedConnection.getConnection" },
null));
}
}
JmsJcaSessionImpl session = null;
if (requestInfo == null || requestInfo instanceof JmsJcaConnectionRequestInfo) {
session = new JmsJcaSessionImpl(this, (JmsJcaConnectionRequestInfo) requestInfo);
_sessions.add(session);
} else {
throw new ResourceAdapterInternalException(NLS.getFormattedMessage(
("EXCEPTION_RECEIVED_CWSJR1101"), new Object[] {
"getConnection",
JmsJcaConnectionRequestInfo.class.getName(),
requestInfo.getClass().getName() }, null));
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "getConnection", session);
}
return session;
} | [
"@",
"Override",
"final",
"public",
"Object",
"getConnection",
"(",
"final",
"Subject",
"requestSubject",
",",
"final",
"ConnectionRequestInfo",
"requestInfo",
")",
"throws",
"ResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"\"getConnection\"",
",",
"new",
"Object",
"[",
"]",
"{",
"subjectToString",
"(",
"requestSubject",
")",
",",
"requestInfo",
"}",
")",
";",
"}",
"// Ensure that the credentials for this request match those passed to",
"// the constructor (as we don't support reauthentication)",
"final",
"JmsJcaUserDetails",
"requestUserDetails",
"=",
"_managedConnectionFactory",
".",
"getUserDetails",
"(",
"requestSubject",
",",
"requestInfo",
")",
";",
"if",
"(",
"_userDetails",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"_userDetails",
".",
"equals",
"(",
"requestUserDetails",
")",
")",
")",
"{",
"throw",
"new",
"ResourceException",
"(",
"NLS",
".",
"getFormattedMessage",
"(",
"(",
"\"AUTHENTICATION_ERROR_CWSJR1103\"",
")",
",",
"new",
"Object",
"[",
"]",
"{",
"\"JmsJcaManagedConnection.getConnection\"",
",",
"_userDetails",
".",
"getUserName",
"(",
")",
",",
"(",
"requestUserDetails",
"==",
"null",
")",
"?",
"null",
":",
"requestUserDetails",
".",
"getUserName",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"(",
"_subject",
".",
"equals",
"(",
"requestSubject",
")",
")",
")",
"{",
"throw",
"new",
"ResourceException",
"(",
"NLS",
".",
"getFormattedMessage",
"(",
"(",
"\"AUTHENTICATION_ERROR_CWSJR1117\"",
")",
",",
"new",
"Object",
"[",
"]",
"{",
"\"JmsJcaManagedConnection.getConnection\"",
"}",
",",
"null",
")",
")",
";",
"}",
"}",
"JmsJcaSessionImpl",
"session",
"=",
"null",
";",
"if",
"(",
"requestInfo",
"==",
"null",
"||",
"requestInfo",
"instanceof",
"JmsJcaConnectionRequestInfo",
")",
"{",
"session",
"=",
"new",
"JmsJcaSessionImpl",
"(",
"this",
",",
"(",
"JmsJcaConnectionRequestInfo",
")",
"requestInfo",
")",
";",
"_sessions",
".",
"add",
"(",
"session",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"ResourceAdapterInternalException",
"(",
"NLS",
".",
"getFormattedMessage",
"(",
"(",
"\"EXCEPTION_RECEIVED_CWSJR1101\"",
")",
",",
"new",
"Object",
"[",
"]",
"{",
"\"getConnection\"",
",",
"JmsJcaConnectionRequestInfo",
".",
"class",
".",
"getName",
"(",
")",
",",
"requestInfo",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"\"getConnection\"",
",",
"session",
")",
";",
"}",
"return",
"session",
";",
"}"
] | Creates a session handle to this managed connection. The request
information will, by now, contain a connection handle. This is passed,
along with this managed connection, on the construction of the new
session.
@param requestSubject
the container provided subject, if any
@param requestInfo
the application request information
@return the connection
@throws ResourceException
generic exception | [
"Creates",
"a",
"session",
"handle",
"to",
"this",
"managed",
"connection",
".",
"The",
"request",
"information",
"will",
"by",
"now",
"contain",
"a",
"connection",
"handle",
".",
"This",
"is",
"passed",
"along",
"with",
"this",
"managed",
"connection",
"on",
"the",
"construction",
"of",
"the",
"new",
"session",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java#L205-L269 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java | JmsJcaManagedConnection.destroy | @Override
final public void destroy() throws ResourceException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "destroy");
}
// Invalidate all of the sessions
for (final Iterator iterator = _sessions.iterator(); iterator.hasNext();) {
final Object object = iterator.next();
if (object instanceof JmsJcaSessionImpl) {
final JmsJcaSessionImpl session = (JmsJcaSessionImpl) object;
session.invalidate();
}
}
// Empty the set
_sessions.clear();
try {
// Deregister the connection listener
_coreConnection.removeConnectionListener(_connectionListener);
// Close the core connection
// when destroy calls close connections then connection cannot be reset for future usage so force close by passing boolean true. - PM39926
_coreConnection.close(true);
} catch (final SIConnectionLostException exception) {
// No FFDC code needed
// d352473
// We are remote to the ME and the ME connection has been lost
// we shall surpress this exception as we want the destroy to complete
} catch (final SIConnectionDroppedException exception) {
// No FFDC code needed
// d352473
// We are remote to the ME and the ME connection has been dropped
// we shall surpress this exception as we want the destroy to complete
} catch (final SIException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "destroy",
"1:408:1.91", this);
throw new ResourceException(NLS.getFormattedMessage(
"EXCEPTION_RECEIVED_CWSJR1110", new Object[] { exception,
"createManagedConnection" }, null), exception);
} catch (final SIErrorException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "destroy",
"1:416:1.91", this);
throw new ResourceException(NLS.getFormattedMessage(
"EXCEPTION_RECEIVED_CWSJR1110", new Object[] { exception,
"createManagedConnection" }, null), exception);
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "destroy");
}
} | java | @Override
final public void destroy() throws ResourceException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "destroy");
}
// Invalidate all of the sessions
for (final Iterator iterator = _sessions.iterator(); iterator.hasNext();) {
final Object object = iterator.next();
if (object instanceof JmsJcaSessionImpl) {
final JmsJcaSessionImpl session = (JmsJcaSessionImpl) object;
session.invalidate();
}
}
// Empty the set
_sessions.clear();
try {
// Deregister the connection listener
_coreConnection.removeConnectionListener(_connectionListener);
// Close the core connection
// when destroy calls close connections then connection cannot be reset for future usage so force close by passing boolean true. - PM39926
_coreConnection.close(true);
} catch (final SIConnectionLostException exception) {
// No FFDC code needed
// d352473
// We are remote to the ME and the ME connection has been lost
// we shall surpress this exception as we want the destroy to complete
} catch (final SIConnectionDroppedException exception) {
// No FFDC code needed
// d352473
// We are remote to the ME and the ME connection has been dropped
// we shall surpress this exception as we want the destroy to complete
} catch (final SIException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "destroy",
"1:408:1.91", this);
throw new ResourceException(NLS.getFormattedMessage(
"EXCEPTION_RECEIVED_CWSJR1110", new Object[] { exception,
"createManagedConnection" }, null), exception);
} catch (final SIErrorException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "destroy",
"1:416:1.91", this);
throw new ResourceException(NLS.getFormattedMessage(
"EXCEPTION_RECEIVED_CWSJR1110", new Object[] { exception,
"createManagedConnection" }, null), exception);
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "destroy");
}
} | [
"@",
"Override",
"final",
"public",
"void",
"destroy",
"(",
")",
"throws",
"ResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"\"destroy\"",
")",
";",
"}",
"// Invalidate all of the sessions",
"for",
"(",
"final",
"Iterator",
"iterator",
"=",
"_sessions",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"final",
"Object",
"object",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"object",
"instanceof",
"JmsJcaSessionImpl",
")",
"{",
"final",
"JmsJcaSessionImpl",
"session",
"=",
"(",
"JmsJcaSessionImpl",
")",
"object",
";",
"session",
".",
"invalidate",
"(",
")",
";",
"}",
"}",
"// Empty the set",
"_sessions",
".",
"clear",
"(",
")",
";",
"try",
"{",
"// Deregister the connection listener",
"_coreConnection",
".",
"removeConnectionListener",
"(",
"_connectionListener",
")",
";",
"// Close the core connection",
"// when destroy calls close connections then connection cannot be reset for future usage so force close by passing boolean true. - PM39926",
"_coreConnection",
".",
"close",
"(",
"true",
")",
";",
"}",
"catch",
"(",
"final",
"SIConnectionLostException",
"exception",
")",
"{",
"// No FFDC code needed",
"// d352473",
"// We are remote to the ME and the ME connection has been lost",
"// we shall surpress this exception as we want the destroy to complete",
"}",
"catch",
"(",
"final",
"SIConnectionDroppedException",
"exception",
")",
"{",
"// No FFDC code needed",
"// d352473",
"// We are remote to the ME and the ME connection has been dropped",
"// we shall surpress this exception as we want the destroy to complete",
"}",
"catch",
"(",
"final",
"SIException",
"exception",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exception",
",",
"CLASS_NAME",
"+",
"\"destroy\"",
",",
"\"1:408:1.91\"",
",",
"this",
")",
";",
"throw",
"new",
"ResourceException",
"(",
"NLS",
".",
"getFormattedMessage",
"(",
"\"EXCEPTION_RECEIVED_CWSJR1110\"",
",",
"new",
"Object",
"[",
"]",
"{",
"exception",
",",
"\"createManagedConnection\"",
"}",
",",
"null",
")",
",",
"exception",
")",
";",
"}",
"catch",
"(",
"final",
"SIErrorException",
"exception",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exception",
",",
"CLASS_NAME",
"+",
"\"destroy\"",
",",
"\"1:416:1.91\"",
",",
"this",
")",
";",
"throw",
"new",
"ResourceException",
"(",
"NLS",
".",
"getFormattedMessage",
"(",
"\"EXCEPTION_RECEIVED_CWSJR1110\"",
",",
"new",
"Object",
"[",
"]",
"{",
"exception",
",",
"\"createManagedConnection\"",
"}",
",",
"null",
")",
",",
"exception",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"\"destroy\"",
")",
";",
"}",
"}"
] | Destroys this managed connection. Called when a connection error has
occurred or the managed connection has timed out in the free pool. Marks
any associated sessions as invalid. Closes the associated core
connection.
@throws ResourceException
generic exception | [
"Destroys",
"this",
"managed",
"connection",
".",
"Called",
"when",
"a",
"connection",
"error",
"has",
"occurred",
"or",
"the",
"managed",
"connection",
"has",
"timed",
"out",
"in",
"the",
"free",
"pool",
".",
"Marks",
"any",
"associated",
"sessions",
"as",
"invalid",
".",
"Closes",
"the",
"associated",
"core",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java#L280-L347 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java | JmsJcaManagedConnection.cleanup | @Override
final public void cleanup() throws ResourceException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "cleanup");
}
// Invalidate all of the sessions
for (final Iterator iterator = _sessions.iterator(); iterator.hasNext();) {
final Object object = iterator.next();
if (object instanceof JmsJcaSessionImpl) {
((JmsJcaSessionImpl) object).invalidate();
}
}
_sessions.clear();
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "cleanup");
}
} | java | @Override
final public void cleanup() throws ResourceException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "cleanup");
}
// Invalidate all of the sessions
for (final Iterator iterator = _sessions.iterator(); iterator.hasNext();) {
final Object object = iterator.next();
if (object instanceof JmsJcaSessionImpl) {
((JmsJcaSessionImpl) object).invalidate();
}
}
_sessions.clear();
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "cleanup");
}
} | [
"@",
"Override",
"final",
"public",
"void",
"cleanup",
"(",
")",
"throws",
"ResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"\"cleanup\"",
")",
";",
"}",
"// Invalidate all of the sessions",
"for",
"(",
"final",
"Iterator",
"iterator",
"=",
"_sessions",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"final",
"Object",
"object",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"object",
"instanceof",
"JmsJcaSessionImpl",
")",
"{",
"(",
"(",
"JmsJcaSessionImpl",
")",
"object",
")",
".",
"invalidate",
"(",
")",
";",
"}",
"}",
"_sessions",
".",
"clear",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"\"cleanup\"",
")",
";",
"}",
"}"
] | Cleans up this managed connection so that it can be returned to the free
pool. Any sessions that are still associated should be invalidated.
@throws ResourceException
generic exception | [
"Cleans",
"up",
"this",
"managed",
"connection",
"so",
"that",
"it",
"can",
"be",
"returned",
"to",
"the",
"free",
"pool",
".",
"Any",
"sessions",
"that",
"are",
"still",
"associated",
"should",
"be",
"invalidated",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java#L356-L377 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java | JmsJcaManagedConnection.associateConnection | @Override
final public void associateConnection(Object object)
throws ResourceException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "associateConnection", object);
}
if (object instanceof JmsJcaSessionImpl) {
final JmsJcaSessionImpl session = (JmsJcaSessionImpl) object;
session.associate(this);
_sessions.add(session);
} else {
throw new ResourceAdapterInternalException(NLS.getFormattedMessage(
("INVALID_SESSION_CWSJR1104"), new Object[] {
"associateConnection",
JmsJcaSessionImpl.class.getName(),
(object == null ? "null" : object.getClass()
.getName()) }, null));
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "associateConnection");
}
} | java | @Override
final public void associateConnection(Object object)
throws ResourceException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "associateConnection", object);
}
if (object instanceof JmsJcaSessionImpl) {
final JmsJcaSessionImpl session = (JmsJcaSessionImpl) object;
session.associate(this);
_sessions.add(session);
} else {
throw new ResourceAdapterInternalException(NLS.getFormattedMessage(
("INVALID_SESSION_CWSJR1104"), new Object[] {
"associateConnection",
JmsJcaSessionImpl.class.getName(),
(object == null ? "null" : object.getClass()
.getName()) }, null));
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "associateConnection");
}
} | [
"@",
"Override",
"final",
"public",
"void",
"associateConnection",
"(",
"Object",
"object",
")",
"throws",
"ResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"\"associateConnection\"",
",",
"object",
")",
";",
"}",
"if",
"(",
"object",
"instanceof",
"JmsJcaSessionImpl",
")",
"{",
"final",
"JmsJcaSessionImpl",
"session",
"=",
"(",
"JmsJcaSessionImpl",
")",
"object",
";",
"session",
".",
"associate",
"(",
"this",
")",
";",
"_sessions",
".",
"add",
"(",
"session",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"ResourceAdapterInternalException",
"(",
"NLS",
".",
"getFormattedMessage",
"(",
"(",
"\"INVALID_SESSION_CWSJR1104\"",
")",
",",
"new",
"Object",
"[",
"]",
"{",
"\"associateConnection\"",
",",
"JmsJcaSessionImpl",
".",
"class",
".",
"getName",
"(",
")",
",",
"(",
"object",
"==",
"null",
"?",
"\"null\"",
":",
"object",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
"}",
",",
"null",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"\"associateConnection\"",
")",
";",
"}",
"}"
] | Associates the given session with this managed connection. Removes the
session from its previous managed connection, if any, and adds it to the
set for this connection. Sets this managed connection on the session.
@param object
the session to associate
@throws ResourceException
generic exception | [
"Associates",
"the",
"given",
"session",
"with",
"this",
"managed",
"connection",
".",
"Removes",
"the",
"session",
"from",
"its",
"previous",
"managed",
"connection",
"if",
"any",
"and",
"adds",
"it",
"to",
"the",
"set",
"for",
"this",
"connection",
".",
"Sets",
"this",
"managed",
"connection",
"on",
"the",
"session",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java#L389-L417 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java | JmsJcaManagedConnection.disassociateSession | final void disassociateSession(final JmsJcaSessionImpl session) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "disassociateSession", session);
}
_sessions.remove(session);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "disassociateSession");
}
} | java | final void disassociateSession(final JmsJcaSessionImpl session) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "disassociateSession", session);
}
_sessions.remove(session);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "disassociateSession");
}
} | [
"final",
"void",
"disassociateSession",
"(",
"final",
"JmsJcaSessionImpl",
"session",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"\"disassociateSession\"",
",",
"session",
")",
";",
"}",
"_sessions",
".",
"remove",
"(",
"session",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"\"disassociateSession\"",
")",
";",
"}",
"}"
] | Dissassociates the given session from this managed connection.
@param session
the session to disassociate | [
"Dissassociates",
"the",
"given",
"session",
"from",
"this",
"managed",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java#L425-L437 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java | JmsJcaManagedConnection.addConnectionEventListener | @Override
final public void addConnectionEventListener(
final ConnectionEventListener listener) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "addConnectionEventListener", listener);
}
synchronized (_connectionListeners) {
_connectionListeners.add(listener);
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "addConnectionEventListener");
}
} | java | @Override
final public void addConnectionEventListener(
final ConnectionEventListener listener) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "addConnectionEventListener", listener);
}
synchronized (_connectionListeners) {
_connectionListeners.add(listener);
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "addConnectionEventListener");
}
} | [
"@",
"Override",
"final",
"public",
"void",
"addConnectionEventListener",
"(",
"final",
"ConnectionEventListener",
"listener",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"\"addConnectionEventListener\"",
",",
"listener",
")",
";",
"}",
"synchronized",
"(",
"_connectionListeners",
")",
"{",
"_connectionListeners",
".",
"add",
"(",
"listener",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"\"addConnectionEventListener\"",
")",
";",
"}",
"}"
] | Adds a connection event listener.
@param listener
the listener to add | [
"Adds",
"a",
"connection",
"event",
"listener",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java#L445-L461 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java | JmsJcaManagedConnection.getMetaData | @Override
final public ManagedConnectionMetaData getMetaData()
throws ResourceException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "getMetaData");
}
if (_metaData == null) {
_metaData = new JmsJcaManagedConnectionMetaData();
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "getMetaData", _metaData);
}
return _metaData;
} | java | @Override
final public ManagedConnectionMetaData getMetaData()
throws ResourceException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "getMetaData");
}
if (_metaData == null) {
_metaData = new JmsJcaManagedConnectionMetaData();
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "getMetaData", _metaData);
}
return _metaData;
} | [
"@",
"Override",
"final",
"public",
"ManagedConnectionMetaData",
"getMetaData",
"(",
")",
"throws",
"ResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"\"getMetaData\"",
")",
";",
"}",
"if",
"(",
"_metaData",
"==",
"null",
")",
"{",
"_metaData",
"=",
"new",
"JmsJcaManagedConnectionMetaData",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"\"getMetaData\"",
",",
"_metaData",
")",
";",
"}",
"return",
"_metaData",
";",
"}"
] | Returns the meta data information for this Jetstream connection.
@return the metadata information
@throws ResourceException
generic exception | [
"Returns",
"the",
"meta",
"data",
"information",
"for",
"this",
"Jetstream",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java#L593-L610 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java | JmsJcaManagedConnection.dissociateConnections | @Override
final public void dissociateConnections() throws ResourceException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(TRACE, "dissociateConnections");
}
// Dissociate sessions
for (final Iterator iterator = _sessions.iterator(); iterator.hasNext();) {
final Object object = iterator.next();
if (object instanceof JmsJcaSessionImpl) {
((JmsJcaSessionImpl) object).dissociate();
iterator.remove();
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "dissociateConnections");
}
} | java | @Override
final public void dissociateConnections() throws ResourceException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(TRACE, "dissociateConnections");
}
// Dissociate sessions
for (final Iterator iterator = _sessions.iterator(); iterator.hasNext();) {
final Object object = iterator.next();
if (object instanceof JmsJcaSessionImpl) {
((JmsJcaSessionImpl) object).dissociate();
iterator.remove();
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "dissociateConnections");
}
} | [
"@",
"Override",
"final",
"public",
"void",
"dissociateConnections",
"(",
")",
"throws",
"ResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"TRACE",
",",
"\"dissociateConnections\"",
")",
";",
"}",
"// Dissociate sessions",
"for",
"(",
"final",
"Iterator",
"iterator",
"=",
"_sessions",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"final",
"Object",
"object",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"object",
"instanceof",
"JmsJcaSessionImpl",
")",
"{",
"(",
"(",
"JmsJcaSessionImpl",
")",
"object",
")",
".",
"dissociate",
"(",
")",
";",
"iterator",
".",
"remove",
"(",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"\"dissociateConnections\"",
")",
";",
"}",
"}"
] | Dissociates any sessions currently associated with this managed
connection.
@throws ResourceException
generic exception | [
"Dissociates",
"any",
"sessions",
"currently",
"associated",
"with",
"this",
"managed",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java#L649-L670 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java | JmsJcaManagedConnection.localTransactionStarted | final void localTransactionStarted() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "localTransactionStarted");
}
final ConnectionEvent event = new ConnectionEvent(this,
ConnectionEvent.LOCAL_TRANSACTION_STARTED);
// Copy list to protect against concurrent modification by listener
final List<ConnectionEventListener> copy;
synchronized (_connectionListeners) {
copy = new ArrayList<ConnectionEventListener>(_connectionListeners);
}
for (final Iterator iterator = copy.iterator(); iterator.hasNext();) {
final Object object = iterator.next();
if (object instanceof ConnectionEventListener) {
((ConnectionEventListener) object)
.localTransactionStarted(event);
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "localTransactionStarted");
}
} | java | final void localTransactionStarted() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "localTransactionStarted");
}
final ConnectionEvent event = new ConnectionEvent(this,
ConnectionEvent.LOCAL_TRANSACTION_STARTED);
// Copy list to protect against concurrent modification by listener
final List<ConnectionEventListener> copy;
synchronized (_connectionListeners) {
copy = new ArrayList<ConnectionEventListener>(_connectionListeners);
}
for (final Iterator iterator = copy.iterator(); iterator.hasNext();) {
final Object object = iterator.next();
if (object instanceof ConnectionEventListener) {
((ConnectionEventListener) object)
.localTransactionStarted(event);
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "localTransactionStarted");
}
} | [
"final",
"void",
"localTransactionStarted",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"\"localTransactionStarted\"",
")",
";",
"}",
"final",
"ConnectionEvent",
"event",
"=",
"new",
"ConnectionEvent",
"(",
"this",
",",
"ConnectionEvent",
".",
"LOCAL_TRANSACTION_STARTED",
")",
";",
"// Copy list to protect against concurrent modification by listener",
"final",
"List",
"<",
"ConnectionEventListener",
">",
"copy",
";",
"synchronized",
"(",
"_connectionListeners",
")",
"{",
"copy",
"=",
"new",
"ArrayList",
"<",
"ConnectionEventListener",
">",
"(",
"_connectionListeners",
")",
";",
"}",
"for",
"(",
"final",
"Iterator",
"iterator",
"=",
"copy",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"final",
"Object",
"object",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"object",
"instanceof",
"ConnectionEventListener",
")",
"{",
"(",
"(",
"ConnectionEventListener",
")",
"object",
")",
".",
"localTransactionStarted",
"(",
"event",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"\"localTransactionStarted\"",
")",
";",
"}",
"}"
] | Called to indicate that the session associated with this managed
connection has begun a local transaction. Notifies the connection event
listeners. | [
"Called",
"to",
"indicate",
"that",
"the",
"session",
"associated",
"with",
"this",
"managed",
"connection",
"has",
"begun",
"a",
"local",
"transaction",
".",
"Notifies",
"the",
"connection",
"event",
"listeners",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnection.java#L784-L812 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java | ConsumerUtil.getSigningKey | Key getSigningKey(JwtConsumerConfig config, JwtContext jwtContext, Map properties) throws KeyException {
Key signingKey = null;
if (config == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JWT consumer config object is null");
}
return null;
}
signingKey = getSigningKeyBasedOnSignatureAlgorithm(config, jwtContext, properties);
if (signingKey == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "A signing key could not be found");
}
}
return signingKey;
} | java | Key getSigningKey(JwtConsumerConfig config, JwtContext jwtContext, Map properties) throws KeyException {
Key signingKey = null;
if (config == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JWT consumer config object is null");
}
return null;
}
signingKey = getSigningKeyBasedOnSignatureAlgorithm(config, jwtContext, properties);
if (signingKey == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "A signing key could not be found");
}
}
return signingKey;
} | [
"Key",
"getSigningKey",
"(",
"JwtConsumerConfig",
"config",
",",
"JwtContext",
"jwtContext",
",",
"Map",
"properties",
")",
"throws",
"KeyException",
"{",
"Key",
"signingKey",
"=",
"null",
";",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"JWT consumer config object is null\"",
")",
";",
"}",
"return",
"null",
";",
"}",
"signingKey",
"=",
"getSigningKeyBasedOnSignatureAlgorithm",
"(",
"config",
",",
"jwtContext",
",",
"properties",
")",
";",
"if",
"(",
"signingKey",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"A signing key could not be found\"",
")",
";",
"}",
"}",
"return",
"signingKey",
";",
"}"
] | Get the appropriate signing key based on the signature algorithm specified in
the config. | [
"Get",
"the",
"appropriate",
"signing",
"key",
"based",
"on",
"the",
"signature",
"algorithm",
"specified",
"in",
"the",
"config",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java#L122-L137 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java | ConsumerUtil.getSharedSecretKey | Key getSharedSecretKey(JwtConsumerConfig config) throws KeyException {
if (config == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JWT consumer config object is null");
}
return null;
}
String sharedKey = config.getSharedKey();
return createKeyFromSharedKey(sharedKey);
} | java | Key getSharedSecretKey(JwtConsumerConfig config) throws KeyException {
if (config == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JWT consumer config object is null");
}
return null;
}
String sharedKey = config.getSharedKey();
return createKeyFromSharedKey(sharedKey);
} | [
"Key",
"getSharedSecretKey",
"(",
"JwtConsumerConfig",
"config",
")",
"throws",
"KeyException",
"{",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"JWT consumer config object is null\"",
")",
";",
"}",
"return",
"null",
";",
"}",
"String",
"sharedKey",
"=",
"config",
".",
"getSharedKey",
"(",
")",
";",
"return",
"createKeyFromSharedKey",
"(",
"sharedKey",
")",
";",
"}"
] | Creates a Key object from the shared key specified in the provided
configuration. | [
"Creates",
"a",
"Key",
"object",
"from",
"the",
"shared",
"key",
"specified",
"in",
"the",
"provided",
"configuration",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java#L167-L176 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java | ConsumerUtil.getPublicKey | Key getPublicKey(String trustedAlias, String trustStoreRef, String signatureAlgorithm)
throws KeyStoreServiceException, KeyException {
Key signingKey = getPublicKeyFromKeystore(trustedAlias, trustStoreRef, signatureAlgorithm);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Trusted alias: " + trustedAlias + ", Truststore: " + trustStoreRef);
Tr.debug(tc, "RSAPublicKey: " + (signingKey instanceof RSAPublicKey));
}
if (signingKey != null && !(signingKey instanceof RSAPublicKey)) {
signingKey = null;
}
return signingKey;
} | java | Key getPublicKey(String trustedAlias, String trustStoreRef, String signatureAlgorithm)
throws KeyStoreServiceException, KeyException {
Key signingKey = getPublicKeyFromKeystore(trustedAlias, trustStoreRef, signatureAlgorithm);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Trusted alias: " + trustedAlias + ", Truststore: " + trustStoreRef);
Tr.debug(tc, "RSAPublicKey: " + (signingKey instanceof RSAPublicKey));
}
if (signingKey != null && !(signingKey instanceof RSAPublicKey)) {
signingKey = null;
}
return signingKey;
} | [
"Key",
"getPublicKey",
"(",
"String",
"trustedAlias",
",",
"String",
"trustStoreRef",
",",
"String",
"signatureAlgorithm",
")",
"throws",
"KeyStoreServiceException",
",",
"KeyException",
"{",
"Key",
"signingKey",
"=",
"getPublicKeyFromKeystore",
"(",
"trustedAlias",
",",
"trustStoreRef",
",",
"signatureAlgorithm",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Trusted alias: \"",
"+",
"trustedAlias",
"+",
"\", Truststore: \"",
"+",
"trustStoreRef",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"RSAPublicKey: \"",
"+",
"(",
"signingKey",
"instanceof",
"RSAPublicKey",
")",
")",
";",
"}",
"if",
"(",
"signingKey",
"!=",
"null",
"&&",
"!",
"(",
"signingKey",
"instanceof",
"RSAPublicKey",
")",
")",
"{",
"signingKey",
"=",
"null",
";",
"}",
"return",
"signingKey",
";",
"}"
] | Creates a Key object from the certificate stored in the trust store and alias
provided. | [
"Creates",
"a",
"Key",
"object",
"from",
"the",
"certificate",
"stored",
"in",
"the",
"trust",
"store",
"and",
"alias",
"provided",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java#L290-L301 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java | ConsumerUtil.validateSignatureAlgorithmWithKey | void validateSignatureAlgorithmWithKey(JwtConsumerConfig config, Key key) throws InvalidClaimException {
String signatureAlgorithm = config.getSignatureAlgorithm();
if (key == null && signatureAlgorithm != null && !signatureAlgorithm.equalsIgnoreCase("none")) {
String msg = Tr.formatMessage(tc, "JWT_MISSING_KEY", new Object[] { signatureAlgorithm });
throw new InvalidClaimException(msg);
}
} | java | void validateSignatureAlgorithmWithKey(JwtConsumerConfig config, Key key) throws InvalidClaimException {
String signatureAlgorithm = config.getSignatureAlgorithm();
if (key == null && signatureAlgorithm != null && !signatureAlgorithm.equalsIgnoreCase("none")) {
String msg = Tr.formatMessage(tc, "JWT_MISSING_KEY", new Object[] { signatureAlgorithm });
throw new InvalidClaimException(msg);
}
} | [
"void",
"validateSignatureAlgorithmWithKey",
"(",
"JwtConsumerConfig",
"config",
",",
"Key",
"key",
")",
"throws",
"InvalidClaimException",
"{",
"String",
"signatureAlgorithm",
"=",
"config",
".",
"getSignatureAlgorithm",
"(",
")",
";",
"if",
"(",
"key",
"==",
"null",
"&&",
"signatureAlgorithm",
"!=",
"null",
"&&",
"!",
"signatureAlgorithm",
".",
"equalsIgnoreCase",
"(",
"\"none\"",
")",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"JWT_MISSING_KEY\"",
",",
"new",
"Object",
"[",
"]",
"{",
"signatureAlgorithm",
"}",
")",
";",
"throw",
"new",
"InvalidClaimException",
"(",
"msg",
")",
";",
"}",
"}"
] | Throws an exception if the provided key is null but the config specifies a
signature algorithm other than "none". | [
"Throws",
"an",
"exception",
"if",
"the",
"provided",
"key",
"is",
"null",
"but",
"the",
"config",
"specifies",
"a",
"signature",
"algorithm",
"other",
"than",
"none",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java#L394-L400 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java | ConsumerUtil.validateIssuer | boolean validateIssuer(String consumerConfigId, String issuers, String tokenIssuer) throws InvalidClaimException {
boolean isIssuer = false;
if (issuers == null || issuers.isEmpty()) {
String msg = Tr.formatMessage(tc, "JWT_TRUSTED_ISSUERS_NULL",
new Object[] { tokenIssuer, consumerConfigId });
throw new InvalidClaimException(msg);
}
StringTokenizer st = new StringTokenizer(issuers, ",");
while (st.hasMoreTokens()) {
String iss = st.nextToken().trim();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Trusted issuer: " + iss);
}
if (Constants.ALL_ISSUERS.equals(iss) || (tokenIssuer != null && tokenIssuer.equals(iss))) {
isIssuer = true;
break;
}
}
if (!isIssuer) {
String msg = Tr.formatMessage(tc, "JWT_ISSUER_NOT_TRUSTED",
new Object[] { tokenIssuer, consumerConfigId, issuers });
throw new InvalidClaimException(msg);
}
return isIssuer;
} | java | boolean validateIssuer(String consumerConfigId, String issuers, String tokenIssuer) throws InvalidClaimException {
boolean isIssuer = false;
if (issuers == null || issuers.isEmpty()) {
String msg = Tr.formatMessage(tc, "JWT_TRUSTED_ISSUERS_NULL",
new Object[] { tokenIssuer, consumerConfigId });
throw new InvalidClaimException(msg);
}
StringTokenizer st = new StringTokenizer(issuers, ",");
while (st.hasMoreTokens()) {
String iss = st.nextToken().trim();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Trusted issuer: " + iss);
}
if (Constants.ALL_ISSUERS.equals(iss) || (tokenIssuer != null && tokenIssuer.equals(iss))) {
isIssuer = true;
break;
}
}
if (!isIssuer) {
String msg = Tr.formatMessage(tc, "JWT_ISSUER_NOT_TRUSTED",
new Object[] { tokenIssuer, consumerConfigId, issuers });
throw new InvalidClaimException(msg);
}
return isIssuer;
} | [
"boolean",
"validateIssuer",
"(",
"String",
"consumerConfigId",
",",
"String",
"issuers",
",",
"String",
"tokenIssuer",
")",
"throws",
"InvalidClaimException",
"{",
"boolean",
"isIssuer",
"=",
"false",
";",
"if",
"(",
"issuers",
"==",
"null",
"||",
"issuers",
".",
"isEmpty",
"(",
")",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"JWT_TRUSTED_ISSUERS_NULL\"",
",",
"new",
"Object",
"[",
"]",
"{",
"tokenIssuer",
",",
"consumerConfigId",
"}",
")",
";",
"throw",
"new",
"InvalidClaimException",
"(",
"msg",
")",
";",
"}",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
"issuers",
",",
"\",\"",
")",
";",
"while",
"(",
"st",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"String",
"iss",
"=",
"st",
".",
"nextToken",
"(",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Trusted issuer: \"",
"+",
"iss",
")",
";",
"}",
"if",
"(",
"Constants",
".",
"ALL_ISSUERS",
".",
"equals",
"(",
"iss",
")",
"||",
"(",
"tokenIssuer",
"!=",
"null",
"&&",
"tokenIssuer",
".",
"equals",
"(",
"iss",
")",
")",
")",
"{",
"isIssuer",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"isIssuer",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"JWT_ISSUER_NOT_TRUSTED\"",
",",
"new",
"Object",
"[",
"]",
"{",
"tokenIssuer",
",",
"consumerConfigId",
",",
"issuers",
"}",
")",
";",
"throw",
"new",
"InvalidClaimException",
"(",
"msg",
")",
";",
"}",
"return",
"isIssuer",
";",
"}"
] | Verifies that tokenIssuer is one of the values specified in the
comma-separated issuers string. | [
"Verifies",
"that",
"tokenIssuer",
"is",
"one",
"of",
"the",
"values",
"specified",
"in",
"the",
"comma",
"-",
"separated",
"issuers",
"string",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java#L406-L432 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java | ConsumerUtil.validateAudience | boolean validateAudience(List<String> allowedAudiences, List<String> audiences) {
boolean valid = false;
if (allowedAudiences != null && allowedAudiences.contains(Constants.ALL_AUDIENCES)) {
return true;
}
if (allowedAudiences != null && audiences != null) {
for (String audience : audiences) {
for (String allowedAud : allowedAudiences) {
if (allowedAud.equals(audience)) {
valid = true;
break;
}
}
}
} else if (allowedAudiences == null && (audiences == null || audiences.isEmpty())) {
valid = true;
}
return valid;
} | java | boolean validateAudience(List<String> allowedAudiences, List<String> audiences) {
boolean valid = false;
if (allowedAudiences != null && allowedAudiences.contains(Constants.ALL_AUDIENCES)) {
return true;
}
if (allowedAudiences != null && audiences != null) {
for (String audience : audiences) {
for (String allowedAud : allowedAudiences) {
if (allowedAud.equals(audience)) {
valid = true;
break;
}
}
}
} else if (allowedAudiences == null && (audiences == null || audiences.isEmpty())) {
valid = true;
}
return valid;
} | [
"boolean",
"validateAudience",
"(",
"List",
"<",
"String",
">",
"allowedAudiences",
",",
"List",
"<",
"String",
">",
"audiences",
")",
"{",
"boolean",
"valid",
"=",
"false",
";",
"if",
"(",
"allowedAudiences",
"!=",
"null",
"&&",
"allowedAudiences",
".",
"contains",
"(",
"Constants",
".",
"ALL_AUDIENCES",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"allowedAudiences",
"!=",
"null",
"&&",
"audiences",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"audience",
":",
"audiences",
")",
"{",
"for",
"(",
"String",
"allowedAud",
":",
"allowedAudiences",
")",
"{",
"if",
"(",
"allowedAud",
".",
"equals",
"(",
"audience",
")",
")",
"{",
"valid",
"=",
"true",
";",
"break",
";",
"}",
"}",
"}",
"}",
"else",
"if",
"(",
"allowedAudiences",
"==",
"null",
"&&",
"(",
"audiences",
"==",
"null",
"||",
"audiences",
".",
"isEmpty",
"(",
")",
")",
")",
"{",
"valid",
"=",
"true",
";",
"}",
"return",
"valid",
";",
"}"
] | Verifies that at least one of the values specified in audiences is contained
in the allowedAudiences list. | [
"Verifies",
"that",
"at",
"least",
"one",
"of",
"the",
"values",
"specified",
"in",
"audiences",
"is",
"contained",
"in",
"the",
"allowedAudiences",
"list",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java#L438-L458 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ExternalizedBeanId.java | ExternalizedBeanId.readExternal | public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "readExternal");
try {
// read magic
short magic = in.readShort();
short majorVersion = in.readShort();
short minorVersion = in.readShort();
if (!(magic == EXTERNAL_MAGIC)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc,
"Magic Number absent, trying default Java deserialization");
throw new IOException("Bean ID externalized stream format error");
} else if (!(majorVersion == MAJOR_VERSION) ||
!(minorVersion == MINOR_VERSION)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc,
"BeanID Version mismatch", new Object[] { new Short(majorVersion),
new Short(minorVersion) });
throw new IOException("BeanID version mismatch");
}
// read the interface type (HOME or REMOTE)
byte ifType = in.readByte();
if (ifType == IF_HOME) {
_isHome = true;
} else {
_isHome = false;
}
//89554
// read the bean name
byte[] j2eeNameBytes = readExternalJ2EEName(in);
// read the serialized primary key
pkey = readExternalPKey(in, j2eeNameBytes);
// TAKE CARE! We don't have a container reference so can't
// restore transient fields.
// This is ok as long
// as rest of container restores BeanIds using the deserialise
// method. Since readExternal
// is a new addition
// this can be no different to the behaviour that would have been
// observed when using
// the default serialization.
} finally {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "readExternal");
}
} | java | public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "readExternal");
try {
// read magic
short magic = in.readShort();
short majorVersion = in.readShort();
short minorVersion = in.readShort();
if (!(magic == EXTERNAL_MAGIC)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc,
"Magic Number absent, trying default Java deserialization");
throw new IOException("Bean ID externalized stream format error");
} else if (!(majorVersion == MAJOR_VERSION) ||
!(minorVersion == MINOR_VERSION)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc,
"BeanID Version mismatch", new Object[] { new Short(majorVersion),
new Short(minorVersion) });
throw new IOException("BeanID version mismatch");
}
// read the interface type (HOME or REMOTE)
byte ifType = in.readByte();
if (ifType == IF_HOME) {
_isHome = true;
} else {
_isHome = false;
}
//89554
// read the bean name
byte[] j2eeNameBytes = readExternalJ2EEName(in);
// read the serialized primary key
pkey = readExternalPKey(in, j2eeNameBytes);
// TAKE CARE! We don't have a container reference so can't
// restore transient fields.
// This is ok as long
// as rest of container restores BeanIds using the deserialise
// method. Since readExternal
// is a new addition
// this can be no different to the behaviour that would have been
// observed when using
// the default serialization.
} finally {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "readExternal");
}
} | [
"public",
"void",
"readExternal",
"(",
"ObjectInput",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"readExternal\"",
")",
";",
"try",
"{",
"// read magic",
"short",
"magic",
"=",
"in",
".",
"readShort",
"(",
")",
";",
"short",
"majorVersion",
"=",
"in",
".",
"readShort",
"(",
")",
";",
"short",
"minorVersion",
"=",
"in",
".",
"readShort",
"(",
")",
";",
"if",
"(",
"!",
"(",
"magic",
"==",
"EXTERNAL_MAGIC",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Magic Number absent, trying default Java deserialization\"",
")",
";",
"throw",
"new",
"IOException",
"(",
"\"Bean ID externalized stream format error\"",
")",
";",
"}",
"else",
"if",
"(",
"!",
"(",
"majorVersion",
"==",
"MAJOR_VERSION",
")",
"||",
"!",
"(",
"minorVersion",
"==",
"MINOR_VERSION",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"BeanID Version mismatch\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Short",
"(",
"majorVersion",
")",
",",
"new",
"Short",
"(",
"minorVersion",
")",
"}",
")",
";",
"throw",
"new",
"IOException",
"(",
"\"BeanID version mismatch\"",
")",
";",
"}",
"// read the interface type (HOME or REMOTE)",
"byte",
"ifType",
"=",
"in",
".",
"readByte",
"(",
")",
";",
"if",
"(",
"ifType",
"==",
"IF_HOME",
")",
"{",
"_isHome",
"=",
"true",
";",
"}",
"else",
"{",
"_isHome",
"=",
"false",
";",
"}",
"//89554",
"// read the bean name",
"byte",
"[",
"]",
"j2eeNameBytes",
"=",
"readExternalJ2EEName",
"(",
"in",
")",
";",
"// read the serialized primary key",
"pkey",
"=",
"readExternalPKey",
"(",
"in",
",",
"j2eeNameBytes",
")",
";",
"// TAKE CARE! We don't have a container reference so can't",
"// restore transient fields.",
"// This is ok as long",
"// as rest of container restores BeanIds using the deserialise",
"// method. Since readExternal",
"// is a new addition",
"// this can be no different to the behaviour that would have been",
"// observed when using",
"// the default serialization.",
"}",
"finally",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"readExternal\"",
")",
";",
"}",
"}"
] | readExternal is called by Java serialization when readObject is
called on an ObjectInputStream
for an object of class BeanId. It must read the values in the same
sequence and with the
same types as written by writeExternal. | [
"readExternal",
"is",
"called",
"by",
"Java",
"serialization",
"when",
"readObject",
"is",
"called",
"on",
"an",
"ObjectInputStream",
"for",
"an",
"object",
"of",
"class",
"BeanId",
".",
"It",
"must",
"read",
"the",
"values",
"in",
"the",
"same",
"sequence",
"and",
"with",
"the",
"same",
"types",
"as",
"written",
"by",
"writeExternal",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ExternalizedBeanId.java#L117-L174 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ExternalizedBeanId.java | ExternalizedBeanId.readExternalPKey | private Serializable readExternalPKey(ObjectInput in, byte[] j2eeNameBytes)
throws java.io.IOException, ClassNotFoundException {
int pkeyLength = in.readInt();
byte[] pkeyBytes = new byte[pkeyLength];
//d164415 start
int bytesRead = 0;
for (int offset = 0; offset < pkeyLength; offset += bytesRead)
{
bytesRead = in.read(pkeyBytes, offset, pkeyLength - offset);
if (bytesRead == -1)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "readExternalKey encountered end of stream");
throw new IOException("end of input stream while reading primary key");
}
}
//d164415 end
//
// What we are trying to do here is to get the j2eename of the
// bean in question. The reason we want to do this, we have get
// the ClassLoader of the bean before we attempt to deserialize
// the primary key. The container ClassLoader is no longer aware
// of the bean classes.
// This path may be traversed on a call to keyToObject. In that
// situation, the thread's context ClassLoader is of no use. So we
// have to use some static methods to access the container and get
// the specific ClassLoader for the bean
//
final EJSContainer container = EJSContainer.getDefaultContainer();
J2EEName j2eename = container.getJ2EENameFactory().create(j2eeNameBytes);
ByteArrayInputStream bais = new ByteArrayInputStream(pkeyBytes);
//
// Use a ObjectInputStream, it can then use the bean's ClassLoader
// to resolve the primary key class.
//
ClassLoader loader = EJSContainer.getClassLoader(j2eename);
ObjectInputStream pkeyStream =
container.getEJBRuntime().createObjectInputStream(bais, loader); // RTC71814
Serializable key = (Serializable) pkeyStream.readObject();
return key;
} | java | private Serializable readExternalPKey(ObjectInput in, byte[] j2eeNameBytes)
throws java.io.IOException, ClassNotFoundException {
int pkeyLength = in.readInt();
byte[] pkeyBytes = new byte[pkeyLength];
//d164415 start
int bytesRead = 0;
for (int offset = 0; offset < pkeyLength; offset += bytesRead)
{
bytesRead = in.read(pkeyBytes, offset, pkeyLength - offset);
if (bytesRead == -1)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "readExternalKey encountered end of stream");
throw new IOException("end of input stream while reading primary key");
}
}
//d164415 end
//
// What we are trying to do here is to get the j2eename of the
// bean in question. The reason we want to do this, we have get
// the ClassLoader of the bean before we attempt to deserialize
// the primary key. The container ClassLoader is no longer aware
// of the bean classes.
// This path may be traversed on a call to keyToObject. In that
// situation, the thread's context ClassLoader is of no use. So we
// have to use some static methods to access the container and get
// the specific ClassLoader for the bean
//
final EJSContainer container = EJSContainer.getDefaultContainer();
J2EEName j2eename = container.getJ2EENameFactory().create(j2eeNameBytes);
ByteArrayInputStream bais = new ByteArrayInputStream(pkeyBytes);
//
// Use a ObjectInputStream, it can then use the bean's ClassLoader
// to resolve the primary key class.
//
ClassLoader loader = EJSContainer.getClassLoader(j2eename);
ObjectInputStream pkeyStream =
container.getEJBRuntime().createObjectInputStream(bais, loader); // RTC71814
Serializable key = (Serializable) pkeyStream.readObject();
return key;
} | [
"private",
"Serializable",
"readExternalPKey",
"(",
"ObjectInput",
"in",
",",
"byte",
"[",
"]",
"j2eeNameBytes",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
",",
"ClassNotFoundException",
"{",
"int",
"pkeyLength",
"=",
"in",
".",
"readInt",
"(",
")",
";",
"byte",
"[",
"]",
"pkeyBytes",
"=",
"new",
"byte",
"[",
"pkeyLength",
"]",
";",
"//d164415 start",
"int",
"bytesRead",
"=",
"0",
";",
"for",
"(",
"int",
"offset",
"=",
"0",
";",
"offset",
"<",
"pkeyLength",
";",
"offset",
"+=",
"bytesRead",
")",
"{",
"bytesRead",
"=",
"in",
".",
"read",
"(",
"pkeyBytes",
",",
"offset",
",",
"pkeyLength",
"-",
"offset",
")",
";",
"if",
"(",
"bytesRead",
"==",
"-",
"1",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"readExternalKey encountered end of stream\"",
")",
";",
"throw",
"new",
"IOException",
"(",
"\"end of input stream while reading primary key\"",
")",
";",
"}",
"}",
"//d164415 end",
"//",
"// What we are trying to do here is to get the j2eename of the",
"// bean in question. The reason we want to do this, we have get",
"// the ClassLoader of the bean before we attempt to deserialize",
"// the primary key. The container ClassLoader is no longer aware",
"// of the bean classes.",
"// This path may be traversed on a call to keyToObject. In that",
"// situation, the thread's context ClassLoader is of no use. So we",
"// have to use some static methods to access the container and get",
"// the specific ClassLoader for the bean",
"//",
"final",
"EJSContainer",
"container",
"=",
"EJSContainer",
".",
"getDefaultContainer",
"(",
")",
";",
"J2EEName",
"j2eename",
"=",
"container",
".",
"getJ2EENameFactory",
"(",
")",
".",
"create",
"(",
"j2eeNameBytes",
")",
";",
"ByteArrayInputStream",
"bais",
"=",
"new",
"ByteArrayInputStream",
"(",
"pkeyBytes",
")",
";",
"//",
"// Use a ObjectInputStream, it can then use the bean's ClassLoader",
"// to resolve the primary key class.",
"//",
"ClassLoader",
"loader",
"=",
"EJSContainer",
".",
"getClassLoader",
"(",
"j2eename",
")",
";",
"ObjectInputStream",
"pkeyStream",
"=",
"container",
".",
"getEJBRuntime",
"(",
")",
".",
"createObjectInputStream",
"(",
"bais",
",",
"loader",
")",
";",
"// RTC71814",
"Serializable",
"key",
"=",
"(",
"Serializable",
")",
"pkeyStream",
".",
"readObject",
"(",
")",
";",
"return",
"key",
";",
"}"
] | Private helper method for readExternal - reads the Serialized
primary key.
@author Adrian Colyer
@return java.io.Serializable
@param in java.io.ObjectInput
@exception java.io.IOException The exception description. | [
"Private",
"helper",
"method",
"for",
"readExternal",
"-",
"reads",
"the",
"Serialized",
"primary",
"key",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ExternalizedBeanId.java#L208-L252 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ExternalizedBeanId.java | ExternalizedBeanId.writeExternal | public void writeExternal(ObjectOutput out) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "writeExternal");
try {
// write magic
out.writeShort(EXTERNAL_MAGIC);
out.writeShort(MAJOR_VERSION);
out.writeShort(MINOR_VERSION);
// write the interface type (HOME or REMOTE)
if (_isHome) {
out.writeByte(IF_HOME);
} else {
out.writeByte(IF_REMOTE);
}
//89554
// write the Java EE name
writeExternalJ2EEName(out);
// write the external primary key
writeExternalPKey(out);
out.flush();
} finally {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "writeExternal");
}
} | java | public void writeExternal(ObjectOutput out) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "writeExternal");
try {
// write magic
out.writeShort(EXTERNAL_MAGIC);
out.writeShort(MAJOR_VERSION);
out.writeShort(MINOR_VERSION);
// write the interface type (HOME or REMOTE)
if (_isHome) {
out.writeByte(IF_HOME);
} else {
out.writeByte(IF_REMOTE);
}
//89554
// write the Java EE name
writeExternalJ2EEName(out);
// write the external primary key
writeExternalPKey(out);
out.flush();
} finally {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "writeExternal");
}
} | [
"public",
"void",
"writeExternal",
"(",
"ObjectOutput",
"out",
")",
"throws",
"IOException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"writeExternal\"",
")",
";",
"try",
"{",
"// write magic",
"out",
".",
"writeShort",
"(",
"EXTERNAL_MAGIC",
")",
";",
"out",
".",
"writeShort",
"(",
"MAJOR_VERSION",
")",
";",
"out",
".",
"writeShort",
"(",
"MINOR_VERSION",
")",
";",
"// write the interface type (HOME or REMOTE)",
"if",
"(",
"_isHome",
")",
"{",
"out",
".",
"writeByte",
"(",
"IF_HOME",
")",
";",
"}",
"else",
"{",
"out",
".",
"writeByte",
"(",
"IF_REMOTE",
")",
";",
"}",
"//89554",
"// write the Java EE name",
"writeExternalJ2EEName",
"(",
"out",
")",
";",
"// write the external primary key",
"writeExternalPKey",
"(",
"out",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"writeExternal\"",
")",
";",
"}",
"}"
] | writeExternal is called by Java serialization when writeObject
is called on an ObjectOutputStream
for an object of class BeanId. | [
"writeExternal",
"is",
"called",
"by",
"Java",
"serialization",
"when",
"writeObject",
"is",
"called",
"on",
"an",
"ObjectOutputStream",
"for",
"an",
"object",
"of",
"class",
"BeanId",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ExternalizedBeanId.java#L270-L301 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ExternalizedBeanId.java | ExternalizedBeanId.writeExternalPKey | private void writeExternalPKey(ObjectOutput out)
throws java.io.IOException {
// write the serialized primary key - can't mix eternaized stream
// and writeObject so convert to bytes...
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream pkeyStream = new ObjectOutputStream(baos);
pkeyStream.writeObject(pkey);
pkeyStream.flush();
pkeyStream.close();
byte[] pkeyBytes = baos.toByteArray();
out.writeInt(pkeyBytes.length);
out.write(pkeyBytes);
} | java | private void writeExternalPKey(ObjectOutput out)
throws java.io.IOException {
// write the serialized primary key - can't mix eternaized stream
// and writeObject so convert to bytes...
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream pkeyStream = new ObjectOutputStream(baos);
pkeyStream.writeObject(pkey);
pkeyStream.flush();
pkeyStream.close();
byte[] pkeyBytes = baos.toByteArray();
out.writeInt(pkeyBytes.length);
out.write(pkeyBytes);
} | [
"private",
"void",
"writeExternalPKey",
"(",
"ObjectOutput",
"out",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
"{",
"// write the serialized primary key - can't mix eternaized stream",
"// and writeObject so convert to bytes...",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ObjectOutputStream",
"pkeyStream",
"=",
"new",
"ObjectOutputStream",
"(",
"baos",
")",
";",
"pkeyStream",
".",
"writeObject",
"(",
"pkey",
")",
";",
"pkeyStream",
".",
"flush",
"(",
")",
";",
"pkeyStream",
".",
"close",
"(",
")",
";",
"byte",
"[",
"]",
"pkeyBytes",
"=",
"baos",
".",
"toByteArray",
"(",
")",
";",
"out",
".",
"writeInt",
"(",
"pkeyBytes",
".",
"length",
")",
";",
"out",
".",
"write",
"(",
"pkeyBytes",
")",
";",
"}"
] | Private helper method for writeExternal - writes the primary key
@author Adrian Colyer
@param out java.io.ObjectOutput
@exception java.io.IOException The exception description. | [
"Private",
"helper",
"method",
"for",
"writeExternal",
"-",
"writes",
"the",
"primary",
"key"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ExternalizedBeanId.java#L318-L331 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UIComponent.java | UIComponent.getCompositeComponentParent | public static UIComponent getCompositeComponentParent(UIComponent component)
{
if (component == null)
{
return null;
}
UIComponent parent = component;
do
{
parent = parent.getParent();
if (parent != null && UIComponent.isCompositeComponent(parent))
{
return parent;
}
} while (parent != null);
return null;
} | java | public static UIComponent getCompositeComponentParent(UIComponent component)
{
if (component == null)
{
return null;
}
UIComponent parent = component;
do
{
parent = parent.getParent();
if (parent != null && UIComponent.isCompositeComponent(parent))
{
return parent;
}
} while (parent != null);
return null;
} | [
"public",
"static",
"UIComponent",
"getCompositeComponentParent",
"(",
"UIComponent",
"component",
")",
"{",
"if",
"(",
"component",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"UIComponent",
"parent",
"=",
"component",
";",
"do",
"{",
"parent",
"=",
"parent",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
"&&",
"UIComponent",
".",
"isCompositeComponent",
"(",
"parent",
")",
")",
"{",
"return",
"parent",
";",
"}",
"}",
"while",
"(",
"parent",
"!=",
"null",
")",
";",
"return",
"null",
";",
"}"
] | search for the nearest parent composite component, if no parent is found
it has to return null!
if the component itself is null we have to return null as well!
@param component the component to start from
@return the parent composite component if found otherwise null
@since 2.0 | [
"search",
"for",
"the",
"nearest",
"parent",
"composite",
"component",
"if",
"no",
"parent",
"is",
"found",
"it",
"has",
"to",
"return",
"null!"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UIComponent.java#L437-L455 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UIComponent.java | UIComponent.getStateHelper | protected StateHelper getStateHelper(boolean create)
{
if (_stateHelper != null)
{
return _stateHelper;
}
if (create)
{
_stateHelper = new _DeltaStateHelper(this);
}
return _stateHelper;
} | java | protected StateHelper getStateHelper(boolean create)
{
if (_stateHelper != null)
{
return _stateHelper;
}
if (create)
{
_stateHelper = new _DeltaStateHelper(this);
}
return _stateHelper;
} | [
"protected",
"StateHelper",
"getStateHelper",
"(",
"boolean",
"create",
")",
"{",
"if",
"(",
"_stateHelper",
"!=",
"null",
")",
"{",
"return",
"_stateHelper",
";",
"}",
"if",
"(",
"create",
")",
"{",
"_stateHelper",
"=",
"new",
"_DeltaStateHelper",
"(",
"this",
")",
";",
"}",
"return",
"_stateHelper",
";",
"}"
] | returns a delta state saving enabled state helper
for the current component
@param create if true a state helper is created if not already existing
@return an implementation of the StateHelper interface or null if none exists and create is set to false | [
"returns",
"a",
"delta",
"state",
"saving",
"enabled",
"state",
"helper",
"for",
"the",
"current",
"component"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UIComponent.java#L1108-L1119 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UIComponent.java | UIComponent._getHonorCurrentComponentAttributes | private static Boolean _getHonorCurrentComponentAttributes(FacesContext facesContext)
{
// performance note: we cache value in facesContext.attributes because
// 1) methods pushComponentToEL, popComponentFromEl, getCurrentComponent a getCurrentCompositeComponent
// can use that value
// 2) getExternalContext().getInitParameter has undetermined performance. In typical JSF app, there
// are one or two wrappers around external context; servletContext.getInitParameter has also unknown
// implementation and performance
Map<Object, Object> attributes = facesContext.getAttributes();
Boolean paramValue = (Boolean) attributes.get(HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME);
if (paramValue == null)
{
String param
= facesContext.getExternalContext().getInitParameter(HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME);
paramValue = Boolean.valueOf((param != null && Boolean.valueOf(param).booleanValue()));
attributes.put(HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, paramValue);
}
return paramValue;
} | java | private static Boolean _getHonorCurrentComponentAttributes(FacesContext facesContext)
{
// performance note: we cache value in facesContext.attributes because
// 1) methods pushComponentToEL, popComponentFromEl, getCurrentComponent a getCurrentCompositeComponent
// can use that value
// 2) getExternalContext().getInitParameter has undetermined performance. In typical JSF app, there
// are one or two wrappers around external context; servletContext.getInitParameter has also unknown
// implementation and performance
Map<Object, Object> attributes = facesContext.getAttributes();
Boolean paramValue = (Boolean) attributes.get(HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME);
if (paramValue == null)
{
String param
= facesContext.getExternalContext().getInitParameter(HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME);
paramValue = Boolean.valueOf((param != null && Boolean.valueOf(param).booleanValue()));
attributes.put(HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, paramValue);
}
return paramValue;
} | [
"private",
"static",
"Boolean",
"_getHonorCurrentComponentAttributes",
"(",
"FacesContext",
"facesContext",
")",
"{",
"// performance note: we cache value in facesContext.attributes because",
"// 1) methods pushComponentToEL, popComponentFromEl, getCurrentComponent a getCurrentCompositeComponent",
"// can use that value",
"// 2) getExternalContext().getInitParameter has undetermined performance. In typical JSF app, there",
"// are one or two wrappers around external context; servletContext.getInitParameter has also unknown ",
"// implementation and performance",
"Map",
"<",
"Object",
",",
"Object",
">",
"attributes",
"=",
"facesContext",
".",
"getAttributes",
"(",
")",
";",
"Boolean",
"paramValue",
"=",
"(",
"Boolean",
")",
"attributes",
".",
"get",
"(",
"HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME",
")",
";",
"if",
"(",
"paramValue",
"==",
"null",
")",
"{",
"String",
"param",
"=",
"facesContext",
".",
"getExternalContext",
"(",
")",
".",
"getInitParameter",
"(",
"HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME",
")",
";",
"paramValue",
"=",
"Boolean",
".",
"valueOf",
"(",
"(",
"param",
"!=",
"null",
"&&",
"Boolean",
".",
"valueOf",
"(",
"param",
")",
".",
"booleanValue",
"(",
")",
")",
")",
";",
"attributes",
".",
"put",
"(",
"HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME",
",",
"paramValue",
")",
";",
"}",
"return",
"paramValue",
";",
"}"
] | Gets value of "javax.faces.HONOR_CURRENT_COMPONENT_ATTRIBUTES" parameter cached in facesContext.attributes
or resolves that param and caches its value in facesContext.attributes.
@return canonical Boolean value for parameter "javax.faces.HONOR_CURRENT_COMPONENT_ATTRIBUTES" | [
"Gets",
"value",
"of",
"javax",
".",
"faces",
".",
"HONOR_CURRENT_COMPONENT_ATTRIBUTES",
"parameter",
"cached",
"in",
"facesContext",
".",
"attributes",
"or",
"resolves",
"that",
"param",
"and",
"caches",
"its",
"value",
"in",
"facesContext",
".",
"attributes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UIComponent.java#L1358-L1376 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/context/servlet/PartialViewContextImpl.java | PartialViewContextImpl.processPartial | @Override
public void processPartial(PhaseId phaseId)
{
assertNotReleased();
UIViewRoot viewRoot = _facesContext.getViewRoot();
if (phaseId == PhaseId.APPLY_REQUEST_VALUES
|| phaseId == PhaseId.PROCESS_VALIDATIONS
|| phaseId == PhaseId.UPDATE_MODEL_VALUES)
{
processPartialExecute(viewRoot, phaseId);
}
else if (phaseId == PhaseId.RENDER_RESPONSE)
{
processPartialRendering(viewRoot, phaseId);
}
} | java | @Override
public void processPartial(PhaseId phaseId)
{
assertNotReleased();
UIViewRoot viewRoot = _facesContext.getViewRoot();
if (phaseId == PhaseId.APPLY_REQUEST_VALUES
|| phaseId == PhaseId.PROCESS_VALIDATIONS
|| phaseId == PhaseId.UPDATE_MODEL_VALUES)
{
processPartialExecute(viewRoot, phaseId);
}
else if (phaseId == PhaseId.RENDER_RESPONSE)
{
processPartialRendering(viewRoot, phaseId);
}
} | [
"@",
"Override",
"public",
"void",
"processPartial",
"(",
"PhaseId",
"phaseId",
")",
"{",
"assertNotReleased",
"(",
")",
";",
"UIViewRoot",
"viewRoot",
"=",
"_facesContext",
".",
"getViewRoot",
"(",
")",
";",
"if",
"(",
"phaseId",
"==",
"PhaseId",
".",
"APPLY_REQUEST_VALUES",
"||",
"phaseId",
"==",
"PhaseId",
".",
"PROCESS_VALIDATIONS",
"||",
"phaseId",
"==",
"PhaseId",
".",
"UPDATE_MODEL_VALUES",
")",
"{",
"processPartialExecute",
"(",
"viewRoot",
",",
"phaseId",
")",
";",
"}",
"else",
"if",
"(",
"phaseId",
"==",
"PhaseId",
".",
"RENDER_RESPONSE",
")",
"{",
"processPartialRendering",
"(",
"viewRoot",
",",
"phaseId",
")",
";",
"}",
"}"
] | process the partial response
allowed phase ids according to the spec | [
"process",
"the",
"partial",
"response",
"allowed",
"phase",
"ids",
"according",
"to",
"the",
"spec"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/context/servlet/PartialViewContextImpl.java#L404-L421 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/common/utils/internal/RepositoryCommonUtils.java | RepositoryCommonUtils.localeForString | public static Locale localeForString(String localeString) {
if (localeString == null || localeString.isEmpty()) {
return null;
}
Locale locale;
String[] localeParts = localeString.split("_");
switch (localeParts.length) {
case 1:
locale = new Locale(localeParts[0]);
break;
case 2:
locale = new Locale(localeParts[0], localeParts[1]);
break;
default:
// Use default for 3 and above, merge the parts back and put them all in the varient
StringBuilder varient = new StringBuilder(localeParts[2]);
for (int i = 3; i < localeParts.length; i++) {
varient.append("_");
varient.append(localeParts[i]);
}
locale = new Locale(localeParts[0], localeParts[1], varient.toString());
break;
}
return locale;
} | java | public static Locale localeForString(String localeString) {
if (localeString == null || localeString.isEmpty()) {
return null;
}
Locale locale;
String[] localeParts = localeString.split("_");
switch (localeParts.length) {
case 1:
locale = new Locale(localeParts[0]);
break;
case 2:
locale = new Locale(localeParts[0], localeParts[1]);
break;
default:
// Use default for 3 and above, merge the parts back and put them all in the varient
StringBuilder varient = new StringBuilder(localeParts[2]);
for (int i = 3; i < localeParts.length; i++) {
varient.append("_");
varient.append(localeParts[i]);
}
locale = new Locale(localeParts[0], localeParts[1], varient.toString());
break;
}
return locale;
} | [
"public",
"static",
"Locale",
"localeForString",
"(",
"String",
"localeString",
")",
"{",
"if",
"(",
"localeString",
"==",
"null",
"||",
"localeString",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"Locale",
"locale",
";",
"String",
"[",
"]",
"localeParts",
"=",
"localeString",
".",
"split",
"(",
"\"_\"",
")",
";",
"switch",
"(",
"localeParts",
".",
"length",
")",
"{",
"case",
"1",
":",
"locale",
"=",
"new",
"Locale",
"(",
"localeParts",
"[",
"0",
"]",
")",
";",
"break",
";",
"case",
"2",
":",
"locale",
"=",
"new",
"Locale",
"(",
"localeParts",
"[",
"0",
"]",
",",
"localeParts",
"[",
"1",
"]",
")",
";",
"break",
";",
"default",
":",
"// Use default for 3 and above, merge the parts back and put them all in the varient",
"StringBuilder",
"varient",
"=",
"new",
"StringBuilder",
"(",
"localeParts",
"[",
"2",
"]",
")",
";",
"for",
"(",
"int",
"i",
"=",
"3",
";",
"i",
"<",
"localeParts",
".",
"length",
";",
"i",
"++",
")",
"{",
"varient",
".",
"append",
"(",
"\"_\"",
")",
";",
"varient",
".",
"append",
"(",
"localeParts",
"[",
"i",
"]",
")",
";",
"}",
"locale",
"=",
"new",
"Locale",
"(",
"localeParts",
"[",
"0",
"]",
",",
"localeParts",
"[",
"1",
"]",
",",
"varient",
".",
"toString",
"(",
")",
")",
";",
"break",
";",
"}",
"return",
"locale",
";",
"}"
] | Creates a locale based on a String of the form language_country_variant,
either of the last two parts can be omitted.
@param localeString The locale string
@return The locale | [
"Creates",
"a",
"locale",
"based",
"on",
"a",
"String",
"of",
"the",
"form",
"language_country_variant",
"either",
"of",
"the",
"last",
"two",
"parts",
"can",
"be",
"omitted",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/common/utils/internal/RepositoryCommonUtils.java#L27-L51 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/AbstractRemoteRepositoryReader.java | AbstractRemoteRepositoryReader.getLogLists | public Iterable<ServerInstanceLogRecordList> getLogLists(RepositoryPointer after, LogQueryBean query) throws LogRepositoryException {
logger.entering(thisClass, "getLogLists", new Object[]{after, query});
RemoteAllResults lists = readLogLists(query, after);
ArrayList<ServerInstanceLogRecordList> result = new ArrayList<ServerInstanceLogRecordList>();
if (lists != null) {
boolean firstInstance = true;
for (RemoteInstanceDetails indicator: lists.getLogLists()) {
result.add(getLogListForServerInstance(indicator, firstInstance ? after : null));
firstInstance = false;
}
}
logger.exiting(thisClass, "getLogLists", result);
return result;
} | java | public Iterable<ServerInstanceLogRecordList> getLogLists(RepositoryPointer after, LogQueryBean query) throws LogRepositoryException {
logger.entering(thisClass, "getLogLists", new Object[]{after, query});
RemoteAllResults lists = readLogLists(query, after);
ArrayList<ServerInstanceLogRecordList> result = new ArrayList<ServerInstanceLogRecordList>();
if (lists != null) {
boolean firstInstance = true;
for (RemoteInstanceDetails indicator: lists.getLogLists()) {
result.add(getLogListForServerInstance(indicator, firstInstance ? after : null));
firstInstance = false;
}
}
logger.exiting(thisClass, "getLogLists", result);
return result;
} | [
"public",
"Iterable",
"<",
"ServerInstanceLogRecordList",
">",
"getLogLists",
"(",
"RepositoryPointer",
"after",
",",
"LogQueryBean",
"query",
")",
"throws",
"LogRepositoryException",
"{",
"logger",
".",
"entering",
"(",
"thisClass",
",",
"\"getLogLists\"",
",",
"new",
"Object",
"[",
"]",
"{",
"after",
",",
"query",
"}",
")",
";",
"RemoteAllResults",
"lists",
"=",
"readLogLists",
"(",
"query",
",",
"after",
")",
";",
"ArrayList",
"<",
"ServerInstanceLogRecordList",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"ServerInstanceLogRecordList",
">",
"(",
")",
";",
"if",
"(",
"lists",
"!=",
"null",
")",
"{",
"boolean",
"firstInstance",
"=",
"true",
";",
"for",
"(",
"RemoteInstanceDetails",
"indicator",
":",
"lists",
".",
"getLogLists",
"(",
")",
")",
"{",
"result",
".",
"add",
"(",
"getLogListForServerInstance",
"(",
"indicator",
",",
"firstInstance",
"?",
"after",
":",
"null",
")",
")",
";",
"firstInstance",
"=",
"false",
";",
"}",
"}",
"logger",
".",
"exiting",
"(",
"thisClass",
",",
"\"getLogLists\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | returns log records from the repository that are beyond a given
repository location, according to the criteria specified by the log query
bean.
@param after pointer to a record the list will start after
@param query {@link LogQueryBean} instance representing set of criteria
each of which need to be met by the return records.
@return the iterable instance of a list of log records within
a process that are within the parameter range
If no records meet the criteria, an Iterable is returned with no entries | [
"returns",
"log",
"records",
"from",
"the",
"repository",
"that",
"are",
"beyond",
"a",
"given",
"repository",
"location",
"according",
"to",
"the",
"criteria",
"specified",
"by",
"the",
"log",
"query",
"bean",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/AbstractRemoteRepositoryReader.java#L332-L347 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/Connector.java | Connector.validatePossibleEndpoint | private void validatePossibleEndpoint(String possibleEndpoint) throws IllegalArgumentException {
if (!possibleEndpoint.contains(":")) {
throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, possibleEndpoint));
}
String[] components = possibleEndpoint.split(":");
if (components.length != 2) {
throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, possibleEndpoint));
}
try {
Integer.valueOf(components[1]);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, possibleEndpoint));
}
} | java | private void validatePossibleEndpoint(String possibleEndpoint) throws IllegalArgumentException {
if (!possibleEndpoint.contains(":")) {
throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, possibleEndpoint));
}
String[] components = possibleEndpoint.split(":");
if (components.length != 2) {
throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, possibleEndpoint));
}
try {
Integer.valueOf(components[1]);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, possibleEndpoint));
}
} | [
"private",
"void",
"validatePossibleEndpoint",
"(",
"String",
"possibleEndpoint",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"!",
"possibleEndpoint",
".",
"contains",
"(",
"\":\"",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"RESTClientMessagesUtil",
".",
"getMessage",
"(",
"RESTClientMessagesUtil",
".",
"INVALID_ENDPOINT",
",",
"possibleEndpoint",
")",
")",
";",
"}",
"String",
"[",
"]",
"components",
"=",
"possibleEndpoint",
".",
"split",
"(",
"\":\"",
")",
";",
"if",
"(",
"components",
".",
"length",
"!=",
"2",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"RESTClientMessagesUtil",
".",
"getMessage",
"(",
"RESTClientMessagesUtil",
".",
"INVALID_ENDPOINT",
",",
"possibleEndpoint",
")",
")",
";",
"}",
"try",
"{",
"Integer",
".",
"valueOf",
"(",
"components",
"[",
"1",
"]",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"RESTClientMessagesUtil",
".",
"getMessage",
"(",
"RESTClientMessagesUtil",
".",
"INVALID_ENDPOINT",
",",
"possibleEndpoint",
")",
")",
";",
"}",
"}"
] | Validate the possible endpoint String.
@param possibleEndpoint
@throws IllegalArgumentException if the String is not a valid endpoint | [
"Validate",
"the",
"possible",
"endpoint",
"String",
"."
] | 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/Connector.java#L193-L206 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/validation/PathItemValidator.java | PathItemValidator.validatePathAndRetrievePathParams | private Set<String> validatePathAndRetrievePathParams(ValidationHelper helper, Context context, String pathStr) {
String pathToCheck = pathStr;
Set<String> pathParameters = new HashSet<String>();
while (pathToCheck.contains("{")) {
if (!pathToCheck.contains("}")) {
final String message = Tr.formatMessage(tc, "pathItemInvalidFormat", pathStr);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));
return pathParameters;
}
int firstIndex = pathToCheck.indexOf("{");
int lastIndex = pathToCheck.indexOf("}");
if (firstIndex > lastIndex) {
final String message = Tr.formatMessage(tc, "pathItemInvalidFormat", pathStr);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));
return pathParameters;
}
String parameter = pathToCheck.substring(firstIndex + 1, lastIndex);
if (parameter.isEmpty() || parameter.contains("{") || parameter.contains("/")) {
final String message = Tr.formatMessage(tc, "pathItemInvalidFormat", pathStr);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));
return pathParameters;
}
pathParameters.add(parameter);
pathToCheck = pathToCheck.substring(lastIndex + 1);
}
if (pathToCheck.contains("}")) {
final String message = Tr.formatMessage(tc, "pathItemInvalidFormat", pathStr);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));
return pathParameters;
}
return pathParameters;
} | java | private Set<String> validatePathAndRetrievePathParams(ValidationHelper helper, Context context, String pathStr) {
String pathToCheck = pathStr;
Set<String> pathParameters = new HashSet<String>();
while (pathToCheck.contains("{")) {
if (!pathToCheck.contains("}")) {
final String message = Tr.formatMessage(tc, "pathItemInvalidFormat", pathStr);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));
return pathParameters;
}
int firstIndex = pathToCheck.indexOf("{");
int lastIndex = pathToCheck.indexOf("}");
if (firstIndex > lastIndex) {
final String message = Tr.formatMessage(tc, "pathItemInvalidFormat", pathStr);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));
return pathParameters;
}
String parameter = pathToCheck.substring(firstIndex + 1, lastIndex);
if (parameter.isEmpty() || parameter.contains("{") || parameter.contains("/")) {
final String message = Tr.formatMessage(tc, "pathItemInvalidFormat", pathStr);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));
return pathParameters;
}
pathParameters.add(parameter);
pathToCheck = pathToCheck.substring(lastIndex + 1);
}
if (pathToCheck.contains("}")) {
final String message = Tr.formatMessage(tc, "pathItemInvalidFormat", pathStr);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));
return pathParameters;
}
return pathParameters;
} | [
"private",
"Set",
"<",
"String",
">",
"validatePathAndRetrievePathParams",
"(",
"ValidationHelper",
"helper",
",",
"Context",
"context",
",",
"String",
"pathStr",
")",
"{",
"String",
"pathToCheck",
"=",
"pathStr",
";",
"Set",
"<",
"String",
">",
"pathParameters",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"while",
"(",
"pathToCheck",
".",
"contains",
"(",
"\"{\"",
")",
")",
"{",
"if",
"(",
"!",
"pathToCheck",
".",
"contains",
"(",
"\"}\"",
")",
")",
"{",
"final",
"String",
"message",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"pathItemInvalidFormat\"",
",",
"pathStr",
")",
";",
"helper",
".",
"addValidationEvent",
"(",
"new",
"ValidationEvent",
"(",
"ValidationEvent",
".",
"Severity",
".",
"ERROR",
",",
"context",
".",
"getLocation",
"(",
")",
",",
"message",
")",
")",
";",
"return",
"pathParameters",
";",
"}",
"int",
"firstIndex",
"=",
"pathToCheck",
".",
"indexOf",
"(",
"\"{\"",
")",
";",
"int",
"lastIndex",
"=",
"pathToCheck",
".",
"indexOf",
"(",
"\"}\"",
")",
";",
"if",
"(",
"firstIndex",
">",
"lastIndex",
")",
"{",
"final",
"String",
"message",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"pathItemInvalidFormat\"",
",",
"pathStr",
")",
";",
"helper",
".",
"addValidationEvent",
"(",
"new",
"ValidationEvent",
"(",
"ValidationEvent",
".",
"Severity",
".",
"ERROR",
",",
"context",
".",
"getLocation",
"(",
")",
",",
"message",
")",
")",
";",
"return",
"pathParameters",
";",
"}",
"String",
"parameter",
"=",
"pathToCheck",
".",
"substring",
"(",
"firstIndex",
"+",
"1",
",",
"lastIndex",
")",
";",
"if",
"(",
"parameter",
".",
"isEmpty",
"(",
")",
"||",
"parameter",
".",
"contains",
"(",
"\"{\"",
")",
"||",
"parameter",
".",
"contains",
"(",
"\"/\"",
")",
")",
"{",
"final",
"String",
"message",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"pathItemInvalidFormat\"",
",",
"pathStr",
")",
";",
"helper",
".",
"addValidationEvent",
"(",
"new",
"ValidationEvent",
"(",
"ValidationEvent",
".",
"Severity",
".",
"ERROR",
",",
"context",
".",
"getLocation",
"(",
")",
",",
"message",
")",
")",
";",
"return",
"pathParameters",
";",
"}",
"pathParameters",
".",
"add",
"(",
"parameter",
")",
";",
"pathToCheck",
"=",
"pathToCheck",
".",
"substring",
"(",
"lastIndex",
"+",
"1",
")",
";",
"}",
"if",
"(",
"pathToCheck",
".",
"contains",
"(",
"\"}\"",
")",
")",
"{",
"final",
"String",
"message",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"pathItemInvalidFormat\"",
",",
"pathStr",
")",
";",
"helper",
".",
"addValidationEvent",
"(",
"new",
"ValidationEvent",
"(",
"ValidationEvent",
".",
"Severity",
".",
"ERROR",
",",
"context",
".",
"getLocation",
"(",
")",
",",
"message",
")",
")",
";",
"return",
"pathParameters",
";",
"}",
"return",
"pathParameters",
";",
"}"
] | Validate the path and extract path parameters | [
"Validate",
"the",
"path",
"and",
"extract",
"path",
"parameters"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/validation/PathItemValidator.java#L223-L261 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/CompositeEnumeration.java | CompositeEnumeration.add | public CompositeEnumeration<T> add(Enumeration<T> enumeration) {
// optimise out empty enumerations up front
if (enumeration.hasMoreElements())
enumerations.add(enumeration);
return this;
} | java | public CompositeEnumeration<T> add(Enumeration<T> enumeration) {
// optimise out empty enumerations up front
if (enumeration.hasMoreElements())
enumerations.add(enumeration);
return this;
} | [
"public",
"CompositeEnumeration",
"<",
"T",
">",
"add",
"(",
"Enumeration",
"<",
"T",
">",
"enumeration",
")",
"{",
"// optimise out empty enumerations up front",
"if",
"(",
"enumeration",
".",
"hasMoreElements",
"(",
")",
")",
"enumerations",
".",
"add",
"(",
"enumeration",
")",
";",
"return",
"this",
";",
"}"
] | Fluent method for chaining additions of subsequent enumerations. | [
"Fluent",
"method",
"for",
"chaining",
"additions",
"of",
"subsequent",
"enumerations",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/CompositeEnumeration.java#L41-L46 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/OrderingContextProxy.java | OrderingContextProxy.incrementUseCount | public synchronized void incrementUseCount()
throws SIConnectionUnavailableException, SIConnectionDroppedException, SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "incrementUseCount");
// Check if this ordering conext instance is "dead". If it is, then this order context has been closed and
// we need to obtain a new proxy id for it.
if (dead) {
setOrderingContextProxyId();
dead = false;
}
useCount++;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Use count is now: " + useCount);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "incrementUseCount");
} | java | public synchronized void incrementUseCount()
throws SIConnectionUnavailableException, SIConnectionDroppedException, SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "incrementUseCount");
// Check if this ordering conext instance is "dead". If it is, then this order context has been closed and
// we need to obtain a new proxy id for it.
if (dead) {
setOrderingContextProxyId();
dead = false;
}
useCount++;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Use count is now: " + useCount);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "incrementUseCount");
} | [
"public",
"synchronized",
"void",
"incrementUseCount",
"(",
")",
"throws",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
"SIErrorException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"incrementUseCount\"",
")",
";",
"// Check if this ordering conext instance is \"dead\". If it is, then this order context has been closed and",
"// we need to obtain a new proxy id for it.",
"if",
"(",
"dead",
")",
"{",
"setOrderingContextProxyId",
"(",
")",
";",
"dead",
"=",
"false",
";",
"}",
"useCount",
"++",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Use count is now: \"",
"+",
"useCount",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"incrementUseCount\"",
")",
";",
"}"
] | This method will increment the use count on this order context.
@throws SIConnectionUnavailableException
@throws SIConnectionDroppedException
@throws SIErrorException | [
"This",
"method",
"will",
"increment",
"the",
"use",
"count",
"on",
"this",
"order",
"context",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/OrderingContextProxy.java#L133-L149 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/OrderingContextProxy.java | OrderingContextProxy.decrementUseCount | public synchronized void decrementUseCount()
throws SIConnectionDroppedException, SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "decrementUseCount");
useCount--;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Use count is now: " + useCount);
// Now check the use count. If it is 0, we should close the order contex so that the server
// side code can release the resources held by it.
if (useCount == 0)
{
close();
dead = true;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "decrementUseCount");
} | java | public synchronized void decrementUseCount()
throws SIConnectionDroppedException, SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "decrementUseCount");
useCount--;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Use count is now: " + useCount);
// Now check the use count. If it is 0, we should close the order contex so that the server
// side code can release the resources held by it.
if (useCount == 0)
{
close();
dead = true;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "decrementUseCount");
} | [
"public",
"synchronized",
"void",
"decrementUseCount",
"(",
")",
"throws",
"SIConnectionDroppedException",
",",
"SIErrorException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"decrementUseCount\"",
")",
";",
"useCount",
"--",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Use count is now: \"",
"+",
"useCount",
")",
";",
"// Now check the use count. If it is 0, we should close the order contex so that the server",
"// side code can release the resources held by it.",
"if",
"(",
"useCount",
"==",
"0",
")",
"{",
"close",
"(",
")",
";",
"dead",
"=",
"true",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"decrementUseCount\"",
")",
";",
"}"
] | This method will decrement the use count on this order context.
@throws SIConnectionUnavailableException
@throws SIConnectionDroppedException
@throws SIErrorException | [
"This",
"method",
"will",
"decrement",
"the",
"use",
"count",
"on",
"this",
"order",
"context",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/OrderingContextProxy.java#L175-L193 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/OrderingContextProxy.java | OrderingContextProxy.close | public void close()
throws SIConnectionDroppedException, SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "close");
queue = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Returning order context to the order context pool");
final ConnectionProxy cp = getConnectionProxy();
cp.addOrderContext(getProxyID());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "close");
} | java | public void close()
throws SIConnectionDroppedException, SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "close");
queue = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Returning order context to the order context pool");
final ConnectionProxy cp = getConnectionProxy();
cp.addOrderContext(getProxyID());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "close");
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"SIConnectionDroppedException",
",",
"SIErrorException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"close\"",
")",
";",
"queue",
"=",
"null",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Returning order context to the order context pool\"",
")",
";",
"final",
"ConnectionProxy",
"cp",
"=",
"getConnectionProxy",
"(",
")",
";",
"cp",
".",
"addOrderContext",
"(",
"getProxyID",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"close\"",
")",
";",
"}"
] | This method will close the ordering context. This method should ideally be called by the API
application. But at present, it is called by us when the use count is 0. The order context
is only returned to the connection pool of free order contexts as this avoids an exchange
with the server which is costly.
@throws SIConnectionDroppedException
@throws SIErrorException | [
"This",
"method",
"will",
"close",
"the",
"ordering",
"context",
".",
"This",
"method",
"should",
"ideally",
"be",
"called",
"by",
"the",
"API",
"application",
".",
"But",
"at",
"present",
"it",
"is",
"called",
"by",
"us",
"when",
"the",
"use",
"count",
"is",
"0",
".",
"The",
"order",
"context",
"is",
"only",
"returned",
"to",
"the",
"connection",
"pool",
"of",
"free",
"order",
"contexts",
"as",
"this",
"avoids",
"an",
"exchange",
"with",
"the",
"server",
"which",
"is",
"costly",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/OrderingContextProxy.java#L260-L272 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/OrderingContextProxy.java | OrderingContextProxy.associateWithQueue | public void associateWithQueue(Queue queueToAssociate)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "associateWithQueue", queueToAssociate);
this.queue = queueToAssociate;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "associateWithQueue");
} | java | public void associateWithQueue(Queue queueToAssociate)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "associateWithQueue", queueToAssociate);
this.queue = queueToAssociate;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "associateWithQueue");
} | [
"public",
"void",
"associateWithQueue",
"(",
"Queue",
"queueToAssociate",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"associateWithQueue\"",
",",
"queueToAssociate",
")",
";",
"this",
".",
"queue",
"=",
"queueToAssociate",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"associateWithQueue\"",
")",
";",
"}"
] | Called by a proxy queue to associate itself with this ordering context.
@param queueToAssociate | [
"Called",
"by",
"a",
"proxy",
"queue",
"to",
"associate",
"itself",
"with",
"this",
"ordering",
"context",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/OrderingContextProxy.java#L292-L297 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.persistence.utility/src/com/ibm/ws/persistence/utility/DDLGenerationUtility.java | DDLGenerationUtility.getMessage | private String getMessage(String key, Object... args) {
String message = messages.getString(key);
return (args.length == 0) ? message : MessageFormat.format(message, args);
} | java | private String getMessage(String key, Object... args) {
String message = messages.getString(key);
return (args.length == 0) ? message : MessageFormat.format(message, args);
} | [
"private",
"String",
"getMessage",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"String",
"message",
"=",
"messages",
".",
"getString",
"(",
"key",
")",
";",
"return",
"(",
"args",
".",
"length",
"==",
"0",
")",
"?",
"message",
":",
"MessageFormat",
".",
"format",
"(",
"message",
",",
"args",
")",
";",
"}"
] | Get a formatted message. | [
"Get",
"a",
"formatted",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.persistence.utility/src/com/ibm/ws/persistence/utility/DDLGenerationUtility.java#L97-L100 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMessageFactoryImpl.java | JsMessageFactoryImpl.restoreJsMessage | private final JsMessage restoreJsMessage(byte[] buffer, Object store) throws MessageRestoreFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "restoreJsMessage" , buffer);
JsMessage newMsg = null;
String className;
int offset = 0;
/* The buffer contains: */
/* the message class name */
/* the list of JMF schema ids needed to decode the message */
/* the message itself */
// Trace the first 256 bytes just in case we get passed rubbish
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Start of buffer: ", SibTr.formatBytes(buffer, 0, 256));
// Extract the classname from the buffer
int temp = ArrayUtil.readInt(buffer, offset); // the length of the class name
offset += ArrayUtil.INT_SIZE;
try {
className = getClassName(buffer, offset, temp); // the class name itself
}
catch (RuntimeException e) {
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsMessageFactoryImpl.restoreJsMessage", "573", this,
new Object[]{ MfpConstants.DM_BUFFER, buffer, 0, buffer.length});
// This is a disaster - presumably the buffer is garbage - so we have to throw the exception on
throw new MessageRestoreFailedException(e);
}
offset += temp;
// Extract the message schema ids from the buffer, & ensure the schemas are available.
offset = ensureSchemasAvailable(buffer, offset, store);
try {
/* Create a new JMO from the remaining buffer */
JsMsgObject newJmo = new JsMsgObject(JsHdrAccess.schema, JsPayloadAccess.schema, buffer, offset, buffer.length-offset);
/* Get the class for the appropriate specialization */
Class msgClass = Class.forName(className);
/* Now create the new JsMessage and set the JMO */
newMsg = (JsMessage)msgClass.newInstance();
((JsMessageImpl)newMsg).setJmo(newJmo);
/* Set the approxLength as we know it */
((JsMessageImpl)newMsg).setApproximateLength(newJmo.getOriginalLength());
}
catch (ClassNotFoundException e1) {
FFDCFilter.processException(e1, "com.ibm.ws.sib.mfp.impl.JsMessageFactoryImpl.restore", "534");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Exception " + e1.toString() + " finding class " + className);
throw new MessageRestoreFailedException(e1);
}
catch (MessageDecodeFailedException e2) {
/* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageRestoreFailedException(e2);
}
catch (Exception e3) {
/* Any other exceptions from instantiation should never happen */
FFDCFilter.processException(e3, "com.ibm.ws.sib.mfp.impl.JsMessageFactoryImpl.restore", "545");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Exception " + e3.toString() + " instantiating class " + className);
throw new MessageRestoreFailedException(e3);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "restoreJsMessage");
return newMsg;
} | java | private final JsMessage restoreJsMessage(byte[] buffer, Object store) throws MessageRestoreFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "restoreJsMessage" , buffer);
JsMessage newMsg = null;
String className;
int offset = 0;
/* The buffer contains: */
/* the message class name */
/* the list of JMF schema ids needed to decode the message */
/* the message itself */
// Trace the first 256 bytes just in case we get passed rubbish
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Start of buffer: ", SibTr.formatBytes(buffer, 0, 256));
// Extract the classname from the buffer
int temp = ArrayUtil.readInt(buffer, offset); // the length of the class name
offset += ArrayUtil.INT_SIZE;
try {
className = getClassName(buffer, offset, temp); // the class name itself
}
catch (RuntimeException e) {
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsMessageFactoryImpl.restoreJsMessage", "573", this,
new Object[]{ MfpConstants.DM_BUFFER, buffer, 0, buffer.length});
// This is a disaster - presumably the buffer is garbage - so we have to throw the exception on
throw new MessageRestoreFailedException(e);
}
offset += temp;
// Extract the message schema ids from the buffer, & ensure the schemas are available.
offset = ensureSchemasAvailable(buffer, offset, store);
try {
/* Create a new JMO from the remaining buffer */
JsMsgObject newJmo = new JsMsgObject(JsHdrAccess.schema, JsPayloadAccess.schema, buffer, offset, buffer.length-offset);
/* Get the class for the appropriate specialization */
Class msgClass = Class.forName(className);
/* Now create the new JsMessage and set the JMO */
newMsg = (JsMessage)msgClass.newInstance();
((JsMessageImpl)newMsg).setJmo(newJmo);
/* Set the approxLength as we know it */
((JsMessageImpl)newMsg).setApproximateLength(newJmo.getOriginalLength());
}
catch (ClassNotFoundException e1) {
FFDCFilter.processException(e1, "com.ibm.ws.sib.mfp.impl.JsMessageFactoryImpl.restore", "534");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Exception " + e1.toString() + " finding class " + className);
throw new MessageRestoreFailedException(e1);
}
catch (MessageDecodeFailedException e2) {
/* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageRestoreFailedException(e2);
}
catch (Exception e3) {
/* Any other exceptions from instantiation should never happen */
FFDCFilter.processException(e3, "com.ibm.ws.sib.mfp.impl.JsMessageFactoryImpl.restore", "545");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Exception " + e3.toString() + " instantiating class " + className);
throw new MessageRestoreFailedException(e3);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "restoreJsMessage");
return newMsg;
} | [
"private",
"final",
"JsMessage",
"restoreJsMessage",
"(",
"byte",
"[",
"]",
"buffer",
",",
"Object",
"store",
")",
"throws",
"MessageRestoreFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"restoreJsMessage\"",
",",
"buffer",
")",
";",
"JsMessage",
"newMsg",
"=",
"null",
";",
"String",
"className",
";",
"int",
"offset",
"=",
"0",
";",
"/* The buffer contains: */",
"/* the message class name */",
"/* the list of JMF schema ids needed to decode the message */",
"/* the message itself */",
"// Trace the first 256 bytes just in case we get passed rubbish",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Start of buffer: \"",
",",
"SibTr",
".",
"formatBytes",
"(",
"buffer",
",",
"0",
",",
"256",
")",
")",
";",
"// Extract the classname from the buffer",
"int",
"temp",
"=",
"ArrayUtil",
".",
"readInt",
"(",
"buffer",
",",
"offset",
")",
";",
"// the length of the class name",
"offset",
"+=",
"ArrayUtil",
".",
"INT_SIZE",
";",
"try",
"{",
"className",
"=",
"getClassName",
"(",
"buffer",
",",
"offset",
",",
"temp",
")",
";",
"// the class name itself",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.mfp.impl.JsMessageFactoryImpl.restoreJsMessage\"",
",",
"\"573\"",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"MfpConstants",
".",
"DM_BUFFER",
",",
"buffer",
",",
"0",
",",
"buffer",
".",
"length",
"}",
")",
";",
"// This is a disaster - presumably the buffer is garbage - so we have to throw the exception on",
"throw",
"new",
"MessageRestoreFailedException",
"(",
"e",
")",
";",
"}",
"offset",
"+=",
"temp",
";",
"// Extract the message schema ids from the buffer, & ensure the schemas are available.",
"offset",
"=",
"ensureSchemasAvailable",
"(",
"buffer",
",",
"offset",
",",
"store",
")",
";",
"try",
"{",
"/* Create a new JMO from the remaining buffer */",
"JsMsgObject",
"newJmo",
"=",
"new",
"JsMsgObject",
"(",
"JsHdrAccess",
".",
"schema",
",",
"JsPayloadAccess",
".",
"schema",
",",
"buffer",
",",
"offset",
",",
"buffer",
".",
"length",
"-",
"offset",
")",
";",
"/* Get the class for the appropriate specialization */",
"Class",
"msgClass",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
";",
"/* Now create the new JsMessage and set the JMO */",
"newMsg",
"=",
"(",
"JsMessage",
")",
"msgClass",
".",
"newInstance",
"(",
")",
";",
"(",
"(",
"JsMessageImpl",
")",
"newMsg",
")",
".",
"setJmo",
"(",
"newJmo",
")",
";",
"/* Set the approxLength as we know it */",
"(",
"(",
"JsMessageImpl",
")",
"newMsg",
")",
".",
"setApproximateLength",
"(",
"newJmo",
".",
"getOriginalLength",
"(",
")",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e1",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e1",
",",
"\"com.ibm.ws.sib.mfp.impl.JsMessageFactoryImpl.restore\"",
",",
"\"534\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Exception \"",
"+",
"e1",
".",
"toString",
"(",
")",
"+",
"\" finding class \"",
"+",
"className",
")",
";",
"throw",
"new",
"MessageRestoreFailedException",
"(",
"e1",
")",
";",
"}",
"catch",
"(",
"MessageDecodeFailedException",
"e2",
")",
"{",
"/* No need to FFDC this as JsMsgObject will already have done so */",
"// No FFDC code needed",
"throw",
"new",
"MessageRestoreFailedException",
"(",
"e2",
")",
";",
"}",
"catch",
"(",
"Exception",
"e3",
")",
"{",
"/* Any other exceptions from instantiation should never happen */",
"FFDCFilter",
".",
"processException",
"(",
"e3",
",",
"\"com.ibm.ws.sib.mfp.impl.JsMessageFactoryImpl.restore\"",
",",
"\"545\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Exception \"",
"+",
"e3",
".",
"toString",
"(",
")",
"+",
"\" instantiating class \"",
"+",
"className",
")",
";",
"throw",
"new",
"MessageRestoreFailedException",
"(",
"e3",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"restoreJsMessage\"",
")",
";",
"return",
"newMsg",
";",
"}"
] | Restore a JsMessage of any specializaton from a 'flattenned' copy.
Since SIB0112b, this method is only called by the preceding restoreJsMessage
method so it is marked private.
@param buffer The byte array representing the message.
@param store The MesasgeStore from which the message is being recovered, may be null.
@return The new JsMessage of appropriate specialization
@exception MessageRestoreFailedException Thrown if the message could not be restored | [
"Restore",
"a",
"JsMessage",
"of",
"any",
"specializaton",
"from",
"a",
"flattenned",
"copy",
".",
"Since",
"SIB0112b",
"this",
"method",
"is",
"only",
"called",
"by",
"the",
"preceding",
"restoreJsMessage",
"method",
"so",
"it",
"is",
"marked",
"private",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMessageFactoryImpl.java#L446-L511 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMessageFactoryImpl.java | JsMessageFactoryImpl.ensureSchemasAvailable | private final static int ensureSchemasAvailable(byte[] buffer, int offset, Object store) throws MessageRestoreFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "ensureSchemasAvailable", new Object[] {offset, store});
// If we have a message store we need to ensure all the schemas we'll
// need to decode the message are restored from the store.
int temp = ArrayUtil.readInt(buffer, offset); // the number of encoding Ids
offset += ArrayUtil.INT_SIZE;
long[] decodeIds = new long[temp];
for (int i = 0; i < temp; i++) {
decodeIds[i] = ArrayUtil.readLong(buffer, offset); // each encoding schema id
offset += ArrayUtil.LONG_SIZE;
}
if (store != null && decodeIds.length > 0) {
if (!(store instanceof MessageStore)) throw new IllegalArgumentException("store is not a MessageStore instance");
SchemaStore.loadSchemas((MessageStore)store, decodeIds);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "ensureSchemasAvailable", offset);
return offset;
} | java | private final static int ensureSchemasAvailable(byte[] buffer, int offset, Object store) throws MessageRestoreFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "ensureSchemasAvailable", new Object[] {offset, store});
// If we have a message store we need to ensure all the schemas we'll
// need to decode the message are restored from the store.
int temp = ArrayUtil.readInt(buffer, offset); // the number of encoding Ids
offset += ArrayUtil.INT_SIZE;
long[] decodeIds = new long[temp];
for (int i = 0; i < temp; i++) {
decodeIds[i] = ArrayUtil.readLong(buffer, offset); // each encoding schema id
offset += ArrayUtil.LONG_SIZE;
}
if (store != null && decodeIds.length > 0) {
if (!(store instanceof MessageStore)) throw new IllegalArgumentException("store is not a MessageStore instance");
SchemaStore.loadSchemas((MessageStore)store, decodeIds);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "ensureSchemasAvailable", offset);
return offset;
} | [
"private",
"final",
"static",
"int",
"ensureSchemasAvailable",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"Object",
"store",
")",
"throws",
"MessageRestoreFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"ensureSchemasAvailable\"",
",",
"new",
"Object",
"[",
"]",
"{",
"offset",
",",
"store",
"}",
")",
";",
"// If we have a message store we need to ensure all the schemas we'll",
"// need to decode the message are restored from the store.",
"int",
"temp",
"=",
"ArrayUtil",
".",
"readInt",
"(",
"buffer",
",",
"offset",
")",
";",
"// the number of encoding Ids",
"offset",
"+=",
"ArrayUtil",
".",
"INT_SIZE",
";",
"long",
"[",
"]",
"decodeIds",
"=",
"new",
"long",
"[",
"temp",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"temp",
";",
"i",
"++",
")",
"{",
"decodeIds",
"[",
"i",
"]",
"=",
"ArrayUtil",
".",
"readLong",
"(",
"buffer",
",",
"offset",
")",
";",
"// each encoding schema id",
"offset",
"+=",
"ArrayUtil",
".",
"LONG_SIZE",
";",
"}",
"if",
"(",
"store",
"!=",
"null",
"&&",
"decodeIds",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"!",
"(",
"store",
"instanceof",
"MessageStore",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"store is not a MessageStore instance\"",
")",
";",
"SchemaStore",
".",
"loadSchemas",
"(",
"(",
"MessageStore",
")",
"store",
",",
"decodeIds",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"ensureSchemasAvailable\"",
",",
"offset",
")",
";",
"return",
"offset",
";",
"}"
] | Utility method to extract the schema ids from a message buffer and, if a
message store is supplied, check that all the necessary schemas are available.
@param buffer The buffer containing the schema ids
@param offset The offset into the buffer where the schema ids start
@param store The MesasgeStore from which the message is being recovered, may be null.
@return int The offset in the buffer of the first byte after the schema ids
@exception MessageRestoreFailedException is thrown if the necessary schemas are not available. | [
"Utility",
"method",
"to",
"extract",
"the",
"schema",
"ids",
"from",
"a",
"message",
"buffer",
"and",
"if",
"a",
"message",
"store",
"is",
"supplied",
"check",
"that",
"all",
"the",
"necessary",
"schemas",
"are",
"available",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMessageFactoryImpl.java#L563-L582 | train |
Subsets and Splits