code
stringlengths 73
34.1k
| label
stringclasses 1
value |
|---|---|
public void delCacheEntry(CacheEntry ce, int cause, int source, boolean fromDepIdTemplateInvalidation) {
htod.delCacheEntry(ce, cause, source, fromDepIdTemplateInvalidation);
}
|
java
|
public void delCacheEntry(ValueSet removeList, int cause, int source, boolean fromDepIdTemplateInvalidation, boolean fireEvent) {
htod.delCacheEntry(removeList, cause, source, fromDepIdTemplateInvalidation, fireEvent);
}
|
java
|
public ValueSet readDependency(Object id, boolean delete) { // SKS-O
Result result = htod.readDependency(id, delete);
if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(result.diskException);
this.htod.returnToResultPool(result);
return HTODDynacache.EMPTY_VS;
}
ValueSet valueSet = (ValueSet) result.data;
if (valueSet == null) {
valueSet = HTODDynacache.EMPTY_VS;
}
this.htod.returnToResultPool(result);
return valueSet;
}
|
java
|
public ValueSet readTemplate(String template, boolean delete) {
Result result = htod.readTemplate(template, delete);
if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(result.diskException);
this.htod.returnToResultPool(result);
return HTODDynacache.EMPTY_VS;
}
ValueSet valueSet = (ValueSet) result.data;
if (valueSet == null) {
valueSet = HTODDynacache.EMPTY_VS;
}
this.htod.returnToResultPool(result);
return valueSet;
}
|
java
|
public ValueSet readTemplatesByRange(int index, int length) {
Result result = htod.readTemplatesByRange(index, length);
if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(result.diskException);
this.htod.returnToResultPool(result);
return HTODDynacache.EMPTY_VS;
}
ValueSet valueSet = (ValueSet) result.data;
if (valueSet == null) {
valueSet = HTODDynacache.EMPTY_VS;
}
this.htod.returnToResultPool(result);
return valueSet;
}
|
java
|
public int getCacheIdsSize(boolean filter) {
if (filter == CacheOnDisk.FILTER) {
return htod.getCacheIdsSize(filter) - htod.invalidationBuffer.size();
} else {
return htod.getCacheIdsSize(filter);
}
}
|
java
|
public void delDependencyEntry(Object id, Object entry) { // SKS-O
if (htod.delDependencyEntry(id, entry) == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
}
|
java
|
public void delTemplateEntry(String template, Object entry) {
if (htod.delTemplateEntry(template, entry) == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
}
|
java
|
public void delDependency(Object id) { // SKS-O
if (htod.delDependency(id) == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
}
|
java
|
public void delTemplate(String template) {
if (htod.delTemplate(template) == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
}
|
java
|
public int writeDependency(Object id, ValueSet vs) { // SKS-O
int returnCode = htod.writeDependency(id, vs);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
}
|
java
|
public int writeTemplate(String template, ValueSet vs) {
int returnCode = htod.writeTemplate(template, vs);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
}
|
java
|
public int writeDependencyEntry(Object id, Object entry) { // SKS-O
int returnCode = htod.writeDependencyEntry(id, entry);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
}
|
java
|
public int writeTemplateEntry(String template, Object entry) {
int returnCode = htod.writeTemplateEntry(template, entry);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
}
|
java
|
protected long calculateSleepTime() {
Calendar c = new GregorianCalendar();
int currentHour = c.get(Calendar.HOUR_OF_DAY);
int currentMin = c.get(Calendar.MINUTE);
int currentSec = c.get(Calendar.SECOND);
long stime = SECONDS_FOR_24_HOURS - ((currentHour * 60 + currentMin) * 60 + currentSec) + cleanupHour * 60 * 60;
if (stime > SECONDS_FOR_24_HOURS) {
stime = stime - SECONDS_FOR_24_HOURS;
}
if (stime < 10) {
stime = 10;
}
stime = stime * 1000; // convert to msec
return stime;
}
|
java
|
public void clearInvalidationBuffers() {
this.htod.invalidationBuffer.clear(HTODInvalidationBuffer.EXPLICIT_BUFFER); // 3821 NK begin
this.htod.invalidationBuffer.clear(HTODInvalidationBuffer.SCAN_BUFFER);
if (this.evictionPolicy != CacheConfig.EVICTION_NONE) {
this.htod.invalidationBuffer.clear(HTODInvalidationBuffer.GC_BUFFER); // 3821 NK end
}
}
|
java
|
public Result readHashcodeByRange(int index, int length, boolean debug, boolean useValue) { // LI4337-17
Result result = this.htod.readHashcodeByRange(index, length, debug, useValue);
if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(result.diskException);
}
return result;
}
|
java
|
public int updateExpirationTime(Object id, long oldExpirationTime, int size, long newExpirationTime, long newValidatorExpirationTime) {
int returnCode = this.htod.updateExpirationTime(id, oldExpirationTime, size, newExpirationTime, newValidatorExpirationTime);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
}
|
java
|
protected int checkDirectoryWriteable(String location) {
final String methodName = "checkDirectoryWriteable()";
int rc = CacheOnDisk.LOCATION_OK;
if (location.equals("")) {
rc = CacheOnDisk.LOCATION_NOT_DEFINED;
} else if (location.startsWith("${") && location.indexOf("}") > 0) {
rc = CacheOnDisk.LOCATION_NOT_VALID;
} else {
try {
File f = new File(location);
if (!f.exists()) {
if (!f.mkdirs()) {
rc = CacheOnDisk.LOCATION_CANNOT_MAKE_DIR;
}
} else if (!f.isDirectory()) {
rc = CacheOnDisk.LOCATION_NOT_DIRECTORY;
} else if (!f.canWrite()) {
rc = CacheOnDisk.LOCATION_NOT_WRITABLE;
}
} catch (Throwable t) {
rc = CacheOnDisk.LOCATION_NOT_WRITABLE;
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.CacheOnDisk.checkDirectoryWriteable", "1779", this);
traceDebug(methodName, "cacheName=" + this.cacheName + " location=" + location + "\nException: " + ExceptionUtility.getStackTrace(t));
}
}
traceDebug(methodName, "cacheName=" + this.cacheName + " location=" + location + " rc=" + rc);
return rc;
}
|
java
|
public static String getRepositorySubpath(MavenCoordinates artifact) {
StringBuffer buf = new StringBuffer();
String[] groupDirs = artifact.getGroupId().split("\\.");
for (String dir : groupDirs) {
buf.append(dir).append("/");
}
buf.append(artifact.getArtifactId()).append("/").append(artifact.getVersion());
return buf.toString();
}
|
java
|
public static String getFileName(MavenCoordinates artifact, Constants.ArtifactType type) {
return artifact.getArtifactId() + "-" + artifact.getVersion() + type.getMavenFileExtension();
}
|
java
|
@Override
public void clearBody() throws javax.jms.JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "clearBody");
// Set the message into write-only mode, handle generic actions
super.clearBody();
// Clear the locally stored reference to body of the message, and ensure the
// 'read' stream is set to null
dataBuffer = null;
dataStart = 0; // @P2A
readStream = null;
// remove the encoding and character set properties as these pertain to the
// body which is being cleared.
// SIB0121: also clear the underlying MFP payload
if (jsBytesMsg != null) {
jsBytesMsg.setBytes(null);
jsBytesMsg.setObjectProperty(ApiJmsConstants.ENCODING_PROPERTY, null);
jsBytesMsg.setObjectProperty(ApiJmsConstants.CHARSET_PROPERTY, null);
}
integerEncoding = ApiJmsConstants.ENC_INTEGER_NORMAL; // reset to standard Java encoding
floatEncoding = ApiJmsConstants.ENC_FLOAT_IEEE_NORMAL; // reset to standard Java encoding
// Invalidate the cached toString object.
cachedBytesToString = null;
// This class has different behaviour depending on the whether the
// producer might modify the payload after it's been set or not
if (!producerWontModifyPayloadAfterSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer might modify the payload after set - encoding is required, so reinitialise encoding relating variables");
// Prepare a new stream for the client to write to
_writeBytes = new ByteArrayOutputStream();
writeStream = new DataOutputStream(_writeBytes);
// Initialise the arrays used to record the position of numeric items
integer_count = 0;
// number of integer items recorded in the current arrays
integer_offsets = new int[ARRAY_SIZE];
// offset of start of each numeric item
integer_sizes = new int[ARRAY_SIZE];
// length in byte of the item in question
if (integers != null)
integers.removeAllElements();
// arrays which we filled up are stored in this vector - remove them all
if (float_offsets != null)
float_offsets.removeAllElements();
if (float_values != null)
float_values.removeAllElements();
// Ensure that the new data gets exported when the time comes.
bodySetInJsMsg = false;
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer has promised not to modify payload - ensure write streams used for encoding are null");
// Ensure the write stream variables are null - they are never used when the
// producer has promised not to modify the payload after it's been set
_writeBytes = null;
writeStream = null;
// Ensure the producer promise flag is checked correctly in the writeBytes method
writeByteArrayCalled = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "clearBody");
}
|
java
|
@Override
public byte readByte() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readByte");
try {
// Check that we are in read mode
checkBodyReadable("readByte");
if (requiresInit)
lazyInitForReading();
// Read the byte from the input stream
byte byteRead = readStream.readByte(); // read the byte
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readByte", byteRead);
return byteRead;
} catch (IOException e) {
JMSException jmse = (JMSException) JmsErrorUtils.newThrowable(
MessageEOFException.class,
"END_BYTESMESSAGE_CWSIA0183",
null,
tc);
jmse.initCause(e);
throw jmse;
}
}
|
java
|
@Override
public int readBytes(byte[] value, int length) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readBytes", new Object[] { value, length });
try {
// Check that we are in read mode
checkBodyReadable("readBytes");
if (requiresInit)
lazyInitForReading();
// Check that there's enough room in the byte array supplied by the application for the number of
// bytes requested
if (value.length < length || length < 0)
throw new IndexOutOfBoundsException();
// Attempt to read into the application's byte array. If there are insufficient bytes in the message readStream
// then this method returns the number actually read. If we've reached the end of data, it returns -1
int result = readStream.read(value, 0, length);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readBytes", result);
return result;
} catch (IOException e) {
JMSException jmse = (JMSException) JmsErrorUtils.newThrowable(
MessageEOFException.class,
"END_BYTESMESSAGE_CWSIA0183",
null,
tc);
jmse.initCause(e);
throw jmse;
}
}
|
java
|
@Override
public char readChar() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readChar");
try {
// Check that we are in read mode
checkBodyReadable("readChar");
if (requiresInit)
lazyInitForReading();
// Mark the current position, so we can return to it if there's an error
readStream.mark(2);
char result = readStream.readChar();
// Byte swap the character if required
if (integerEncoding == ApiJmsConstants.ENC_INTEGER_REVERSED) {
result = Character.reverseBytes(result);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readChar", result);
return result;
} catch (IOException e) {
try {
readStream.reset(); // return to the marked position
} catch (IOException e2) {
}
JMSException jmse = (JMSException) JmsErrorUtils.newThrowable(
MessageEOFException.class,
"END_BYTESMESSAGE_CWSIA0183",
null,
tc);
jmse.initCause(e);
throw jmse;
}
}
|
java
|
@Override
public long readLong() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readLong");
try {
// Check that we are in read mode
checkBodyReadable("readLong");
if (requiresInit)
lazyInitForReading();
// Mark the current position, so we can return to it if there's an error
readStream.mark(8); // the argument appears to be ignored
long result = readStream.readLong();
// Byte swap the long if required
if (integerEncoding == ApiJmsConstants.ENC_INTEGER_REVERSED) {
result = Long.reverseBytes(result);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readLong", result);
return result;
} catch (IOException e) {
try {
readStream.reset();
} catch (IOException e2) {
}
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0190",
new Object[] { e, "JmsBytesMessageImpl.readLong" },
e,
"JmsBytesMessageImpl.readLong#1",
this,
tc);
}
}
|
java
|
@Override
public String readUTF() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readUTF");
String result;
try {
// Check that we are in read mode
checkBodyReadable("readUTF");
if (requiresInit)
lazyInitForReading();
// Mark the current position, so we can return to it if there's an error
readStream.mark(8); // the argument appears to be ignored
result = readStream.readUTF();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readUTF", result);
return result;
} catch (IOException e) {
try {
readStream.reset(); // return to the marked position
} catch (IOException e2) {
}
JMSException jmse = (JMSException) JmsErrorUtils.newThrowable(
MessageEOFException.class,
"END_BYTESMESSAGE_CWSIA0183",
null,
tc);
jmse.initCause(e);
throw jmse;
}
}
|
java
|
@Override
public void reset() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "reset");
// After reset has been called, the message body is immutable (the only way of changing it is to
// call clearBody and start again). If we're in Write Mode, we need to convert the writeStream
// to a byte array and switch into read mode. If we're in Read Mode, we must have already done this,
// so we don't want to do it again
if (!isBodyReadOnly()) {
// If the producer won't modify the payload after set,skip the
// encoding of the write stream because encoding is not needed
if (!producerWontModifyPayloadAfterSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Body is writeable & producer might modify the payload, so encode the write stream");
// Convert the stream in which the message was being assembled to a byte array
dataBuffer = _writeBytes.toByteArray();
// store the content in the JS msg
lastEncoding = integerEncoding | floatEncoding;
jsBytesMsg.setBytes(_exportBody(lastEncoding));
bodySetInJsMsg = true;
// Throw away the write stream
writeStream = null;
_writeBytes = null;
}
dataStart = 0; // start from the first byte in the buffer
// The message is now read only
setBodyReadOnly();
}
// For some odd reason, after receiving an 'empty' message the dataBuffer
// is null rather than pointing to an empty array. This will compensate
// hopefully without any side effects - SXA #58832
if (dataBuffer == null)
dataBuffer = new byte[0];
// Create a Byte array input stream for the readxxx methods to operate on. We have to create a new
// stream each time (rather than call the stream's read method), as the stream may have a position
// marked in it that isn't at the start.
_readBytes = new ByteArrayInputStream(dataBuffer);
readStream = new DataInputStream(_readBytes);
// Jump over any header that might be present in the dataBuffer
// JBK - I don't think we will ever have dataStart!=0 in JS, but I'm
// leaving the capability here until I understand better.
try {
readStream.skip(dataStart);
} catch (IOException e) {
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "reset");
}
|
java
|
@Override
public void writeBytes(byte[] value) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeBytes", value);
try {
// Check that we are in write mode
checkBodyWriteable("writeBytes");
// This method has different behaviours for storing the byte array, based on the whether the producer
// has promised not to mess with data after it's been written...
if (producerWontModifyPayloadAfterSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer has promised not to modify the payload after setting it in the message - check if they've violated that promise");
// The producer has promised not to modify the payload after it's been set, so check
// the flag to see whether this is the first, or a subsequent call to writeBytes.
if (!writeByteArrayCalled) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "This is the first call to writeBytes(byte[] value) - storing the byte array reference directly in the underlying MFP object");
writeByteArrayCalled = true;
// Set the data buffer & MFP data references to the value param & reset
// the dataStart attribute
jsBytesMsg.setBytes(value);
dataBuffer = value;
dataStart = 0;
}
else {
// The producer has promised not to modify the payload after it's been set, but the producer has
// been naughty by calling this method more than once! Throw exception to admonish the producer.
throw (JMSException) JmsErrorUtils.newThrowable(
IllegalStateException.class, // JMS illegal state exception
"PROMISE_BROKEN_EXCEPTION_CWSIA0511", // promise broken
null, // No inserts
null, // no cause - original exception
"JmsBytesMessageImpl.writeBytes#3", // Probe ID
this, // Caller (?)
tc); // Trace component
}
}
else {
// Producer makes no promises relating to the accessing the message payload, so
// make a copy of the byte array at this point to ensure the message is transmitted safely.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer 'payload modification' promise is not in place - make a copy of the byte array");
// Write the byte array to the output stream
// We don't check for value==null as JDK1.1.6 DataOutputStream doesn't
writeStream.write(value, 0, value.length);
// Ensure that the new data gets exported when the time comes.
bodySetInJsMsg = false;
}
// Invalidate the cached toString object, because the message payload has changed.
cachedBytesToString = null;
}
catch (IOException ex) {
// No FFDC code needed
//(exception repro'ed from 3-param writeBytes method)
throw (JMSException) JmsErrorUtils.newThrowable(
ResourceAllocationException.class,
"WRITE_PROBLEM_CWSIA0186",
null,
ex,
"JmsBytesMessageImpl.writeBytes#4",
this,
tc);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "writeBytes");
}
|
java
|
@Override
public void writeBytes(byte[] value, int offset, int length) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeBytes", new Object[] { value, offset, length });
try {
// Check if the producer has promised not to modify the payload after it's been set
checkProducerPromise("writeBytes(byte[], int, int)", "JmsBytesMessageImpl.writeBytes#2");
// Check that we are in write mode
checkBodyWriteable("writeBytes");
// Write the byte array to the output stream
// We don't check for value==null as JDK1.1.6 DataOutputStream doesn't
writeStream.write(value, offset, length);
// Invalidate the cached toString object.
cachedBytesToString = null;
// Ensure that the new data gets exported when the time comes.
bodySetInJsMsg = false;
}
// We don't expect the writeBytes to fail, but we need to catch the exception anyway
catch (IOException ex) {
// No FFDC code needed
// d238447 review. Generate FFDC for this case.
throw (JMSException) JmsErrorUtils.newThrowable(
ResourceAllocationException.class,
"WRITE_PROBLEM_CWSIA0186",
null,
ex,
"JmsBytesMessageImpl.writeBytes#1",
this,
tc);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "writeBytes");
}
|
java
|
@Override
public void writeObject(Object value) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "writeObject");
// Check if the producer has promised not to modify the payload after it's been set
checkProducerPromise("writeObject(Object)", "JmsBytesMessageImpl.writeObject#1");
// Check that we are in write mode (doing this test here ensures
// any error message refers to the correct method)
checkBodyWriteable("writeObject");
if (value instanceof byte[])
writeBytes((byte[]) value);
else if (value instanceof String)
writeUTF((String) value);
else if (value instanceof Integer)
writeInt(((Integer) value).intValue());
else if (value instanceof Byte)
writeByte(((Byte) value).byteValue());
else if (value instanceof Short)
writeShort(((Short) value).shortValue());
else if (value instanceof Long)
writeLong(((Long) value).longValue());
else if (value instanceof Float)
writeFloat(((Float) value).floatValue());
else if (value instanceof Double)
writeDouble(((Double) value).doubleValue());
else if (value instanceof Character)
writeChar(((Character) value).charValue());
else if (value instanceof Boolean)
writeBoolean(((Boolean) value).booleanValue());
else if (value == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "given null, throwing NPE");
throw new NullPointerException();
}
else {
// d238447 FFDC review. Passing in an object of the wrong type is an app error,
// so no FFDC needed here.
throw (JMSException) JmsErrorUtils.newThrowable(
MessageFormatException.class,
"BAD_OBJECT_CWSIA0185",
new Object[] { value.getClass().getName() },
tc);
}
// Invalidate the cached toString object.
cachedBytesToString = null;
// Ensure that the new data gets exported when the time comes.
bodySetInJsMsg = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeObject");
}
|
java
|
@Override
protected JsJmsMessage getMsgReference() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getMsgReference");
// If the body is read only, the contents should already be in the
// JS message, so only do the copy over if we are in write mode.
// SIB0121: ... and if the producer might modify the payload after it's been set
if (!isBodyReadOnly() && !producerWontModifyPayloadAfterSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Body is writeable & producer hasn't promised not to modify the payload - attempt encoding");
try {
int encoding = integerEncoding | floatEncoding; // NB bitwise or (|), not logical or (||)
// check if JMS_IBM_Encoding has been set
if (propertyExists(ApiJmsConstants.ENCODING_PROPERTY)) {
encoding = getIntProperty(ApiJmsConstants.ENCODING_PROPERTY);
}
if (bodySetInJsMsg && (encoding == lastEncoding)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Body cached - encoding not necessary");
}
else {
// flatten and encode the data streams
byte[] encodedBody = _exportBody(encoding);
// and set it into the Jetstream message
jsBytesMsg.setBytes(encodedBody);
lastEncoding = encoding;
bodySetInJsMsg = true;
}
}
catch (JMSException e) {
// No FFDC code needed
// d222942 review JMSException could be thrown by _exportBody if passed an unknown
// value for encoding, or if there was an IO error handling the streams. These already
// have good nls messages, so we should simply pass on, not wrap with a generic message.
// Similarly, getIntProperty can throw a JMSException which can also be passed on.
throw e;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getMsgReference", jsBytesMsg);
return jsBytesMsg;
}
|
java
|
private void recordInteger(int offset, int length) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "recordInteger", new Object[] { offset, length });
// If the current arrays are full, save them in the vector and allocate some new ones
if (integer_count == ARRAY_SIZE) {
if (integers == null)
integers = new Vector();
integers.addElement(integer_offsets);
integers.addElement(integer_sizes);
integer_offsets = new int[ARRAY_SIZE];
integer_sizes = new int[ARRAY_SIZE];
integer_count = 0;
}
// Add the offset and size of the current numeric item to the arrays
integer_offsets[integer_count] = offset;
integer_sizes[integer_count++] = length;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "recordInteger");
}
|
java
|
private void reverse(byte[] buffer, int offset, int length) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "reverse", new Object[] { buffer, offset, length });
byte temp;
for (int i = 0; i < length / 2; i++) {
temp = buffer[offset + i];
buffer[offset + i] = buffer[offset + (length - 1) - i];
buffer[offset + (length - 1) - i] = temp;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "reverse");
}
|
java
|
private void checkProducerPromise(String jmsMethod, String ffdcProbeID) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "checkProducerPromise", new Object[] { jmsMethod, ffdcProbeID });
// Only proceed if the producer hasn't promised not to modify the payload
// after setting it.
if (producerWontModifyPayloadAfterSet) {
throw (JMSException) JmsErrorUtils.newThrowable(
IllegalStateException.class, // JMS illegal state exception
"PROMISE_BROKEN_EXCEPTION_CWSIA0510", // promise broken
new Object[] { jmsMethod }, // insert = jms method name
null, // no cause, original exception
ffdcProbeID, // Probe ID
this, // caller (?)
tc); // Trace component
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "checkProducerPromise");
}
|
java
|
public void stopConsumer() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "stopConsumer");
try {
// lock the consumerSession to ensure visibility of update to started.
synchronized (consumerSession) {
consumerSession.getConsumerSession().stop();
consumerSession.started = false;
}
} catch (Throwable t) {
FFDCFilter.processException(t,
CLASS_NAME + ".consumeMessages",
CommsConstants.CATASYNCHRHREADER_CONSUME_MSGS_02,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Unable to stop consumer session due to Throwable: " + t);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "stopConsumer");
}
|
java
|
public boolean setClassifications(Flow[] newFlows)
throws InvalidFlowsException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setClassifications", newFlows);
boolean noClassChange = true;
// Do we have the same set of flows but with different weightings only?
if(flows == null || (flows.length != newFlows.length))
{
// We know that this is more than a weight change
noClassChange = false;
}
// Set up the new data structures to hold classification information
ArrayList<String> newClassificationNames = new ArrayList<String>();
HashMap<String, ClassWeight> newMessageClasses = new HashMap<String, ClassWeight>();
HashMap<Integer, Integer> newWeightMap = new HashMap<Integer, Integer>();
// Set the new default classification
newClassificationNames.add(0, "$SIdefault");
// Iterate over the new flows
for(int i=0;i<newFlows.length;i++)
{
// Get the next classification name
String nextClassificationName = newFlows[i].getClassification();
if(noClassChange && !classificationNames.contains(nextClassificationName))
{
// This classification was not in the old list
noClassChange = false;
}
// The zeroth position is reserved for default, non-classified messages
ClassWeight classWeight = new ClassWeight(i+1, newFlows[i].getWeighting());
// Put the new weight in the messageClasses map
ClassWeight cw = newMessageClasses.put(nextClassificationName, classWeight);
// Check for duplicate classification names
if(cw != null)
{
InvalidFlowsException ife = new InvalidFlowsException();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setClassifications", ife);
throw ife;
}
newClassificationNames.add(i+1, nextClassificationName);
// Put the new value in the weightMap
newWeightMap.put(Integer.valueOf(i+1), Integer.valueOf(newFlows[i].getWeighting()));
}
// Have set up the new data structures, reset the old ones.
classificationNames = newClassificationNames;
messageClasses = newMessageClasses;
weightMap = newWeightMap;
// And clone the flows
this.flows = newFlows.clone();
// The number of classifications
numberOfClasses = flows.length;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setClassifications", Boolean.valueOf(noClassChange));
return noClassChange;
}
|
java
|
public int getNumberOfClasses()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getNumberOfClasses");
SibTr.exit(tc, "getNumberOfClasses", Integer.valueOf(numberOfClasses));
}
return numberOfClasses;
}
|
java
|
public int getPosition(String classificationName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getPosition", classificationName);
int classPos = 0;
// Get the position of the classification
ClassWeight cw = messageClasses.get(classificationName);
if(cw != null)
classPos = cw.getPosition();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getPosition", Integer.valueOf(classPos));
return classPos;
}
|
java
|
public int getWeight(String classificationName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getWeight", classificationName);
int weight = 0;
// Get the weight of the classification
ClassWeight cw = messageClasses.get(classificationName);
if(cw != null)
weight = cw.getWeight();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getWeight", Integer.valueOf(weight));
return weight;
}
|
java
|
public int findClassIndex(HashMap<Integer, Integer> weightMap)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "findClassIndex");
int classPos = 0;
int randWeight = 0;
// First of all determine total weight
int totalWeight = 0;
Iterator<Integer> iter = weightMap.values().iterator();
while(iter.hasNext())
{
Integer weight = iter.next();
totalWeight = totalWeight + weight.intValue();
}
// TotalWeight might be zero if a zero weighting has been applied to a class. In
// that case we need to return a zero classPos
if(totalWeight > 0)
{
// Generate a random number that is between zero and the total weight
randWeight = Math.abs(rand.nextInt() % totalWeight);
// Iterate over the weightMap again so that we can find a class index to use.
// We search for the index that corresponds to the generated random value.
//
// So if we had 3 classes with weights 7, 2 and 1, then we'll have a total
// weight of 10 and will generate a pseudo random number between 0 and 10. The
// code will see if the random number...
// * is less than 7, in which case it chooses index 1,
// * is between 7 and 9, in which case it chooses index 2,
// * is between 9 and 10, in which case it chooses index 3.
Iterator<Map.Entry<Integer, Integer>> iter2 = weightMap.entrySet().iterator();
// An aggregate of the weight
int aggregateWeight = 0;
while(iter2.hasNext())
{
Map.Entry entry = (Map.Entry) iter2.next();
Integer mappos = (Integer) entry.getKey();
Integer weight = (Integer) entry.getValue();
aggregateWeight = aggregateWeight + weight.intValue();
// Move the classPos to the next value
classPos = mappos.intValue();
if(randWeight <= aggregateWeight)
break;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "findClassIndex", classPos);
return classPos;
}
|
java
|
public Flow[] getFlows()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getFlows");
}
Flow[] clonedFlows = flows.clone();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exit(tc, "getFlows", clonedFlows);
}
return clonedFlows;
}
|
java
|
public Map<Object, Object> getPropertyBag() {
if (this.properties == null) {
this.properties = new HashMap<Object, Object>();
}
return this.properties;
}
|
java
|
public ChainDataImpl getExternalChainData() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(this, tc, "getExternalChainData");
}
// Create the list of the parents of the child data objects.
ChannelData[] parents = new ChannelData[this.channelDataArray.length];
for (int i = 0; i < parents.length; i++) {
parents[i] = ((ChildChannelDataImpl) this.channelDataArray[i]).getParent();
}
ChainDataImpl externalChainData = null;
try {
externalChainData = new ChainDataImpl(getName(), getType(), parents, null);
} catch (IncoherentChainException e) {
// No FFDC Needed
// This should never happen
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Unable to build external version of chain data, " + getName());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(this, tc, "getExternalChainData");
}
return externalChainData;
}
|
java
|
public final void addChainEventListener(ChainEventListener listener) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "addChainEventListener: " + listener);
}
if (null != listener) {
this.chainEventListeners.add(listener);
}
}
|
java
|
public final void removeChainEventListener(ChainEventListener listener) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "removeChainEventListener: " + listener);
}
if (null != listener) {
if (!this.chainEventListeners.remove(listener)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Cannot find listener to be removed");
}
}
}
}
|
java
|
public Set<ChainEventListener> removeAllChainEventListeners() {
Set<ChainEventListener> returnListeners = new HashSet<ChainEventListener>(this.chainEventListeners);
this.chainEventListeners.clear();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "removeAllChainEventListeners", returnListeners);
}
return returnListeners;
}
|
java
|
public void setChainEventListeners(Set<ChainEventListener> newListeners) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "removeAllChainEventListeners", newListeners);
}
chainEventListeners.clear();
chainEventListeners.addAll(newListeners);
}
|
java
|
public final void chainInitialized() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(this, tc, "chainInitialized, chain: " + this.name);
}
// Clone the list in case one of the event listeners modifies
// the chain during this iteration.
for (ChainEventListener listener : chainEventListeners) {
listener.chainInitialized(this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(this, tc, "chainInitialized");
}
}
|
java
|
public final void chainStartFailed(int attemptsMade, int attemptsLeft) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(this, tc, "chainStartFailed, chain: " + this.name);
}
// Clone the list in case one of the event listeners modifies
// the chain during this iteration.
for (ChainEventListener listener : chainEventListeners) {
if (listener instanceof RetryableChainEventListener) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling chain retryable chain event listener");
}
((RetryableChainEventListener) listener).chainStartFailed(this, attemptsMade, attemptsLeft);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(this, tc, "chainStartFailed");
}
}
|
java
|
public CFEndPoint getEndPoint() throws ChannelFrameworkException {
if (null == this.endPoint) {
if (FlowType.INBOUND.equals(this.type)) {
this.endPoint = new CFEndPointImpl(this);
} else {
throw new ChannelFrameworkException(this.name + " is not inbound chain");
}
}
return this.endPoint;
}
|
java
|
@Trivial
protected String getRawProperty(String key) {
String rawValue = source.getValue(key);
if (rawValue != null) {
current.put(key, rawValue);
}
return rawValue;
}
|
java
|
protected final TagAttribute getRequiredAttribute(String localName) throws TagException
{
TagAttribute attr = this.getAttribute(localName);
if (attr == null)
{
throw new TagException(this.tag, "Attribute '" + localName + "' is required");
}
return attr;
}
|
java
|
public void setInputHandler(ProducerInputHandler inputHandler)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setInputHandler", inputHandler);
this.inputHandler = inputHandler;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setInputHandler");
}
|
java
|
void setBus(String busName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setBus", busName);
this.busName = busName;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setBus");
}
|
java
|
public void setForeignBusSendAllowed(boolean sendAllowed)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "setForeignBusSendAllowed", Boolean.valueOf(sendAllowed));
}
// Set the flag on this handler
_sendAllowedOnTargetForeignBus = Boolean.valueOf(sendAllowed);
// Tell any destinations that target this destination to refresh their
// sendAllowed setting
if (aliasesThatTargetThisDest != null)
{
synchronized(aliasesThatTargetThisDest)
{
Iterator i = aliasesThatTargetThisDest.iterator();
while (i.hasNext())
{
AbstractAliasDestinationHandler abstractAliasDestinationHandler =
(AbstractAliasDestinationHandler) i.next();
abstractAliasDestinationHandler.setForeignBusSendAllowed(sendAllowed);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exit(tc, "setForeignBusSendAllowed");
}
}
|
java
|
@Trivial
public static <U> CompletableFuture<U> failedFuture(Throwable x) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.failedFuture"));
}
|
java
|
@Trivial
public static <U> CompletionStage<U> failedStage(Throwable x) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.failedStage"));
}
|
java
|
public static <T> CompletableFuture<T> newIncompleteFuture(Executor executor) {
if (JAVA8)
return new ManagedCompletableFuture<T>(new CompletableFuture<T>(), executor, null);
else
return new ManagedCompletableFuture<T>(executor, null);
}
|
java
|
@Trivial
public static CompletableFuture<Void> runAsync(Runnable action) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.runAsync"));
}
|
java
|
@Trivial
public static <U> CompletableFuture<U> supplyAsync(Supplier<U> action) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.supplyAsync"));
}
|
java
|
private ThreadContextDescriptor captureThreadContext(Executor executor) {
WSManagedExecutorService managedExecutor = defaultExecutor instanceof WSManagedExecutorService //
? (WSManagedExecutorService) defaultExecutor //
: executor != defaultExecutor && executor instanceof WSManagedExecutorService //
? (WSManagedExecutorService) executor //
: null;
if (managedExecutor == null)
return null;
@SuppressWarnings("unchecked")
ThreadContextDescriptor contextDescriptor = managedExecutor.getContextService().captureThreadContext(XPROPS_SUSPEND_TRAN);
return contextDescriptor;
}
|
java
|
@Trivial
private final static FutureRefExecutor supportsAsync(Executor executor) {
if (executor instanceof ExecutorService)
return new FutureRefExecutor((ExecutorService) executor); // valid
if (executor instanceof UnusableExecutor)
throw new UnsupportedOperationException(); // not valid for executing tasks
return null; // valid
}
|
java
|
static File validateDirectory(final File directory) {
File newDirectory = null;
try {
newDirectory = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<File>() {
@Override
public File run() throws Exception {
boolean ok = true;
if (!directory.exists())
ok = directory.mkdirs() || directory.exists(); //2nd exists check is necessary to close timing window
if (!ok) {
Tr.error(tc, "UNABLE_TO_DELETE_RESOURCE_NOEX", new Object[] { directory.getAbsolutePath() });
return null;
}
return directory;
}
});
} catch (PrivilegedActionException e) {
Tr.error(tc, "UNABLE_TO_DELETE_RESOURCE", new Object[] { directory.getAbsolutePath(), e });
}
return newDirectory;
}
|
java
|
static File createNewFile(final FileLogSet fileLogSet) {
final File directory = fileLogSet.getDirectory();
final String fileName = fileLogSet.getFileName();
final String fileExtension = fileLogSet.getFileExtension();
File f = null;
try {
f = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<File>() {
@Override
public File run() throws Exception {
return fileLogSet.createNewFile();
}
});
} catch (PrivilegedActionException e) {
File exf = new File(directory, fileName + fileExtension);
Tr.error(tc, "UNABLE_TO_DELETE_RESOURCE", new Object[] { exf.getAbsolutePath(), e });
}
return f;
}
|
java
|
public void releaseBuffers() {
// release buffers is desired
if (payloadBuffers != null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "release payload buffers. number to release is: " + payloadCountOfBuffers);
}
// if the payload buffers have been set into here, then release those
for (int i = 0; i < payloadCountOfBuffers; i++) {
payloadBuffers[i].release();
}
// avoid double releasing by resetting these objects and variables
payloadBuffers = null;
payloadCountOfBuffers = 0;
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "release buffers from frame list. number to release is: " + countOfIOFrames);
}
// payload buffers haven't been set into here yet, so release buffers on each frame processor
if (countOfIOFrames > 0) {
for (int i = 0; i < countOfIOFrames; i++) {
fpList[i].releaseBuffers();
}
} else {
frameProcessor.releaseBuffers();
}
}
}
|
java
|
public static boolean methodParamsMatch(List<String> typeNames, Class<?>[] types)
{
if (typeNames.size() != types.length)
{
return false;
}
for (int i = 0; i < types.length; i++)
{
String typeName = typeNames.get(i);
int typeNameEnd = typeName.length();
Class<?> type = types[i];
for (; type.isArray(); type = type.getComponentType())
{
if (typeNameEnd < 2 ||
typeName.charAt(--typeNameEnd) != ']' ||
typeName.charAt(--typeNameEnd) != '[')
{
return false;
}
}
if (!type.getName().regionMatches(0, typeName, 0, typeNameEnd))
{
return false;
}
}
return true;
}
|
java
|
String evaluateExpression(String expr) throws ConfigEvaluatorException {
ConfigExpressionScanner scanner = new ConfigExpressionScanner(expr);
// Expression = Arithmetic | FilterCall
// Arithmetic = Operand [( "+" | "-" | "*" | "/") Operand]*
// Operand = VarName | Long | FunctionCall
// VarName = <Java identifier plus "." after start>
// Long = <[0-9]+ handled by Long.parseLong>
// FunctionCall = FunctionName "(" VarName ")"
// FunctionName = "count"
// FilterCall = "servicePidOrFilter(" VarName ")"
// Parse the first operand (or function name).
if (!parseOperand(expr, scanner, true)) {
return null;
}
if (resultExpr != null) {
return scanner.end() ? resultExpr : null;
}
subtotal = value;
while (!scanner.end()) {
// Parse operator.
ConfigExpressionScanner.NumericOperator op = scanner.scanNumericOperator();
if (op == null) {
return null;
}
if (!parseOperand(expr, scanner, false) || (resultExpr != null)) {
return null;
}
subtotal = op.evaluate(subtotal, value);
}
return String.valueOf(subtotal);
}
|
java
|
private int evaluateCountExpression(Object value) {
if (value == null) {
return 0;
}
if (value.getClass().isArray()) {
return Array.getLength(value);
}
if (value instanceof Vector<?>) {
return ((Vector<?>) value).size();
}
return 1;
}
|
java
|
@Override
public Map<String, Object> getRequestCookieMap()
{
if (_requestCookieMap == null)
{
checkHttpServletRequest();
_requestCookieMap = new CookieMap(_httpServletRequest);
}
return _requestCookieMap;
}
|
java
|
public LockingCursor getDefaultGetCursor()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getDefaultGetCursor");
LockingCursor cursor = consumerKeyFilter[0].getGetCursor();
if(keyGroup != null)
cursor = keyGroup.getDefaultGetCursor();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getDefaultGetCursor", cursor);
return cursor;
}
|
java
|
private int chooseGetCursorIndex(int classification)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "chooseGetCursorIndex");
int classIndex = 0;
if(classifyingMessages)
classIndex = consumerSet.chooseGetCursorIndex(classification);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "chooseGetCursorIndex", classIndex);
return classIndex;
}
|
java
|
public void detach() throws SIResourceException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "detach");
// Make sure we are not ready
notReady();
// Remove us from any group we are a member of
if(keyGroup != null)
keyGroup.removeMember(this);
// Remove this consumer from the CD's knowledge
consumerDispatcher.detachConsumerPoint(this);
// Cleanly dispose of the getCursor
if(classifyingMessages)
{
// Take the classifications read lock
consumerSet.takeClassificationReadLock();
int numFilters = consumerKeyFilter.length;
for(int i=0;i<numFilters;i++)
consumerKeyFilter[i].detach();
// Free the classifications read lock
consumerSet.freeClassificationReadLock();
}
else
consumerKeyFilter[0].detach();
synchronized (this)
{
detached = true;
}
// Remove the consumerPoint to the consumerSet if the latter has been specified
if(classifyingMessages)
consumerSet.removeConsumer(consumerPoint);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "detach");
}
|
java
|
public SIBUuid12 getConnectionUuid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getConnectionUuid");
SibTr.exit(tc, "getConnectionUuid", connectionUuid);
}
return connectionUuid;
}
|
java
|
public boolean requiresRecovery(SIMPMessage msg)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "requiresRecovery", new Object[] { msg });
boolean recoverable;
Reliability msgReliability = msg.getReliability();
recoverable = msgReliability.compareTo(unrecoverability) > 0;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "requiresRecovery", Boolean.valueOf(recoverable));
return recoverable;
}
|
java
|
public void markNotReady()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "markNotReady");
ready = false;
if(keyGroup != null)
keyGroup.markNotReady();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "markNotReady");
}
|
java
|
public JSConsumerKey getParent()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getParent");
JSConsumerKey key = this;
if(keyGroup != null)
key = keyGroup;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getParent", key);
return key;
}
|
java
|
public void start()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "start");
if(!started)
{
started = true;
if(keyGroup != null)
keyGroup.startMember();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "start");
}
|
java
|
public void stop()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stop");
if(started)
{
started = false;
if(keyGroup != null)
keyGroup.stopMember();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "stop");
}
|
java
|
private void createNewFiltersAndCursors(ItemStream itemStream)
throws SIResourceException, MessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createNewFiltersAndCursors", itemStream);
LockingCursor cursor = null;
// Instantiate a new array of Filters and associated cursors. If there is
// no message classification, then we'll instantiate a single filter and
// cursor pair.
if(classifyingMessages)
{
// Classifying messages for XD.
// this work should be done under the classifications readlock acquired higher
// up in the stack
JSConsumerClassifications classifications = consumerSet.getClassifications();
int numClasses = classifications.getNumberOfClasses();
consumerKeyFilter = new LocalQPConsumerKeyFilter[numClasses+1];
for(int i=0;i<numClasses+1;i++)
{
String classificationName = null;
// The zeroth filter belongs to the default classification, which has a
// null classification name
if(i > 0)
classificationName = classifications.getClassification(i);
consumerKeyFilter[i] = new LocalQPConsumerKeyFilter(this, i, classificationName);
cursor = itemStream.newLockingItemCursor(consumerKeyFilter[i], !forwardScanning);
consumerKeyFilter[i].setLockingCursor(cursor);
}
}
else
{
// No message classification
consumerKeyFilter = new LocalQPConsumerKeyFilter[1];
consumerKeyFilter[0] = new LocalQPConsumerKeyFilter(this, 0, null);
cursor = itemStream.newLockingItemCursor(consumerKeyFilter[0], !forwardScanning);
consumerKeyFilter[0].setLockingCursor(cursor);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createNewFiltersAndCursors");
}
|
java
|
@Override
public JmsConnectionFactory createConnectionFactory() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createConnectionFactory");
JmsConnectionFactory jmscf = null;
// get a jca managed connection factory, which is used to construct
// the jms connection factory.
JmsJcaFactory jcaFact = JmsJcaFactory.getInstance();
if (jcaFact == null) {
// This indicates that the jmsra.impl class could not be loaded by their
// static initializer. Nothing we can do about that...
// d238447 FFDC review. FFDC has already been generated by JmsJcaFactory, so
// don't generate one here.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"UNABLE_TO_CREATE_FACTORY_CWSIA0008",
new Object[] { "JmsJcaFactoryImpl", "sib.api.jmsraOutboundImpl.jar" },
tc
);
}
JmsJcaManagedConnectionFactory jcamcf = jcaFact.createManagedConnectionFactory();
// invoke the construction of a jms connection factory - the jca managed
// connection factory will call back into the jms api code by getting a
// JmsRAFactoryFactory, and calling a create jms connection factory
// method on it with jca connection factory and jca managed connection
// factory objects as parameters (the jms cf will keep references to the
// jca cf and jca mcf).
try {
jmscf = (JmsConnectionFactory) jcamcf.createConnectionFactory();
} catch (ResourceException re) {
// No FFDC code needed
// d222942 review - no documentation for when a RE will be thrown, so
// default exception ok. (A quick look at the RA suggests the exception isn't
// ever thrown).
// d238447 FFDC review. From the above comment, generating an FFDC seems ok.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0007",
new Object[] { re, "JmsFactoryFactoryImpl.createConnectionFactory (#2)" },
re,
"JmsFactoryFactoryImpl.createConnectionFactory#2",
this,
tc
);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createConnectionFactory", jmscf);
return jmscf;
}
|
java
|
@Override
public JmsQueueConnectionFactory createQueueConnectionFactory() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createQueueConnectionFactory");
JmsQueueConnectionFactory jmsqcf = null;
// get a jca managed queue connection factory, which is used to construct
// the jms queue connection factory.
JmsJcaManagedQueueConnectionFactory jcamqcf = JmsJcaFactory.getInstance().createManagedQueueConnectionFactory();
// invoke the construction of a jms queue connection factory - the jca
// managed queue connection factory will call back into the jms api code
// by getting a JmsRAFactoryFactory, and calling a create jms queue
// connection factory method on it with jca connection factory and jca
// managed queue connection factory objects as parameters (the jms qcf
// will keep references to the jca cf and jca mqcf).
try {
jmsqcf = (JmsQueueConnectionFactory) jcamqcf.createConnectionFactory();
} catch (ResourceException re) {
// No FFDC code needed
// d222942 review - no documentation for when a RE will be thrown, so
// default exception ok. (A quick look at the RA suggests the exception isn't
// ever thrown).
// d238447 FFDC review. Comment above suggests an FFDC ok for this case.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0007",
new Object[] { re, "JmsFactoryFactoryImpl.createQueueConnectionFactory (#1)" },
re,
"JmsFactoryFactoryImpl.createQueueConnectionFactory#1",
this,
tc
);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createQueueConnectionFactory", jmsqcf);
return jmsqcf;
}
|
java
|
@Override
public JmsTopicConnectionFactory createTopicConnectionFactory() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createTopicConnectionFactory");
JmsTopicConnectionFactory jmstcf = null;
// get a jca managed topic connection factory, which is used to construct
// the jms topic connection factory.
JmsJcaManagedTopicConnectionFactory jcamtcf = JmsJcaFactory.getInstance().createManagedTopicConnectionFactory();
// invoke the construction of a jms topic connection factory - the jca
// managed topic connection factory will call back into the jms api code
// by getting a JmsRAFactoryFactory, and calling a create jms topic
// connection factory method on it with jca connection factory and jca
// managed topic connection factory objects as parameters (and the jms
// tcf will keep references to the jca cf and jca mtcf).
try {
jmstcf = (JmsTopicConnectionFactory) jcamtcf.createConnectionFactory();
} catch (ResourceException re) {
// No FFDC code needed
// d222942 review - no documentation for when a RE will be thrown, so
// default exception ok. (A quick look at the RA suggests the exception isn't
// ever thrown).
// d238447 FFDC review. Comment above suggests FFDC ok.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0007",
new Object[] { re, "JmsFactoryFactoryImpl.createTopicConnectionFactory (#1)" },
re,
"JmsFactoryFactoryImpl.createTopicConnectionFactory#1",
this,
tc
);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createTopicConnectionFactory", jmstcf);
return jmstcf;
}
|
java
|
@Override
public JmsQueue createQueue(String name) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createQueue", name);
JmsQueue queue = null;
// if name string is null, empty or just "queue://", throw exception
if ((name == null) || ("".equals(name)) || (JmsQueueImpl.QUEUE_PREFIX.equals(name))) {
throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
InvalidDestinationException.class,
"INVALID_VALUE_CWSIA0003",
new Object[] { "Queue name", name },
tc
);
}
// if name is "topic://" throw exception
if (name.startsWith(JmsTopicImpl.TOPIC_PREFIX)) {
throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
InvalidDestinationException.class,
"MALFORMED_DESCRIPTOR_CWSIA0047",
new Object[] { "Queue", name },
tc
);
}
name = name.trim();
queue = (JmsQueue) destCreator.createDestinationFromString(name, URIDestinationCreator.DestType.QUEUE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createQueue", queue);
return queue;
}
|
java
|
@Override
public JmsTopic createTopic(String name) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createTopic", name);
JmsTopic topic = null;
// if name string is null throw exception
if (name == null) {
throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
InvalidDestinationException.class,
"INVALID_VALUE_CWSIA0003",
new Object[] { "Topic name", null },
tc
);
}
// if name is "queue://" throw exception
if (name != null && name.startsWith(JmsQueueImpl.QUEUE_PREFIX)) {
throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
InvalidDestinationException.class,
"MALFORMED_DESCRIPTOR_CWSIA0047",
new Object[] { "Topic", name },
tc
);
}
name = name.trim();
topic = (JmsTopic) destCreator.createDestinationFromString(name, URIDestinationCreator.DestType.TOPIC);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createTopic", topic);
return topic;
}
|
java
|
void handlePut(
SimpleTest test,
Conjunction selector,
MatchTarget object,
InternTable subExpr)
throws MatchingException {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "handlePut",
new Object[] {test,selector,object,subExpr} );
Object value = test.getValue();
if (value == null)
throw new IllegalStateException();
handleEqualityPut(value, selector, object, subExpr);
if (tc.isEntryEnabled())
tc.exit(this,cclass, "handlePut");
}
|
java
|
void handleEqualityPut(Object value, Conjunction selector,
MatchTarget object, InternTable subExpr) throws MatchingException {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "handleEqualityPut",
new Object[] {value,selector,object,subExpr} );
ContentMatcher next =
(ContentMatcher) ((children == null) ? null : children.get(value));
ContentMatcher newNext = nextMatcher(selector, next);
if (newNext != next)
{
if (children == null)
children = new HashMap(INITIAL_CHILDREN_CAPACITY);
children.put(value, newNext);
}
newNext.put(selector, object, subExpr);
if (tc.isEntryEnabled())
tc.exit(this,cclass, "handleEqualityPut");
}
|
java
|
void handleEqualityRemove(Object value, Conjunction selector,
MatchTarget object, InternTable subExpr, OrdinalPosition parentId) throws MatchingException {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "handleEqualityRemove",
new Object[] {value,selector,object,subExpr} );
ContentMatcher next = (ContentMatcher) children.get(value);
ContentMatcher newNext =
(ContentMatcher) next.remove(selector, object, subExpr, ordinalPosition);
if (newNext == null)
children.remove(value);
else if (newNext != next)
children.put(value, newNext);
if (tc.isEntryEnabled())
tc.exit(this,cclass, "handleEqualityRemove");
}
|
java
|
boolean isEmpty() {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "isEmpty");
boolean ans = super.isEmpty() && !haveEqualityMatches();
if (tc.isEntryEnabled())
tc.exit(this,cclass, "isEmpty", new Boolean(ans));
return ans;
}
|
java
|
ContentMatcher nextMatcher(Conjunction selector, ContentMatcher oldMatcher) {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "nextMatcher", "selector: "+selector+", oldMatcher: "+oldMatcher);
ContentMatcher ans;
if (!cacheing)
ans = super.nextMatcher(selector, oldMatcher);
else if (oldMatcher == null)
ans = new CacheingMatcher(ordinalPosition, super.nextMatcher(selector, null));
else
ans = oldMatcher;
if (tc.isEntryEnabled())
tc.exit(this,cclass, "nextMatcher", ans);
return ans;
}
|
java
|
public void setDestination(DestinationHandler originalDestination)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setDestination", originalDestination);
_originalDestination = originalDestination;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setDestination");
}
|
java
|
@Override
public void setDestination(SIDestinationAddress destinationAddr)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setDestination", destinationAddr);
if (destinationAddr != null)
{
try
{
_originalDestination = _messageProcessor.getDestinationManager().getDestination((JsDestinationAddress) destinationAddr, true);
} catch (SIException e)
{
// No FFDC code needed
/* Generate warning but retry with default exception destination */
SibTr.warning(tc, "EXCEPTION_DESTINATION_WARNING_CWSIP0291",
new Object[] { destinationAddr.getDestinationName(), _messageProcessor.getMessagingEngineName(), e });
// Create a handler to the default if provided destination is inaccessible
_originalDestination = null;
}
}
else
_originalDestination = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setDestination", _originalDestination);
}
|
java
|
public int checkCanExceptionMessage()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkCanExceptionMessage");
// Return code
int rc = DestinationHandler.OUTPUT_HANDLER_NOT_FOUND;
String newExceptionDestination = null;
boolean usingDefault = false;
if (_originalDestination != null)
{
newExceptionDestination = _originalDestination.getExceptionDestination();
if (newExceptionDestination == null || newExceptionDestination.equals(""))
{
// Simply return with OUTPUT_HANDLER_NOT_FOUND
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkCanExceptionMessage", rc);
return rc;
}
if (newExceptionDestination.equals(JsConstants.DEFAULT_EXCEPTION_DESTINATION))
{
newExceptionDestination = _defaultExceptionDestinationName;
usingDefault = true;
}
}
else
{
newExceptionDestination = _defaultExceptionDestinationName;
usingDefault = true;
}
try
{
DestinationHandler exceptionDestHandler =
_messageProcessor.getDestinationManager().
getDestination(newExceptionDestination, true);
rc = exceptionDestHandler.checkCanAcceptMessage(null, null);
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
}
// If we havent checked the system default destination, then do that now
if (rc != DestinationHandler.OUTPUT_HANDLER_FOUND && !usingDefault)
{
try
{
DestinationHandler exceptionDestHandler =
_messageProcessor.getDestinationManager().
getDestination(_defaultExceptionDestinationName, true);
rc = exceptionDestHandler.checkCanAcceptMessage(null, null);
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkCanExceptionMessage", Integer.valueOf(rc));
return rc;
}
|
java
|
@Override
public UndeliverableReturnCode handleUndeliverableMessage(
SIBusMessage msg,
String alternateUser,
TransactionCommon tran,
int exceptionReason,
String[] exceptionStrings)
{
// F001333-14610
// Delegate down onto the new method passing a null
// subscription ID.
return handleUndeliverableMessage(msg, alternateUser, tran, exceptionReason, exceptionStrings, null);
}
|
java
|
private UndeliverableReturnCode checkMessage(SIMPMessage message)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkMessage", message);
UndeliverableReturnCode rc = UndeliverableReturnCode.OK;
// F001333:E3
// If the message's reliability equals or is less than the configured ExceptionDiscardReliability
// then the message shouldn't be sent on to the exception destination, instead it should simply
// be thrown away (the default setting is BestEffort).
// We'll always chuck away BestEffort messages, but if we have the original destination we'll base
// our decision on its configuration
// (If the _originalDestination is null then we do not have the original destination's config to hand,
// for example, in the case of cleaning up a deleted destination)
Reliability discardReliabilityThreshold = Reliability.BEST_EFFORT_NONPERSISTENT;
if (_originalDestination != null)
discardReliabilityThreshold = _originalDestination.getExceptionDiscardReliability();
if (message.getReliability().compareTo(discardReliabilityThreshold) <= 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Message reliability (" + message.getReliability() + ") <= Exception reliability (" +
discardReliabilityThreshold + ")");
rc = UndeliverableReturnCode.DISCARD;
}
// Discard messages from temporary destinations.
else if (_originalDestination != null &&
_originalDestination.isTemporary())
rc = UndeliverableReturnCode.DISCARD;
// If the discardMessage option is set, then we discard the message rather
// than send to the exception destination
else if (Boolean.TRUE.equals(message.getMessage().getReportDiscardMsg()))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Message discarded at sender's request");
rc = UndeliverableReturnCode.DISCARD;
}
// Decide whether we want to block the message or not.
else if (isBlockRequired(message))
rc = UndeliverableReturnCode.BLOCK;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkMessage", rc);
return rc;
}
|
java
|
private AccessResult checkExceptionDestinationAccess(JsMessage msg,
ConnectionImpl conn,
String alternateUser,
boolean defaultInUse)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkExceptionDestinationAccess", new Object[] { msg,
conn,
alternateUser,
Boolean.valueOf(defaultInUse) });
// Will drive the form of sib.security checkDestinationAccess() that
// takes a JsMessage
SecurityContext secContext = new SecurityContext(msg,
alternateUser,
null,
_messageProcessor.getAuthorisationUtils());
boolean allowed = true;
boolean identityAdoptionAllowed = true;
if (defaultInUse)
{
// We're using the default exc destination for the ME, call
// checkDestinationAccess() with the default exc dest prefix
// rather than the fully qualified name
// First we do the alternate user check. If an alternateUser was set then
// (A )We need to determine whether the connected subject has the authority to
// perform alternate user checks. It is assumed that if there is no connection
// associated with this call, then we're privileged anyway.
// (B) We need to do the destination access check with the supplied alternate
// user.
if (conn != null)// conn will be null if we've followed the handleUndeliverableMessage route
// (privileged) rather than the sendToExceptionDestination route
// where the Core SPI has been driven
{
// Careful, we need a sec context for the connection rather than that associated
// with the message.
SecurityContext connSecContext = new SecurityContext(conn.getSecuritySubject(),
alternateUser,
null,
_messageProcessor.getAuthorisationUtils());
// Alternate user check
if (alternateUser != null)
{
if (!_messageProcessor.
getAccessChecker().
checkDestinationAccess(connSecContext,
null, // home bus
SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX,
OperationType.IDENTITY_ADOPTER))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "checkExceptionDestinationAccess", "not authorized to perform alternate user checks on this destination");
allowed = false;
identityAdoptionAllowed = false;
}
}
// Now check access authority on the destination itself
if (allowed)
{
if (!_messageProcessor.
getAccessChecker().
checkDestinationAccess(connSecContext,
null, // home bus
SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX,
OperationType.SEND))
{
allowed = false;
}
}
}
else // handleUndeliverableMessage route
{
if (!_messageProcessor.
getAccessChecker().
checkDestinationAccess(secContext,
null, // home bus
SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX,
OperationType.SEND))
{
allowed = false;
}
}
}
else
{
// Same style of processing as above
if (conn != null) // conn will be null if we've followed the handleUndeliverableMessage route
// (privileged) rather than the sendToExceptionDestination route
// where the Core SPI has been driven
{
// Careful, we need a sec context for the connection rather than that associated
// with the message.
SecurityContext connSecContext = new SecurityContext(conn.getSecuritySubject(),
alternateUser,
null,
_messageProcessor.getAuthorisationUtils());
// Alternate user check
if (alternateUser != null)
{
if (!_exceptionDestination.
checkDestinationAccess(connSecContext,
OperationType.IDENTITY_ADOPTER))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "checkExceptionDestinationAccess", "not authorized to perform alternate user checks on this destination");
allowed = false;
identityAdoptionAllowed = false;
}
}
// Now check access authority on the destination itself
if (allowed)
{
if (!_exceptionDestination.
checkDestinationAccess(connSecContext,
OperationType.SEND))
{
allowed = false;
}
}
}
else // handleUndeliverableMessage route
{
// Check authority to produce to destination
if (!_exceptionDestination.
checkDestinationAccess(secContext,
OperationType.SEND))
{
allowed = false;
}
}
}
AccessResult result = new AccessResult(allowed, identityAdoptionAllowed);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc,
"checkExceptionDestinationAccess",
result);
return result;
}
|
java
|
private void handleAccessDenied(AccessResult result,
JsMessage msg,
String alternateUser)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "handleAccessDenied", new Object[] { result,
msg,
alternateUser });
// Determine the username and operation for messaging
String userName = null;
OperationType operationType = null;
if (result.didIdentityAdoptionFail())
{
userName = msg.getSecurityUserid();
operationType = OperationType.IDENTITY_ADOPTER;
}
else
{
operationType = OperationType.SEND;
if (alternateUser != null)
userName = alternateUser;
else
userName = msg.getSecurityUserid();
}
// Build the message for the Exception and the Notification
String nlsMessage =
nls.getFormattedMessage("USER_NOT_AUTH_EXCEPTION_DEST_ERROR_CWSIP0313",
new Object[] { userName,
_exceptionDestinationName },
null);
// Fire a Notification if Eventing is enabled
_messageProcessor.
getAccessChecker().
fireDestinationAccessNotAuthorizedEvent(_exceptionDestinationName,
userName,
operationType,
nlsMessage);
// Report the not authorized condition to the console
SibTr.warning(tc,
"USER_NOT_AUTH_EXCEPTION_DEST_ERROR_CWSIP0313",
new Object[] { userName,
_exceptionDestinationName }
);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc,
"handleAccessDenied");
}
|
java
|
private void fireMessageExceptionedEvent(String apiMsgId,
SIMPMessage message,
int exceptionReason)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc,
"fireMessageExceptionedEvent",
new Object[] { apiMsgId,
message,
Integer.valueOf(exceptionReason) });
JsMessagingEngine me = _messageProcessor.getMessagingEngine();
RuntimeEventListener listener = _messageProcessor.getRuntimeEventListener();
String systemMessageId = message.getMessage().getSystemMessageId();
// Check that we have a RuntimeEventListener
if (listener != null)
{
// Build the message for the Notification
String nlsMessage =
nls_mt.getFormattedMessage(
"MESSAGE_EXCEPTION_DESTINATIONED_CWSJU0012",
new Object[] {
apiMsgId,
systemMessageId,
_exceptionDestinationName,
Integer.valueOf(exceptionReason),
message.getMessage().getExceptionMessage() },
null);
// Build the properties for the Notification
Properties props = new Properties();
// Set values for the intended destination
String intendedDestinationName = "";
String intendedDestinationUuid = SIBUuid12.toZeroString();
if (_originalDestination != null)
{
intendedDestinationName = _originalDestination.getName();
intendedDestinationUuid = _originalDestination.getUuid().toString();
}
props.put(SibNotificationConstants.KEY_INTENDED_DESTINATION_NAME,
intendedDestinationName);
props.put(SibNotificationConstants.KEY_INTENDED_DESTINATION_UUID,
intendedDestinationUuid);
// Set values for the exception destination
props.put(SibNotificationConstants.KEY_EXCEPTION_DESTINATION_NAME,
_exceptionDestination.getName());
props.put(SibNotificationConstants.KEY_EXCEPTION_DESTINATION_UUID,
_exceptionDestination.getUuid().toString());
props.put(SibNotificationConstants.KEY_SYSTEM_MESSAGE_IDENTIFIER,
(systemMessageId == null) ? "" : systemMessageId);
props.put(SibNotificationConstants.KEY_MESSAGE_EXCEPTION_REASON,
String.valueOf(exceptionReason));
// Fire the event
listener.runtimeEventOccurred(me,
SibNotificationConstants.TYPE_SIB_MESSAGE_EXCEPTIONED,
nlsMessage,
props);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Null RuntimeEventListener, cannot fire event");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "fireMessageExceptionedEvent");
}
|
java
|
public static String decodeUri(String url)
{
int index1 = url.indexOf(sessUrlRewritePrefix);
int index2 = url.indexOf(qMark);
String tmp = null;
if (index2 != -1 && index2 > index1)
{
tmp = url.substring(index2);
}
if (index1 != -1)
{
url = url.substring(0, index1);
if (tmp != null)
{
url = url + tmp;
}
}
return url;
}
|
java
|
public static final void setInstance(FaceletFactory factory)
{
if (factory == null)
{
instance.remove();
}
else
{
instance.set(factory);
}
}
|
java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.