code
stringlengths 73
34.1k
| label
stringclasses 1
value |
|---|---|
public void close()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "close");
synchronized(this)
{
if (closed)
{
idToProxyQueueMap.clear();
factory.groupCloseNotification(conversation, this);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "close");
}
|
java
|
public void conversationDroppedNotification()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "conversationDroppedNotification");
LinkedList<ProxyQueue> notifyList = null;
synchronized(this)
{
// Make a copy of the map's values to avoid a concurrent modification
// exception later.
notifyList = new LinkedList<ProxyQueue>();
notifyList.addAll(idToProxyQueueMap.values());
}
Iterator iterator = notifyList.iterator();
while(iterator.hasNext())
{
ProxyQueue queue = (ProxyQueue)iterator.next();
queue.conversationDroppedNotification();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "conversationDroppedNotification");
}
|
java
|
public void setExtraAttribute(String name, String value) {
if (extraAttributes == null) {
extraAttributes = new HashMap<QName, Object>();
}
if (value == null) {
extraAttributes.remove(new QName(null, name));
} else {
extraAttributes.put(new QName(null, name), value);
}
}
|
java
|
public static String getValue(String value) {
if (value == null) {
return null;
}
String v = removeQuotes(value.trim()).trim();
if (v.isEmpty()) {
return null;
}
return v;
}
|
java
|
public static String removeQuotes(String arg) {
if (arg == null) {
return null;
}
int length = arg.length();
if (length > 1 && arg.startsWith("\"") && arg.endsWith("\"")) {
return arg.substring(1, length - 1);
}
return arg;
}
|
java
|
protected VirtualConnection processWork(TCPBaseRequestContext req, int options) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "processWork");
}
TCPConnLink conn = req.getTCPConnLink();
VirtualConnection vc = null;
if (options != 1) {
// initialize the action to false, set to true if we do the allocate
if (req.isRequestTypeRead()) {
((TCPReadRequestContextImpl) req).setJITAllocateAction(false);
}
}
if (attemptIO(req, false)) {
vc = conn.getVirtualConnection();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "processWork");
}
return vc;
}
|
java
|
protected boolean dispatch(TCPBaseRequestContext req, IOException ioe) {
if (req.blockedThread) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "dispatcher notifying waiting synch request ");
}
if (ioe != null) {
req.blockingIOError = ioe;
}
req.blockWait.simpleNotify();
return true;
}
// dispatch the async work
return dispatchWorker(new Worker(req, ioe));
}
|
java
|
private boolean dispatchWorker(Worker worker) {
ExecutorService executorService = CHFWBundle.getExecutorService();
if (null == executorService) {
if (FrameworkState.isValid()) {
Tr.error(tc, "EXECUTOR_SVC_MISSING");
throw new RuntimeException("Missing executor service");
} else {
// The framework is shutting down: the executor service may be
// missing by the time the async work is dispatched.
return false;
}
}
executorService.execute(worker);
return true;
}
|
java
|
protected void queueConnectForSelector(ConnectInfo connectInfo) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "queueConnectForSelector");
}
try {
moveIntoPosition(connectCount, connect, connectInfo, CS_CONNECTOR);
} catch (IOException x) {
FFDCFilter.processException(x, getClass().getName(), "140", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Caught IOException...throwing RuntimeException");
}
throw new RuntimeException(x);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "queueConnectForSelector");
}
}
|
java
|
protected void createNewThread(ChannelSelector sr, int threadType, int number) {
StartPrivilegedThread privThread = new StartPrivilegedThread(sr, threadType, number, this.tGroup);
AccessController.doPrivileged(privThread);
}
|
java
|
void workerRun(TCPBaseRequestContext req, IOException ioe) {
if (null == req || req.getTCPConnLink().isClosed()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Ignoring IO on closed socket: " + req);
}
return;
}
try {
if (ioe == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Worker thread processing IO request: " + req);
}
attemptIO(req, true);
} else {
if (req.isRequestTypeRead()) {
TCPReadRequestContextImpl readReq = (TCPReadRequestContextImpl) req;
if (readReq.getReadCompletedCallback() != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Worker thread processing read error: " + req.getTCPConnLink().getSocketIOChannel().getChannel());
}
readReq.getReadCompletedCallback().error(readReq.getTCPConnLink().getVirtualConnection(), readReq, ioe);
}
} else {
TCPWriteRequestContextImpl writeReq = (TCPWriteRequestContextImpl) req;
if (writeReq.getWriteCompletedCallback() != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Worker thread processing write error: " + req);
}
writeReq.getWriteCompletedCallback().error(writeReq.getTCPConnLink().getVirtualConnection(), writeReq, ioe);
}
}
}
} catch (Throwable t) {
// Only issue an FFDC if the framework is up/valid..
if (FrameworkState.isValid()) {
FFDCFilter.processException(t, getClass().getName(), "workerRun(req)", new Object[] { this, req, ioe });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Unexpected error in worker; " + t);
}
}
}
|
java
|
protected boolean dispatchConnect(ConnectInfo work) {
if (work.getSyncObject() != null) {
// user thread waiting for work
work.getSyncObject().simpleNotify();
return true;
}
// dispatch async work
return dispatchWorker(new Worker(work));
}
|
java
|
public static Map<String, List<String> > getEvaluatedNavigationParameters(
FacesContext facesContext,
Map<String, List<String> > parameters)
{
Map<String,List<String>> evaluatedParameters = null;
if (parameters != null && parameters.size() > 0)
{
evaluatedParameters = new HashMap<String, List<String>>();
for (Map.Entry<String, List<String>> pair : parameters.entrySet())
{
boolean containsEL = false;
for (String value : pair.getValue())
{
if (_isExpression(value))
{
containsEL = true;
break;
}
}
if (containsEL)
{
evaluatedParameters.put(pair.getKey(),
_evaluateValueExpressions(facesContext, pair.getValue()));
}
else
{
evaluatedParameters.put(pair.getKey(), pair.getValue());
}
}
}
else
{
evaluatedParameters = parameters;
}
return evaluatedParameters;
}
|
java
|
private static List<String> _evaluateValueExpressions(FacesContext context, List<String> values)
{
// note that we have to create a new List here, because if we
// change any value on the given List, it will be changed in the
// NavigationCase too and the EL expression won't be evaluated again
List<String> target = new ArrayList<String>(values.size());
for (String value : values)
{
if (_isExpression(value))
{
// evaluate the ValueExpression
value = context.getApplication().evaluateExpressionGet(context, value, String.class);
}
target.add(value);
}
return target;
}
|
java
|
public void register(JMFEncapsulationManager mgr, int id) {
if (id > JMFPart.MODEL_ID_JMF)
mmmgrTable.put(Integer.valueOf(id - 1), mgr);
else
throw new IllegalArgumentException("model ID cannot be negative");
}
|
java
|
private void registerInternal(JMFSchema schema) {
schemaTable.set((HashedArray.Element)schema);
Object assoc = schema.getJMFType().getAssociation();
if (assoc != null)
associations.put(assoc, schema);
}
|
java
|
private boolean isPresent(JMFSchema schema) throws JMFSchemaIdException {
long id = schema.getID();
JMFSchema reg = (JMFSchema)schemaTable.get(id);
if (reg != null) {
// We are assuming that collisions on key don't happen
if (!schema.equals(reg)) {
// The schema id is a 64bit SHA-1 derived hashcode, so we really don't expect
// to get random collisions.
throw new JMFSchemaIdException("Schema id clash: id=" + id);
}
Object newAssoc = schema.getJMFType().getAssociation();
Object oldAssoc = reg.getJMFType().getAssociation();
if (newAssoc != oldAssoc && newAssoc != null) {
if (oldAssoc != null)
associations.remove(oldAssoc);
reg.getJMFType().updateAssociations(schema.getJMFType());
associations.put(newAssoc, reg);
}
return true;
}
else
return false;
}
|
java
|
public static Vector getLocales(HttpServletRequest req) {
init();
String acceptLanguage = req.getHeader("Accept-Language");
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME,"getLocales", "Accept-Language --> " + acceptLanguage);
}
// Short circuit with an empty enumeration if null header
if ((acceptLanguage == null)|| (acceptLanguage.trim().length() ==0)) {
Vector def = new Vector();
def.addElement(Locale.getDefault());
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME,"getLocales", "processed Locales --> ", def);
}
return def;
}
// Check cache
Vector langList = null;
langList = (Vector) localesCache.get(acceptLanguage);
if (langList == null) {
// Create and add to cache
langList = processAcceptLanguage(acceptLanguage);
if(WCCustomProperties.VALIDATE_LOCALE_VALUES){
langList = extractLocales(langList , true);
}
else
langList = extractLocales(langList , false);
localesCache.put(acceptLanguage, langList);
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME,"getLocales", "processed Locales --> " + langList);
}
return langList;
}
|
java
|
public static Vector processAcceptLanguage(String acceptLanguage) {
init();
StringTokenizer languageTokenizer = new StringTokenizer(acceptLanguage, ",");
TreeMap map = new TreeMap(Collections.reverseOrder());
while (languageTokenizer.hasMoreTokens()) {
String language = languageTokenizer.nextToken().trim();
/* begin pq57399: part 1 */
if (language == null || language.length() == 0) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME,"processAcceptLanguage", "Encountered zero length language token without quality index.. skipping token");
logger.logp(Level.FINE, CLASS_NAME,"processAcceptLanguage", "acceptLanguage param = [" + acceptLanguage + "]");
}
continue;
}
/* end pq57399: part 1 */
int semicolonIndex = language.indexOf(';');
Double qValue = new Double(1);
if (semicolonIndex > -1) {
int qIndex = language.indexOf("q=");
String qValueStr = language.substring(qIndex + 2);
try {
qValue = new Double(qValueStr.trim());
}
catch (NumberFormatException nfe) {
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(nfe, "com.ibm.ws.webcontainer.srt.SRTRequestUtils.processAcceptLanguage", "215");
}
language = language.substring(0, semicolonIndex);
}
if (language.length() > 0) { /* added for pq57399: part 2*/
if ((qValue.doubleValue() > 0) && (language.charAt(0) != '*')) {
Vector newVector = new Vector();
if (map.containsKey(qValue)) {
newVector = (Vector) map.get(qValue);
}
newVector.addElement(language);
map.put(qValue, newVector);
} /* begin pq57399: part 3 */
}
else {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME,"processAcceptLanguage", "Encountered zero length language token with quality index.. skipping token");
logger.logp(Level.FINE, CLASS_NAME,"processAcceptLanguage", "acceptLanguage param = [" + acceptLanguage + "]");
}
} /* end pq57399: part 3 */
}
if (map.isEmpty()) {
Vector v = new Vector();
v.addElement(Locale.getDefault().toString());
map.put("1", v);
}
return new Vector(map.values());
}
|
java
|
public static Vector extractLocales(Vector languages, boolean secure) {
init();
Enumeration e = languages.elements();
Vector l = new Vector();
while (e.hasMoreElements()) {
Vector langVector = (Vector) e.nextElement();
Enumeration enumeration = langVector.elements();
while (enumeration.hasMoreElements()) {
String language = (String) enumeration.nextElement();
String country = "";
String variant = "";
int countryIndex = language.indexOf("-");
if (countryIndex > -1) {
country = language.substring(countryIndex + 1).trim();
language = language.substring(0, countryIndex).trim();
int variantIndex = country.indexOf("-");
if (variantIndex > -1) {
variant = country.substring(variantIndex + 1).trim();
country = country.substring(0, variantIndex).trim();
}
}
if(secure){
if ((country.trim().length()!= 0 && !isValueAlphaNumeric(country, "country")) ||
(language.trim().length()!= 0 && !isValueAlphaNumeric(language, "language"))) {
language = Locale.getDefault().getLanguage();
country = Locale.getDefault().getCountry();
variant = "";
}
if (variant.trim().length()!= 0 && !isValueAlphaNumeric(variant, "variant")) {
variant = "";
}
}
l.addElement(new Locale(language, country, variant));
}
}
return l;
}
|
java
|
public static String getEncodingFromLocale(Locale locale) {
init();
if (locale == cachedLocale) {
return cachedEncoding;
}
String encoding = null;
/*(String) _localeMap.get(locale.toString());
if (encoding == null) {
encoding = (String) _localeMap.get(locale.getLanguage() + "_" + locale.getCountry());
if (encoding == null) {
encoding = (String) _localeMap.get(locale.getLanguage());
}
}*/
if (encoding == null) {
//check the com.ibm.wsspi.http.EncodingUtils
com.ibm.wsspi.http.EncodingUtils encodingUtils = com.ibm.ws.webcontainer.osgi.WebContainer.getEncodingUtils();
if (encodingUtils!=null) {
encoding = encodingUtils.getEncodingFromLocale(locale);
}
}
cachedEncoding = encoding;
cachedLocale = locale;
return encoding;
}
|
java
|
public static String getJvmConverter(String encoding) {
init();
//String converter = (String) _converterMap.get(encoding.toLowerCase());
String converter = null;
com.ibm.wsspi.http.EncodingUtils encodingUtils = com.ibm.ws.webcontainer.osgi.WebContainer.getEncodingUtils();
if (encodingUtils!=null) {
converter = encodingUtils.getJvmConverter(encoding);
}
if (converter != null) {
return converter;
}
else {
return encoding;
}
}
|
java
|
public static boolean isCharsetSupported (String charset){
Boolean supported = (Boolean) supportedEncodingsCache.get(charset);
if(supported != null){
return supported.booleanValue();
}
try{
new String (TEST_CHAR, charset);
supportedEncodingsCache.put(charset, Boolean.TRUE);
}catch (UnsupportedEncodingException e){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME,"isCharsetSupported", "Encountered UnsupportedEncoding charset [" + charset +"]");
}
supportedEncodingsCache.put(charset, Boolean.FALSE);
return false;
}
return true;
}
|
java
|
public static <T> boolean compareInstance(T t1, T t2) {
if (t1 == t2) {
return true;
}
if (t1 != null && t2 != null && t1.equals(t2)) {
return true;
}
return false;
}
|
java
|
public static boolean compareStrings(String s1, String s2) {
if (s1 == s2)
return true;
if (s1 != null && s2 != null && s1.equals(s2))
return true;
return false;
}
|
java
|
public static boolean compareQNames(QName qn1, QName qn2) {
if (qn1 == qn2)
return true;
if (qn1 == null || qn2 == null)
return false;
return qn1.equals(qn2);
}
|
java
|
public static boolean compareStringLists(List<String> list1, List<String> list2) {
if (list1 == null && list2 == null)
return true;
if (list1 == null || list2 == null)
return false;
if (list1.size() != list2.size())
return false;
for (int i = 0; i < list1.size(); i++) {
if (!compareStrings(list1.get(i), list2.get(i))) {
return false;
}
}
return true;
}
|
java
|
public static boolean compareQNameLists(List<QName> list1, List<QName> list2) {
if (list1 == list2)
return true;
if (list1 == null || list2 == null)
return false;
if (list1.size() != list2.size())
return false;
for (int i = 0; i < list1.size(); i++) {
if (!compareQNames(list1.get(i), list2.get(i)))
return false;
}
return true;
}
|
java
|
public static <T> boolean compareLists(List<T> list1, List<T> list2) {
if (list1 == list2)
return true;
if (list1 == null || list2 == null)
return false;
if (list1.size() != list2.size())
return false;
for (int i = 0; i < list1.size(); i++) {
if (!list1.get(i).equals(list2.get(i))) {
return false;
}
}
return true;
}
|
java
|
public boolean preProcess(ConfigEntry configEntry) {
boolean valid = true;
// there is no override, use the default processorData
if (configEntry.processorData == null)
configEntry.processorData = new Object[BASE_SLOTS];
//persistToDisk
Property p = (Property) configEntry.properties.get(PROPERTY_PERSIST_TO_DISK);
String val = p != null ? (String) p.value : null;
if (val != null) {
val = val.trim();
configEntry.processorData[SLOT_PERSIST_TO_DISK] = new Boolean(val);
}
//do-not-cache
p = (Property) configEntry.properties.get(PROPERTY_DO_NOT_CACHE);
val = p != null ? (String) p.value : null;
if (val != null) {
configEntry.processorData[SLOT_DO_NOT_CACHE] = new Boolean(val);
}
for (int i = 0; i < configEntry.cacheIds.length; i++)
valid &= preProcess(configEntry.cacheIds[i]);
return valid;
}
|
java
|
public JSConsumerSet getConsumerSet()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getConsumerSet");
SibTr.exit(tc, "getConsumerSet", consumerSet);
}
return consumerSet;
}
|
java
|
public long size(Transaction transaction)
throws ObjectManagerException
{
// No trace because this is used by toString(), and hence by trace itself;
long sizeFound; // For return;
synchronized (this) {
sizeFound = availableSize;
// Move through the map adding in any extra available entries.
if (transaction != null) {
Entry entry = firstEntry(transaction);
while (entry != null) {
if (entry.state == Entry.stateToBeAdded && entry.lockedBy(transaction))
sizeFound++;
entry = successor(entry,
transaction);
} // while (entry != null).
} // if (transaction != null).
} // synchronized (this).
return sizeFound;
}
|
java
|
public synchronized boolean isEmpty(Transaction transaction)
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass
, "isEmpty"
, new Object[] { transaction });
boolean returnValue;
if (firstEntry(transaction) == null) {
returnValue = true;
} else {
returnValue = false;
}
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass
, "isEmpty"
, new Object[] { new Boolean(returnValue) }
);
return returnValue;
}
|
java
|
private Entry getEntry(Object key)
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass
, "getEntry"
, new Object[] { key });
Entry entry = (Entry) super.find(key);
if (entry != null) {
// Look for the youngest duplicate.
duplicateSearch: for (;;) {
Entry predecessor = (Entry) predecessor(entry);
if (predecessor == null)
break duplicateSearch;
if (compare(key, predecessor.key) != 0)
break duplicateSearch;
entry = predecessor;
} // for (;;).
} // if (entry != null)
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"getEntry",
new Object[] { entry });
return entry;
}
|
java
|
public synchronized void putDuplicate(Object key,
Token value,
Transaction transaction)
throws ObjectManagerException {
put(key,
value,
transaction,
true);
}
|
java
|
private void add(Object key,
Token value,
Entry currentEntry,
Transaction transaction,
long logSpaceDelta)
throws ObjectManagerException {
final String methodName = "add";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass, methodName, new Object[] { key,
value,
currentEntry,
transaction,
new Long(logSpaceDelta) });
Entry newEntry;
// Place the new Entry at a point greater than or equal to the currentEntry.
keySearch: while (true) {
if (compare(key, currentEntry.key) < 0) { // Less than.
if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
trace.debug(this, cclass, methodName, new Object[] { "Less than branch.",
currentEntry.key });
if (currentEntry.left == null) { // We have reached a less than leaf.
newEntry = new Entry(this
, key
, value
, currentEntry
, transaction
);
transaction.add(newEntry
, logSpaceDelta
);
currentEntry.setLeft(newEntry);
break keySearch; // Now included in the tree.
} // if (currentEntry.left == null).
// Look further into the less than tree.
currentEntry = (Entry) currentEntry.getLeft();
} else { // Greater than or equal.
if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
trace.debug(this, cclass, methodName, new Object[] { "Greater than branch.",
currentEntry.key });
if (currentEntry.right == null) { // Place to the right.
// Add into the greater than side.
newEntry = new Entry(this
, key
, value
, currentEntry
, transaction
);
transaction.add(newEntry
, logSpaceDelta
);
currentEntry.setRight(newEntry);
break keySearch; // Now included in the tree.
} // if (currentEntry.right == null).
// Look further into the greater than tree.
currentEntry = (Entry) currentEntry.getRight();
} // if (comparator...
} // keySearch: while (....
size++;
balance(newEntry);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName);
}
|
java
|
private void undoPut()
throws ObjectManagerException {
final String methodName = "undoPut";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass, methodName);
// Give back all of the remaining space.
owningToken.objectStore.reserve((int) -reservedSpaceInStore, false);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName);
}
|
java
|
public synchronized void clear(Transaction transaction)
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass
, "clear"
+ "transaction=" + transaction + "(Transaction)"
);
// Move through the map deleting each entry as we go.
Entry entry = firstEntry(transaction);
while (entry != null) {
entry.remove(transaction);
entry = successor(entry
, transaction
);
} // while (entry != null).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass
, "clear"
);
}
|
java
|
private int compare(Object key1, Object key2) {
if (comparator == null)
return ((Comparable) key1).compareTo(key2);
else
return comparator.compare(key1, key2);
}
|
java
|
private synchronized void deleteEntry(Entry entry,
Transaction transaction)
throws ObjectManagerException {
final String methodName = "deleteEntry";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass, methodName, new Object[] { entry,
transaction });
// managedObjectsToAdd.clear(); // Not used.
managedObjectsToReplace.clear(); // Reset from last time.
tokensToNotify.clear(); // Reset from last time.
reservedSpaceInStore = (int) storeSpaceForRemove();
rbDelete(entry);
// We have changed the size at least.
managedObjectsToReplace.add(this);
// Harden the updates. Release some of the space we reserved earlier,
// when we deleted the entry, or, if we are backing out, when we added it.
// Releasing the reserved space ensures that the replace will succeed.
tokensToNotify.add(entry.getToken());
transaction.optimisticReplace(null,
new java.util.ArrayList(managedObjectsToReplace),
null, // No tokens to delete.
new java.util.ArrayList(tokensToNotify),
-logSpaceForDelete);
// Release any surplus space we reserved in the store.
// During recovery we don't do this because we will not have reserved the space anyway.
if (transaction.getObjectManagerStateState() != ObjectManagerState.stateReplayingLog)
owningToken.objectStore.reserve(-(int) reservedSpaceInStore, false);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName);
}
|
java
|
void move(AbstractTreeMap.Entry x, AbstractTreeMap.Entry y)
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"move",
new Object[] { x, y });
Entry yParent = (Entry) y.getParent();
// Set x into the position occupied by y.
x.setParent(yParent);
if (yParent == null)
setRoot(x);
else if (yParent.getRight() == y)
yParent.setRight(x);
else
yParent.setLeft(x);
x.setLeft(y.getLeft());
x.setRight(y.getRight());
// Set the x to be the parent of y's children.
if (y.getLeft() != null)
y.getLeft().setParent(x);
if (y.getRight() != null)
y.getRight().setParent(x);
x.setColor(y.getColor());
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"move",
new Object[] { x });
}
|
java
|
public synchronized void print(java.io.PrintWriter printWriter)
{
printWriter.println("Dump of TreeMap size=" + size + "(long)");
try {
for (Iterator iterator = entrySet().iterator(); iterator.hasNext();) {
Entry entry = (Entry) iterator.next();
printWriter.println((indexLabel(entry) + " ").substring(0, 20)
+ (entry.getColor() ? " RED " : " BLACK")
+ " Entry=" + entry);
} // for(iterator...
} catch (ObjectManagerException objectManagerException) {
// No FFDC code needed.
printWriter.println("Caught objectManagerException=" + objectManagerException);
objectManagerException.printStackTrace(printWriter);
} // try...
}
|
java
|
public static boolean containsMultipleRoutingContext(RESTRequest request) {
//TODO: add a check for query string
if (request instanceof ServletRESTRequestWithParams) {
ServletRESTRequestWithParams req = (ServletRESTRequestWithParams) request;
return (req.getParam(ClientProvider.COLLECTIVE_HOST_NAMES) != null || request.getHeader(ClientProvider.COLLECTIVE_HOST_NAMES) != null);
}
return request.getHeader(ClientProvider.COLLECTIVE_HOST_NAMES) != null;
}
|
java
|
public static String[] getRoutingContext(RESTRequest request, boolean errorIfNull) {
//Look for headers first
String targetHost = request.getHeader(ClientProvider.ROUTING_KEY_HOST_NAME);
if (targetHost != null) {
targetHost = URLDecoder(targetHost, null);
String targetUserDir = request.getHeader(ClientProvider.ROUTING_KEY_SERVER_USER_DIR);
String targetServer = request.getHeader(ClientProvider.ROUTING_KEY_SERVER_NAME);
targetUserDir = (targetUserDir == null) ? null : URLDecoder(targetUserDir, null);
targetServer = (targetServer == null) ? null : URLDecoder(targetServer, null);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event("RESTHelper", tc, "Found routing context in headers. Host:" + targetHost + " | UserDir:" + targetUserDir + " | Server:" + targetServer);
}
return new String[] { targetHost, targetUserDir, targetServer };
} else {
//TODO: re-visit once a decision is made on the value of these keys (current values are too big
//Look for query strings (note: query params are not automatically decoded when returned from getQueryString())
final String queryStr = request.getQueryString();
//Optimization: Do a quick lookup to see if the raw queryStr contains a routing context key
if (queryStr == null || !queryStr.contains(ClientProvider.ROUTING_KEY_HOST_NAME)) {
if (errorIfNull) {
//TODO: make real translated message
throw ErrorHelper.createRESTHandlerJsonException(new IOException("routing context was not present in the request!"), null, APIConstants.STATUS_BAD_REQUEST);
}
return null;
}
//We know it contains at least the host, so split it
String[] queryParts = queryStr.split("[&=]");
String[] routingParams = new String[3];
final int size = queryParts.length;
for (int i = 0; i < size; i++) {
if (ClientProvider.ROUTING_KEY_HOST_NAME.equals(queryParts[i])) {
//The value will be at i + 1
routingParams[0] = URLDecoder(queryParts[i + 1], null);
//Move to next key
i++;
continue;
} else if (ClientProvider.ROUTING_KEY_SERVER_USER_DIR.equals(queryParts[i])) {
//The value will be at i + 1
routingParams[1] = URLDecoder(queryParts[i + 1], null);
//Move to next key
i++;
continue;
} else if (ClientProvider.ROUTING_KEY_SERVER_NAME.equals(queryParts[i])) {
//The value will be at i + 1
routingParams[2] = URLDecoder(queryParts[i + 1], null);
//Move to next key
i++;
continue;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event("RESTHelper", tc, "Found routing context in queryStr. Host:" + routingParams[0] + " | UserDir:" + routingParams[1] + " | Server:" + routingParams[2]);
}
return routingParams;
}
}
|
java
|
public static boolean isDefaultAttributeValue(Object value)
{
if (value == null)
{
return true;
}
else if (value instanceof Boolean)
{
return !((Boolean) value).booleanValue();
}
else if (value instanceof Number)
{
if (value instanceof Integer)
{
return ((Number) value).intValue() == Integer.MIN_VALUE;
}
else if (value instanceof Double)
{
return ((Number) value).doubleValue() == Double.MIN_VALUE;
}
else if (value instanceof Long)
{
return ((Number) value).longValue() == Long.MIN_VALUE;
}
else if (value instanceof Byte)
{
return ((Number) value).byteValue() == Byte.MIN_VALUE;
}
else if (value instanceof Float)
{
return ((Number) value).floatValue() == Float.MIN_VALUE;
}
else if (value instanceof Short)
{
return ((Number) value).shortValue() == Short.MIN_VALUE;
}
}
return false;
}
|
java
|
public static Converter findUIOutputConverter(FacesContext facesContext,
UIOutput component) throws FacesException
{
return _SharedRendererUtils.findUIOutputConverter(facesContext,
component);
}
|
java
|
public static Converter findUISelectManyConverter(
FacesContext facesContext, UISelectMany component)
{
return findUISelectManyConverter(facesContext, component, false);
}
|
java
|
public static Converter findUISelectManyConverter(
FacesContext facesContext, UISelectMany component,
boolean considerValueType)
{
// If the component has an attached Converter, use it.
Converter converter = component.getConverter();
if (converter != null)
{
return converter;
}
if (considerValueType)
{
// try to get a converter from the valueType attribute
converter = _SharedRendererUtils.getValueTypeConverter(
facesContext, component);
if (converter != null)
{
return converter;
}
}
//Try to find out by value expression
ValueExpression ve = component.getValueExpression("value");
if (ve == null)
{
return null;
}
// Try to get the type from the actual value or,
// if value == null, obtain the type from the ValueExpression
Class<?> valueType = null;
Object value = ve.getValue(facesContext.getELContext());
valueType = (value != null) ? value.getClass() : ve
.getType(facesContext.getELContext());
if (valueType == null)
{
return null;
}
// a valueType of Object is also permitted, in order to support
// managed bean properties of type Object that resolve to null at this point
if (Collection.class.isAssignableFrom(valueType)
|| Object.class.equals(valueType))
{
// try to get the by-type-converter from the type of the SelectItems
return _SharedRendererUtils.getSelectItemsValueConverter(
new SelectItemsIterator(component, facesContext),
facesContext);
}
if (!valueType.isArray())
{
throw new IllegalArgumentException(
"ValueExpression for UISelectMany : "
+ getPathToComponent(component)
+ " must be of type Collection or Array");
}
Class<?> arrayComponentType = valueType.getComponentType();
if (String.class.equals(arrayComponentType))
{
return null; //No converter needed for String type
}
if (Object.class.equals(arrayComponentType))
{
// There is no converter for Object class
// try to get the by-type-converter from the type of the SelectItems
return _SharedRendererUtils.getSelectItemsValueConverter(
new SelectItemsIterator(component, facesContext),
facesContext);
}
try
{
return facesContext.getApplication().createConverter(
arrayComponentType);
}
catch (FacesException e)
{
log.log(Level.SEVERE,
"No Converter for type " + arrayComponentType.getName()
+ " found", e);
return null;
}
}
|
java
|
public static Set getSelectedValuesAsSet(FacesContext context,
UIComponent component, Converter converter,
UISelectMany uiSelectMany)
{
Object selectedValues = uiSelectMany.getValue();
return internalSubmittedOrSelectedValuesAsSet(context, component,
converter, uiSelectMany, selectedValues, true);
}
|
java
|
public static String getConvertedStringValue(FacesContext context,
UIComponent component, Converter converter, Object value)
{
if (converter == null)
{
if (value == null)
{
return "";
}
else if (value instanceof String)
{
return (String) value;
}
else
{
return value.toString();
}
}
return converter.getAsString(context, component, value);
}
|
java
|
public static String getConvertedStringValue(FacesContext context,
UIComponent component, Converter converter, SelectItem selectItem)
{
return getConvertedStringValue(context, component, converter,
selectItem.getValue());
}
|
java
|
public static Object getConvertedUISelectManyValue(
FacesContext facesContext, UISelectMany selectMany,
Object submittedValue, boolean considerValueType)
throws ConverterException
{
if (submittedValue == null)
{
return null;
}
if (!(submittedValue instanceof String[]))
{
throw new ConverterException(
"Submitted value of type String[] for component : "
+ getPathToComponent(selectMany) + "expected");
}
return _SharedRendererUtils.getConvertedUISelectManyValue(facesContext,
selectMany, (String[]) submittedValue, considerValueType);
}
|
java
|
public static void initPartialValidationAndModelUpdate(
UIComponent component, FacesContext facesContext)
{
String actionFor = (String) component.getAttributes().get("actionFor");
if (actionFor != null)
{
List li = convertIdsToClientIds(actionFor, facesContext, component);
facesContext.getExternalContext().getRequestMap()
.put(ACTION_FOR_LIST, li);
String actionForPhase = (String) component.getAttributes().get(
"actionForPhase");
if (actionForPhase != null)
{
List phaseList = convertPhasesToPhasesIds(actionForPhase);
facesContext.getExternalContext().getRequestMap()
.put(ACTION_FOR_PHASE_LIST, phaseList);
}
}
}
|
java
|
@Deprecated
public static ResponseStateManager getResponseStateManager(
FacesContext facesContext, String renderKitId)
throws FacesException
{
RenderKit renderKit = facesContext.getRenderKit();
if (renderKit == null)
{
// look for the renderkit in the request
Map attributesMap = facesContext.getAttributes();
RenderKitFactory factory = (RenderKitFactory) attributesMap
.get(RENDER_KIT_IMPL);
if (factory != null)
{
renderKit = factory.getRenderKit(facesContext, renderKitId);
}
else
{
factory = (RenderKitFactory) FactoryFinder
.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
if (factory == null)
{
throw new IllegalStateException("Factory is null");
}
attributesMap.put(RENDER_KIT_IMPL, factory);
renderKit = factory.getRenderKit(facesContext, renderKitId);
}
}
if (renderKit == null)
{
throw new IllegalArgumentException(
"Could not find a RenderKit for \"" + renderKitId + "\"");
}
return renderKit.getResponseStateManager();
}
|
java
|
static public String toResourceUri(FacesContext facesContext, Object o)
{
if (o == null)
{
return null;
}
String uri = o.toString();
// *** EL Coercion problem ***
// If icon or image attribute was declared with #{resource[]} and that expression
// evaluates to null (it means ResourceHandler.createResource returns null because
// requested resource does not exist)
// EL implementation turns null into ""
// see http://www.irian.at/blog/blogid/unifiedElCoercion/#unifiedElCoercion
if (uri.length() == 0)
{
return null;
}
// With JSF 2.0 url for resources can be done with EL like #{resource['resourcename']}
// and such EL after evalution contains context path for the current web application already,
// -> we dont want call viewHandler.getResourceURL()
if (uri.contains(ResourceHandler.RESOURCE_IDENTIFIER))
{
return uri;
}
// Treat two slashes as server-relative
if (uri.startsWith("//"))
{
return uri.substring(1);
}
else
{
// If the specified path starts with a "/",
// following method will prefix it with the context path for the current web application,
// and return the result
String resourceURL = facesContext.getApplication().getViewHandler()
.getResourceURL(facesContext, uri);
return facesContext.getExternalContext().encodeResourceURL(
resourceURL);
}
}
|
java
|
public final static String trim(String value)
{
String result = null;
if (null != value)
{
result = value.trim();
}
return result;
}
|
java
|
protected void customizeClientProperties(Message message) {
if (null == configPropertiesSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "There are no client properties.");
}
return;
}
Bus bus = message.getExchange().getBus();
if (null == bus) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "The bus is null");
}
return;
}
for (ConfigProperties configProps : configPropertiesSet) {
if (JaxWsConstants.HTTP_CONDUITS_SERVICE_FACTORY_PID.equals(configProps.getFactoryPid())) {
customizeHttpConduitProperties(message, bus, configProps);
}
}
}
|
java
|
protected void customizePortAddress(Message message) {
String address = null;
PortComponentRefInfo portInfo = null;
if (null != wsrInfo) {
QName portQName = getPortQName(message);
if (null != portQName) {
portInfo = wsrInfo.getPortComponentRefInfo(portQName);
address = (null != portInfo && null != portInfo.getAddress()) ? portInfo.getAddress() : wsrInfo.getDefaultPortAddress();
}
}
if (null != address) {
//change the endpoint address if there is a valid one.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "The endpoint address is overriden by " + address);
}
message.put(Message.ENDPOINT_ADDRESS, address);
}
}
|
java
|
private static String discoverClassName(ClassLoader tccl) {
String className = null;
// First services API
className = getClassNameServices(tccl);
if (className == null) {
if (IS_SECURITY_ENABLED) {
className = AccessController.doPrivileged(
new PrivilegedAction<String>() {
@Override
public String run() {
return getClassNameJreDir();
}
}
);
} else {
// Second el.properties file
className = getClassNameJreDir();
}
}
if (className == null) {
if (IS_SECURITY_ENABLED) {
className = AccessController.doPrivileged(
new PrivilegedAction<String>() {
@Override
public String run() {
return getClassNameSysProp();
}
}
);
} else {
// Third system property
className = getClassNameSysProp();
}
}
if (className == null) {
// Fourth - default
className = "org.apache.el.ExpressionFactoryImpl";
}
return className;
}
|
java
|
private static void addBundleManifestRequireCapability(FileSystem zipSystem,
Path bundle,
Map<Path, String> requiresMap) throws IOException {
Path extractedJar = null;
try {
// Need to extract the bundles to read their manifest, can't find a way to do this in place.
extractedJar = Files.createTempFile("unpackedBundle", ".jar");
extractedJar.toFile().deleteOnExit();
Files.copy(bundle, extractedJar, StandardCopyOption.REPLACE_EXISTING);
Manifest bundleJarManifest = null;
JarFile bundleJar = null;
try {
bundleJar = new JarFile(extractedJar.toFile());
bundleJarManifest = bundleJar.getManifest();
} finally {
if (bundleJar != null) {
bundleJar.close();
}
}
Attributes bundleManifestAttrs = bundleJarManifest.getMainAttributes();
String requireCapabilityAttr = bundleManifestAttrs.getValue(REQUIRE_CAPABILITY_HEADER_NAME);
if (requireCapabilityAttr != null) {
requiresMap.put(bundle, requireCapabilityAttr);
}
} finally {
if (extractedJar != null) {
extractedJar.toFile().delete();
}
}
}
|
java
|
private static void addSubsystemManifestRequireCapability(File esa,
Map<Path, String> requiresMap) throws IOException {
String esaLocation = esa.getAbsolutePath();
ZipFile zip = null;
try {
zip = new ZipFile(esaLocation);
Enumeration<? extends ZipEntry> zipEntries = zip.entries();
ZipEntry subsystemEntry = null;
while (zipEntries.hasMoreElements()) {
ZipEntry nextEntry = zipEntries.nextElement();
if ("OSGI-INF/SUBSYSTEM.MF".equalsIgnoreCase(nextEntry.getName())) {
subsystemEntry = nextEntry;
break;
}
}
if (subsystemEntry == null) {
;
} else {
Manifest m = ManifestProcessor.parseManifest(zip.getInputStream(subsystemEntry));
Attributes manifestAttrs = m.getMainAttributes();
String requireCapabilityAttr = manifestAttrs.getValue(REQUIRE_CAPABILITY_HEADER_NAME);
requiresMap.put(esa.toPath(), requireCapabilityAttr);
}
} finally {
if (zip != null) {
zip.close();
}
}
}
|
java
|
@Override
public void filter(ClientRequestContext requestContext) {
//
if (requestContext == null || jwt == null || requestContext.getHeaders().containsKey("Authorization")) {
return;
}
if (header == null || header.equals("")) {
header = "Authorization";
}
final String headerValue;
if ("Authorization".equals(header)) {
headerValue = "Bearer " + jwt;
} else {
headerValue = jwt;
}
requestContext.getHeaders().add(header, headerValue);
}
|
java
|
public static String urlDecode(String value, String enc) {
return urlDecode(value, enc, false);
}
|
java
|
public static String pathDecode(String value) {
return urlDecode(value, StandardCharsets.UTF_8.name(), true);
}
|
java
|
public static Map<String, String> parseQueryString(String s) {
Map<String, String> ht = new HashMap<String, String>();
StringTokenizer st = new StringTokenizer(s, "&");
while (st.hasMoreTokens()) {
String pair = st.nextToken();
int pos = pair.indexOf('=');
if (pos == -1) {
ht.put(pair.toLowerCase(), "");
} else {
ht.put(pair.substring(0, pos).toLowerCase(),
pair.substring(pos + 1));
}
}
return ht;
}
|
java
|
public static String getStem(String baseURI) {
int idx = baseURI.lastIndexOf('/');
String result = baseURI;
if (idx != -1) {
result = baseURI.substring(0, idx);
}
return result;
}
|
java
|
private synchronized CacheEntryWrapper updateCacheList(Object key) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINER)) {
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[UPDATE_CACHE_LIST], "key=" + key);
}
CacheEntryWrapper entry = (CacheEntryWrapper) super.get(key);
if (entry == null) {
return null;
}
CacheEntryWrapper prev = entry.prev;
CacheEntryWrapper next = entry.next;
if (prev != null) {
prev.next = next;
entry.prev = null;
entry.next = mru;
mru.prev = entry;
mru = entry;
if (next != null)
next.prev = prev;
else
lru = prev;
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
//PM16861
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[UPDATE_CACHE_LIST], "Returning object associated with this key=" + key);
}
return entry;
}
|
java
|
public SICoreConnection getSICoreConnection() throws IllegalStateException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "getSICoreConnection");
}
if (_sessionClosed) {
throw new IllegalStateException(NLS.getFormattedMessage(
("ILLEGAL_STATE_CWSJR1123"),
new Object[] { "getSICoreConnection"}, null));
}
if (_sessionInvalidated) {
throw new IllegalStateException(NLS.getFormattedMessage(
("ILLEGAL_STATE_CWSJR1124"),
new Object[] { "getSICoreConnection"}, null));
}
SICoreConnection coreConnection = null;
if (_connection != null) {
coreConnection = _connection.getSICoreConnection();
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "getSICoreConnection", coreConnection);
}
return coreConnection;
}
|
java
|
void dissociate() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "dissociate");
}
_managedConnection = null;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "dissociate");
}
}
|
java
|
void associate(final JmsJcaManagedConnection managedConnection) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "associate", managedConnection);
}
if (_managedConnection != null) {
_managedConnection.disassociateSession(this);
}
_managedConnection = managedConnection;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "associate");
}
}
|
java
|
void invalidate() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "invalidate");
}
_sessionInvalidated = true;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "invalidate");
}
}
|
java
|
void setParentConnection(final JmsJcaConnectionImpl connection) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "setParentConnection", connection);
}
_connection = connection;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "setParentConnection");
}
}
|
java
|
static public InterceptorMetaData createInterceptorMetaData
(EJBMDOrchestrator ejbMDOrchestrator
, BeanMetaData bmd
, final Map<Method, ArrayList<EJBMethodInfoImpl>> methodInfoMap) // d430356
throws EJBConfigurationException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
{
Tr.entry(tc, "createInterceptorMetaData");
}
// Pre-condition ensures this method is only called for EJB 3 module and
// for EJBs that are not a CMP or BMP.
EJBModuleMetaDataImpl mmd = (EJBModuleMetaDataImpl) bmd.getModuleMetaData();
// Create a factory instance to use for creating InterceptorMetaData.
InterceptorMetaDataFactory factory = new InterceptorMetaDataFactory(mmd, bmd);
// Initialize the ivEJBMethodInfoMap with an entry for each
// business method of this EJB.
factory.ivEJBMethodInfoMap = methodInfoMap; // d430356
// Validate and initialize for processing any InterceptorBinding
// objects from WCCM.
if (factory.ivInterceptorBinding != null) // d367572.9
{
factory.validateInterceptorBindings();
}
// Determine whether default interceptors need to be excluded
// for this EJB.
factory.setExcludeDefaultInterceptors();
// Add the list of default interceptors to the interceptor name to
// class object map (ivInterceptorNameToClassMap).
factory.addDefaultInterceptors();
// Add the list of class-level interceptors to the interceptor name to
// class object map (ivInterceptorNameToClassMap).
factory.addClassLevelInterceptors();
// Determine the ordering of interceptors to be used at class-level for this EJB.
// This list is the default list to use for all business methods of this
// EJB if no method-level annotation or interceptor binding exists for
// the method.
factory.ivClassInterceptorOrder = factory.orderClassLevelInterceptors();
// If the module is CDI enabled, then add the interceptor provided by
// the JCDI service to the class object map (ivInterceptorNameToClassMap).
factory.addJCDIInterceptors(); // F743-15628
// Process interceptor methods on the bean class. This must be called
// prior to calling getInterceptorProxies below (directly or indirectly
// via updateEJBMethodInfoInterceptorProxies).
factory.processBeanInterceptors(); // d630717
// Process all business methods of the EJB and update any EJBMethodInfo
// object for any business method that requires one or more around-invoke
// or around-timeout interceptor methods to be invoked.
factory.updateEJBMethodInfoInterceptorProxies(); // d386227
// d630717 - Process all lifecycle interceptor classes of the EJB. The
// first call will populate ivInterceptorProxyMaps, and the subsequent
// calls will simply concatenate the lists.
InterceptorProxy[] postConstructProxies = factory.getInterceptorProxies(InterceptorMethodKind.POST_CONSTRUCT, factory.ivClassInterceptorOrder);
InterceptorProxy[] preDestroyProxies = factory.getInterceptorProxies(InterceptorMethodKind.PRE_DESTROY, factory.ivClassInterceptorOrder);
InterceptorProxy[] prePassivateProxies = factory.getInterceptorProxies(InterceptorMethodKind.PRE_PASSIVATE, factory.ivClassInterceptorOrder);
InterceptorProxy[] postActivateProxies = factory.getInterceptorProxies(InterceptorMethodKind.POST_ACTIVATE, factory.ivClassInterceptorOrder);
InterceptorProxy[] aroundConstructProxies = factory.getInterceptorProxies(InterceptorMethodKind.AROUND_CONSTRUCT, factory.ivClassInterceptorOrder);
// d630717 - Finally, if the bean has interceptor methods or if
// getInterceptorProxies added an interceptor class, then construct
// InterceptorMetaData to return.
InterceptorMetaData imd = null;
if (!factory.ivBeanInterceptorProxyMap.isEmpty() || !factory.ivInterceptorClasses.isEmpty())
{
Class<?>[] classes = factory.ivInterceptorClasses.toArray(new Class<?>[0]);
// Get the managed object factories for each interceptor class. F87720
ManagedObjectFactory<?>[] managedObjectFactories = null;
for (int i = 0; i < classes.length; i++)
{
ManagedObjectFactory<?> managedObjectFactory = ejbMDOrchestrator.getInterceptorManagedObjectFactory(bmd, classes[i]);
if (managedObjectFactory != null)
{
if (managedObjectFactories == null)
{
managedObjectFactories = new ManagedObjectFactory[classes.length];
}
managedObjectFactories[i] = managedObjectFactory;
}
}
imd = new InterceptorMetaData(classes
, managedObjectFactories
, aroundConstructProxies
, postConstructProxies
, postActivateProxies
, prePassivateProxies
, preDestroyProxies
, factory.ivBeanLifecycleMethods // F743-1751
);
}
if (isTraceOn && tc.isEntryEnabled())
{
Tr.exit(tc, "createInterceptorMetaData returning: " + imd);
}
return imd;
}
|
java
|
private void addJCDIInterceptors()
{
// Must be in a JCDI enabled module, and not a ManagedBean
JCDIHelper jcdiHelper = ivEJBModuleMetaDataImpl.ivJCDIHelper;
if (jcdiHelper != null && !ivBmd.isManagedBean()) // F743-34301.1
{
// Obtain the interceptor to start the interceptor chain. F743-29169
J2EEName j2eeName = ivEJBModuleMetaDataImpl.ivJ2EEName;
ivJCDIFirstInterceptorClass = jcdiHelper.getFirstEJBInterceptor(j2eeName,
ivEjbClass);
if (ivJCDIFirstInterceptorClass != null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "addJCDIInterceptor : " + ivJCDIFirstInterceptorClass.getName());
ivInterceptorNameToClassMap.put(ivJCDIFirstInterceptorClass.getName(),
ivJCDIFirstInterceptorClass);
}
// Obtain the interceptor at the end of the interceptor chain.
ivJCDILastInterceptorClass = jcdiHelper.getEJBInterceptor(j2eeName,
ivEjbClass);
if (ivJCDILastInterceptorClass != null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "addJCDIInterceptor : " + ivJCDILastInterceptorClass.getName());
ivInterceptorNameToClassMap.put(ivJCDILastInterceptorClass.getName(),
ivJCDILastInterceptorClass);
}
}
}
|
java
|
private List<String> addLoadedInterceptorClasses(Class<?>[] classes) // d630717
{
List<String> names = new ArrayList<String>();
for (Class<?> klass : classes)
{
String className = klass.getName();
ivInterceptorNameToClassMap.put(className, klass);
names.add(className);
}
return names;
}
|
java
|
private ArrayList<String> addMethodLevelInterceptors(Method method, EJBInterceptorBinding methodBinding)
throws EJBConfigurationException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
{
Tr.entry(tc, "addMethodLevelInterceptors method: " + method.getName());
}
// List of method-level interceptor names to return to the caller.
ArrayList<String> interceptorNames = new ArrayList<String>();
if (!ivMetadataComplete)
{
// Process annotation first since the interceptor classes from
// annotation are the first ones that need to be called.
Interceptors methodLevelInterceptors = method.getAnnotation(Interceptors.class);
String methodName = method.getName();
if (methodLevelInterceptors != null)
{
if (isTraceOn && tc.isDebugEnabled())
{
Tr.debug(tc, "processing @Interceptor annotation for method: " + methodName
+ ", EJB name: " + ivEjbName);
}
// Get list of interceptor names and classes.
List<String> names = addLoadedInterceptorClasses(methodLevelInterceptors.value()); // d630717
// Add to the interceptor names list to be returned to the caller.
interceptorNames.addAll(names);
}
}
// Now augment this list by processing the class level InterceptorBinding from
// WCCM for this method of the EJB (if one exists).
if (methodBinding != null)
{
if (isTraceOn && tc.isDebugEnabled())
{
Tr.debug(tc, "processing interceptor binding for method: " + method);
}
List<String> names = methodBinding.ivInterceptorClassNames; // d453477
updateNamesToClassMap(names); // d630717
// Add to the interceptor names list to be returned to the caller.
interceptorNames.addAll(names);
}
if (isTraceOn && tc.isEntryEnabled())
{
Tr.exit(tc, "addMethodLevelInterceptors: " + interceptorNames);
}
// Return list of method-level interceptor names for this business method.
return interceptorNames;
}
|
java
|
private void updateEJBMethodInfoInterceptorProxies() // d386227
throws EJBConfigurationException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
{
Tr.entry(tc, "updateEJBMethodInfoInterceptorProxies: " + ivEjbName);
}
// For each method, update EJBMethodInfo with the correct array of
// InterceptorProxy array needed for that method.
for (Map.Entry<Method, ArrayList<EJBMethodInfoImpl>> entry : ivEJBMethodInfoMap.entrySet()) // d630717
{
InterceptorProxy[] proxies = getAroundInterceptorProxies(InterceptorMethodKind.AROUND_INVOKE, entry.getKey()); // F743-17763
// Update the EJBMethodInfos with the InterceptorProxy array for this method.
if (proxies != null)
{
for (EJBMethodInfoImpl info : entry.getValue()) // d630717
{
info.setAroundInterceptorProxies(proxies); // F743-17763.1
}
}
}
// F743-17763 - For each timer method, update EJBMethodInfo with the
// correct array of InterceptorProxy for that method. The preceding loop
// does not include EJBMethodInfoImpls for MethodInterface.TIMED_OBJECT,
// so this loop's call to setAroundInterceptorProxies does not conflict.
if (ivBmd.timedMethodInfos != null)
{
for (EJBMethodInfoImpl info : ivBmd.timedMethodInfos)
{
InterceptorProxy[] proxies = getAroundInterceptorProxies(InterceptorMethodKind.AROUND_TIMEOUT
, info.getMethod());
if (proxies != null)
{
info.setAroundInterceptorProxies(proxies); // F743-17763.1
}
}
}
if (isTraceOn && tc.isEntryEnabled())
{
Tr.exit(tc, "updateEJBMethodInfoInterceptorProxies: " + ivJ2EEName);
}
}
|
java
|
private InterceptorProxy[] getAroundInterceptorProxies(InterceptorMethodKind kind, Method m)
throws EJBConfigurationException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
{
Tr.entry(tc, "getAroundInterceptorProxies: " + kind + ", " + m);
}
// d630717 - Unconditionally create an ordered list of interceptors to
// pass to getInterceptorProxies.
List<String> orderedList = orderMethodLevelInterceptors(m);
// Now create the InterceptorProxy array required for business method specified
// by the caller.
InterceptorProxy[] proxies = getInterceptorProxies(kind, orderedList); // d630717
// Return the InterceptorProxy array for invoking around invoke interceptors
// for the businesss method specified by the caller.
if (isTraceOn && tc.isEntryEnabled())
{
Tr.exit(tc, "getAroundInterceptorProxies");
}
return proxies;
}
|
java
|
private void processBeanInterceptors() // d630717
throws EJBConfigurationException
{
ivBeanInterceptorProxyMap = createInterceptorProxyMap(ivEjbClass, -1);
// F743-1751 - Not all bean types collect bean methods. For those
// that do, find the methods that are declared on the bean.
if (ivBeanLifecycleMethods != null)
{
for (InterceptorMethodKind kind : InterceptorMethodKind.values())
{
int mid = kind.getMethodID();
if (mid != -1)
{
List<InterceptorProxy> proxyList = ivBeanInterceptorProxyMap.get(kind);
if (proxyList != null)
{
for (InterceptorProxy proxy : proxyList)
{
Method m = proxy.ivInterceptorMethod;
if (m.getDeclaringClass() == ivEjbClass)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "found bean " + LifecycleInterceptorWrapper.TRACE_NAMES[mid] + " method: " + m);
ivBeanLifecycleMethods[mid] = m;
break;
}
}
}
}
}
}
}
|
java
|
private InterceptorProxy[] getInterceptorProxies(InterceptorMethodKind kind, List<String> orderedList) // d630717
throws EJBConfigurationException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
{
Tr.entry(tc, "getInterceptorProxies: " + kind + ", " + orderedList);
}
List<InterceptorProxy> proxyList = new ArrayList<InterceptorProxy>();
// Iterate over the ordered list of interceptor classes. For each
// interceptor, get the list of interceptor proxies of the appropriate
// interceptor kind, and add the proxies to the list.
for (String name : orderedList)
{
// Every class should have been loaded by this point. We make this
// a requirement because it's more efficient than going to the class
// loader and because it's trivial to ensure.
Class<?> klass = ivInterceptorNameToClassMap.get(name);
Map<InterceptorMethodKind, List<InterceptorProxy>> proxyMap = ivInterceptorProxyMaps.get(klass);
if (proxyMap == null)
{
// The proxies for this interceptor have not been created yet. Add
// the class to the list of interceptor proxy classes, and then
// create the map using that array index.
int index = ivInterceptorClasses.size();
ivInterceptorClasses.add(klass);
proxyMap = createInterceptorProxyMap(klass, index);
ivInterceptorProxyMaps.put(klass, proxyMap);
}
List<InterceptorProxy> kindProxyList = proxyMap.get(kind);
if (kindProxyList != null)
{
proxyList.addAll(kindProxyList);
}
}
// If CDI is enabled, add the proxies from the first JCDI interceptor
// class. It should run before all other interceptors. F743-29169
if (ivJCDIFirstInterceptorClass != null)
{
Map<InterceptorMethodKind, List<InterceptorProxy>> proxyMap = ivInterceptorProxyMaps.get(ivJCDIFirstInterceptorClass);
if (proxyMap == null)
{
// The proxies for this interceptor have not been created yet. Add
// the class to the list of interceptor proxy classes, and then
// create the map using that array index.
int index = ivInterceptorClasses.size();
ivInterceptorClasses.add(ivJCDIFirstInterceptorClass);
proxyMap = createInterceptorProxyMap(ivJCDIFirstInterceptorClass, index);
ivInterceptorProxyMaps.put(ivJCDIFirstInterceptorClass, proxyMap);
}
List<InterceptorProxy> kindProxyList = proxyMap.get(kind);
if (kindProxyList != null)
{
proxyList.addAll(0, kindProxyList); // adds to beginning
}
}
// If CDI is enabled, add the proxies from the last JCDI interceptor
// class. It should run after all other interceptors. F743-15628
if (ivJCDILastInterceptorClass != null)
{
Map<InterceptorMethodKind, List<InterceptorProxy>> proxyMap = ivInterceptorProxyMaps.get(ivJCDILastInterceptorClass);
if (proxyMap == null)
{
// The proxies for this interceptor have not been created yet. Add
// the class to the list of interceptor proxy classes, and then
// create the map using that array index.
int index = ivInterceptorClasses.size();
ivInterceptorClasses.add(ivJCDILastInterceptorClass);
proxyMap = createInterceptorProxyMap(ivJCDILastInterceptorClass, index);
ivInterceptorProxyMaps.put(ivJCDILastInterceptorClass, proxyMap);
}
List<InterceptorProxy> kindProxyList = proxyMap.get(kind);
if (kindProxyList != null)
{
proxyList.addAll(kindProxyList); // adds to end
}
}
// Finally, add the interceptor proxies from the bean class.
List<InterceptorProxy> kindProxyList = ivBeanInterceptorProxyMap.get(kind);
if (kindProxyList != null)
{
proxyList.addAll(kindProxyList);
}
// Convert the list of proxies to an array.
InterceptorProxy[] proxies;
if (proxyList.isEmpty())
{
proxies = null;
}
else
{
proxies = new InterceptorProxy[proxyList.size()];
proxyList.toArray(proxies);
}
if (isTraceOn && tc.isEntryEnabled())
{
Tr.exit(tc, "getInterceptorProxies: " + Arrays.toString(proxies));
}
return proxies;
}
|
java
|
private void validateEJBCallbackMethod(InterceptorMethodKind actualKind, Method m, boolean annotation)
throws EJBConfigurationException
{
// Get the name of the method.
String methodName = m.getName();
// Map the method name into one of the InterceptorMethodKind enum value
// it is required to be by the EJB 3 specification.
InterceptorMethodKind requiredKind = mapEjbCallbackName(methodName);
// If the method is required to be a interceptor lifecycle callback method,
// does the actual kind match the required kind?
if (requiredKind != null && actualKind != requiredKind)
{
// It is one of the ejbXXXXX methods of the javax.ejb.SessionBean or
// javax.ejb.MessageDriven interfaces, but either annotation or xml was used
// to indicate it is the wrong kind of lifecycle callback event.
// Get the class name of the EJB and map both the required InterceptorMethodKind
// and actual InterceptorMethodKind into a String for the error message.
String ejbClassName = ivEjbClass.getName();
String required = mapInterceptorMethodKind(requiredKind, true, annotation);
String actual = mapInterceptorMethodKind(actualKind, false, annotation);
// Now build and log the error message based on type of EJB.
StringBuilder sb = new StringBuilder();
if (ivMDB)
{
// CNTR0243E: Because the {0} enterprise bean implements the javax.ejb.MessageDriven interface,
// the {1} method must be a {2} method and not a {3} method.
sb.append("CNTR0243E: Because the ").append(ejbClassName);
sb.append(" enterprise bean implements the javax.ejb.MessageDriven interface, the ");
sb.append(methodName).append(" method must be a ").append(required);
sb.append(" method and not a ").append(actual).append(" method.");
Tr.error(tc, "INVALID_MDB_CALLBACK_METHOD_CNTR0243E"
, new Object[] { ejbClassName, methodName, required, actual });
}
else if (ivSLSB)
{
// CNTR0241E: Because the {0} enterprise bean implements the javax.ejb.SessionBean interface,
// the {1} method must be a {2} method and not a {3} method.
sb.append("CNTR0241E: Because the ").append(ejbClassName);
sb.append(" enterprise bean implements the javax.ejb.SessionBean interface, the ");
sb.append(methodName).append(" method must be a ").append(required);
sb.append(" method and not a ").append(actual).append(" method.");
Tr.error(tc, "INVALID_SLSB_CALLBACK_METHOD_CNTR0241E"
, new Object[] { ejbClassName, methodName, required, actual });
}
else if (ivSFSB)
{
// CNTR0242E: Because the {0} enterprise bean implements the javax.ejb.SessionBean interface,
// the {1} method must be a {2} method and not a {3} method.
sb.append("CNTR0242E: Because the ").append(ejbClassName);
sb.append(" enterprise bean implements the javax.ejb.SessionBean interface, the ");
sb.append(methodName).append(" method must be a ").append(required);
sb.append(" method and not a ").append(actual).append(" method.");
Tr.error(tc, "INVALID_SFSB_CALLBACK_METHOD_CNTR0242E"
, new Object[] { ejbClassName, methodName, required, actual });
}
// Throw the EJBConfigurationException with message text that was built for the error.
throw new EJBConfigurationException(sb.toString());
}
}
|
java
|
private ArrayList<String> orderClassLevelInterceptors() throws EJBConfigurationException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
{
Tr.entry(tc, "orderClassLevelInterceptors");
}
// Create the default ordering of class level interceptor names
// for this EJB.
ArrayList<String> orderedList = new ArrayList<String>();
// First add default interceptor names if they are not excluded
// at the class level.
if (ivExcludeDefaultFromClassLevel == false)
{
if (ivDefaultInterceptorNames.size() > 0)
{
orderedList.addAll(ivDefaultInterceptorNames);
}
}
// Now add in the class level interceptors.
if (ivClassInterceptorNames.size() > 0)
{
orderedList.addAll(ivClassInterceptorNames);
}
// Now check whether order is overridden by a <interceptor-order> deployment
// descriptor for this EJB.
if (ivClassInterceptorBinding != null)
{
List<String> order = ivClassInterceptorBinding.ivInterceptorOrder; // d453477
if (!order.isEmpty())
{
// d472972 start
// Yep, default order is being overridden. Verify the <interceptor-order> is
// a complete ordering of the interceptors.
ArrayList<String> interceptorOrder = new ArrayList<String>(order);
if (interceptorOrder.containsAll(orderedList))
{
// The order list is complete, so just use the order that was
// provided by the interceptor-order deployment descriptor.
orderedList = interceptorOrder;
}
else
{
// CNTR0227E: The {1} enterprise bean has an interceptor-order element which specifies
// the following interceptor-order list: {0}. This list is not a total ordering of the
// class-level interceptors for this bean. It is missing the following interceptor names: {2}
List<String> missingList;
if (interceptorOrder.size() < orderedList.size())
{
orderedList.removeAll(interceptorOrder);
missingList = orderedList;
}
else
{
interceptorOrder.removeAll(orderedList);
missingList = interceptorOrder;
}
String ejbName = ivJ2EEName.toString();
Object[] data = new Object[] { ejbName, order, missingList };
Tr.warning(tc, "PARTIAL_CLASS_INTERCEPTOR_ORDER_CNTR0227E", data);
throw new EJBConfigurationException(order + " is not a total ordering of class-level interceptors for EJB "
+ ejbName + ". It is missing interceptor names: " + missingList);
}
// d472972 end
}
}
if (isTraceOn && tc.isEntryEnabled())
{
Tr.exit(tc, "orderClassLevelInterceptors: " + orderedList);
}
return orderedList;
}
|
java
|
private ArrayList<String> orderMethodLevelInterceptors(Method m) // d630717
throws EJBConfigurationException
{
// Create the default ordering of class level interceptor names
// for this EJB.
ArrayList<String> orderedList = new ArrayList<String>();
// Find the InterceptorBinding for the method.
EJBInterceptorBinding binding = findInterceptorBindingForMethod(m);
// Determine if class interceptors are disabled for this method.
boolean excludeClassInterceptors = isClassInterceptorsExcluded(m, binding);
// Determine if default interceptors need to be disabled for this method.
boolean excludeDefaultInterceptors = isDefaultInterceptorsExcluded(m, binding);
// Determine if there are any method-level interceptor classes for this method.
ArrayList<String> interceptors = addMethodLevelInterceptors(m, binding);
// d630717 - Per CTS, we must use the class-level interceptor order. The
// spec is silent on the topic, but it seems reasonable to do so if we
// are not excluding class-level interceptors and method-level agrees
// with class-level about whether or not to exclude default interceptors.
if (!excludeClassInterceptors && excludeDefaultInterceptors == ivExcludeDefaultFromClassLevel)
{
orderedList.addAll(ivClassInterceptorOrder);
}
else
{
// First add default interceptor names if they are not excluded.
if (!excludeDefaultInterceptors)
{
orderedList.addAll(ivDefaultInterceptorNames);
}
// Now add in the class level interceptors.
if (!excludeClassInterceptors)
{
orderedList.addAll(ivClassInterceptorNames);
}
}
// Now add in the method-level interceptors.
orderedList.addAll(interceptors);
// Now check whether order is overridden by a <interceptor-order> deployment
// descriptor for this EJB.
if (binding != null && !binding.ivInterceptorOrder.isEmpty()) // d630717
{
List<String> order = binding.ivInterceptorOrder; // d630717
// d630717 - Ensure that every class in the order can be loaded.
updateNamesToClassMap(order);
// d472972 start
// Yep, default order is being overridden. Verify the <interceptor-order> is
// a complete ordering of the interceptors.
ArrayList<String> interceptorOrder = new ArrayList<String>(order);
if (interceptorOrder.containsAll(orderedList))
{
// The order list is complete, so just use the order that was
// provided by the interceptor-order deployment descriptor.
orderedList = interceptorOrder;
}
else
{
List<String> missingList;
if (interceptorOrder.size() < orderedList.size())
{
orderedList.removeAll(interceptorOrder);
missingList = orderedList;
}
else
{
interceptorOrder.removeAll(orderedList);
missingList = interceptorOrder;
}
// CNTR0228E: The {2} enterprise bean specifies method-level interceptors for the
// {1} method with the following interceptor-order list: {0}. This list is not a
// total ordering of the method-level interceptors for this bean. The list is missing
// the following interceptor names: {3}.
String ejbName = ivJ2EEName.toString();
String methodName = m.getName(); // d630717
Object[] data = new Object[] { ejbName, methodName, order, missingList };
Tr.warning(tc, "PARTIAL_METHOD_INTERCEPTOR_ORDER_CNTR0228E", data);
throw new EJBConfigurationException(order + " is not a total ordering of method-level interceptors for method "
+ methodName + " of EJB " + ejbName + ". It is missing interceptor names: " + missingList);
}
// d472972 end
}
return orderedList;
}
|
java
|
@Override
public boolean containsCacheId(Object cacheId) {
boolean found = false;
if (cacheId != null) {
found = this.coreCache.containsCacheId(cacheId);
}
return found;
}
|
java
|
@Override
public com.ibm.websphere.cache.CacheEntry getEntryFromMemory(Object id) {
final String methodName = "getEntryFromMemory()";
com.ibm.websphere.cache.CacheEntry ce = this.coreCache.get(id);
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id + " cacheEntry=" + ce);
}
return ce;
}
|
java
|
@Override
public Enumeration getAllIds() {
Set ids = this.coreCache.getCacheIds();
ValueSet idvs = new ValueSet(ids.iterator());
return idvs.elements();
}
|
java
|
@Override
public void internalInvalidateByDepId(Object id, int causeOfInvalidation, int source, boolean bFireIL) {
final String methodName = "internalInvalidateByDepId()";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id);
}
this.invalidateExternalCaches(id, null);
this.coreCache.invalidateByDependency(id, true);
}
|
java
|
@Override
public void invalidateByTemplate(String template, boolean waitOnInvalidation) {
final String methodName = "invalidateByTemplate()";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " template=" + template);
}
this.invalidateExternalCaches(null, template);
this.coreCache.invalidateByTemplate(template, waitOnInvalidation);
}
|
java
|
@Override
public void addAlias(Object key, Object[] aliasArray, boolean askPermission, boolean coordinate) {
final String methodName = "addAlias()";
if (this.featureSupport.isAliasSupported()) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet");
}
} else {
Tr.error(tc, "DYNA1063E", new Object[] { methodName, cacheName, this.cacheProviderName });
}
return;
}
|
java
|
@Override
public void removeAlias(Object alias, boolean askPermission, boolean coordinate) {
final String methodName = "removeAlias()";
if (this.featureSupport.isAliasSupported()) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet");
}
} else {
Tr.error(tc, "DYNA1063E", new Object[] { methodName, cacheName, this.cacheProviderName });
}
return;
}
|
java
|
@Override
public List getCacheIdsInPushPullTable() {
final String methodName = "getCacheIdsInPushPullTable()";
List list = new ArrayList();
if (this.featureSupport.isReplicationSupported()) {
// TODO write code to support getCacheIdsInPushPullTable function
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet");
}
} else {
Tr.error(tc, "DYNA1065E", new Object[] { methodName, cacheName, this.cacheProviderName });
}
return list;
}
|
java
|
@Override
public boolean shouldPull(int share, Object id) {
final String methodName = "shouldPull()";
boolean shouldPull = false;
if (this.featureSupport.isReplicationSupported()) {
// TODO write code to support shouldPull function
//if (tc.isDebugEnabled()) {
// Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet");
//}
} else {
//Tr.error(tc, "DYNA1065E", new Object[] { methodName, cacheName, this.cacheProviderName});
}
return shouldPull;
}
|
java
|
@Override
public int getDepIdsSizeDisk() {
final String methodName = "getDepIdsSizeDisk()";
if (this.swapToDisk) {
// TODO write code to support getDepIdsSizeDisk function
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet");
}
} else {
if (this.featureSupport.isDiskCacheSupported() == false) {
Tr.error(tc, "DYNA1064E", new Object[] { methodName, cacheName, this.cacheProviderName });
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " no operation is done because the disk cache offload is not enabled");
}
}
}
return 0;
}
|
java
|
@Override
public Exception getDiskCacheException() {
final String methodName = "getDiskCacheException()";
Exception ex = null;
if (this.swapToDisk) {
// TODO write code to support getDiskCacheException function
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet");
}
} else {
if (this.featureSupport.isDiskCacheSupported() == false) {
Tr.error(tc, "DYNA1064E", new Object[] { methodName, cacheName, this.cacheProviderName });
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " no operation is done because the disk cache offload is not enabled");
}
}
}
return ex;
}
|
java
|
@Override
public void resetPMICounters() {
// TODO needs to change if cache provider supports PMI counters.
final String methodName = "resetPMICounters()";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName);
}
}
|
java
|
@Override
public void updateStatisticsForVBC(com.ibm.websphere.cache.CacheEntry cacheEntry, boolean directive) {
// TODO needs to change if cache provider supports PMI and CacheStatisticsListener
final String methodName = "updateStatisticsForVBC()";
Object id = null;
if (cacheEntry != null) {
id = cacheEntry.getIdObject();
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id + " directive=" + directive);
}
}
|
java
|
private static String reduceStringLiteralToken(String image) {
// First, remove leading and trailing ' character
image = image.substring(1, image.length()-1);
// Next, de-double any doubled occurances of the ' character
for (int i = 0; i < image.length(); i++)
if (image.charAt(i) == '\'')
// Here's a ', which we retain, but the character after it, also a ', is elided
image = image.substring(0,i+1) + image.substring(i+2);
return image;
}
|
java
|
static Selector parseIntegerLiteral(String val) {
// Determine if this is a long constant by checking the suffix
char tag = val.charAt(val.length()-1);
boolean mustBeLong = false;
if (tag == 'l' || tag == 'L')
{
val = val.substring(0, val.length()-1);
mustBeLong = true;
}
long longVal = Long.decode(val).longValue();
if (mustBeLong || longVal > Integer.MAX_VALUE || longVal < Integer.MIN_VALUE)
return new LiteralImpl(new Long(longVal));
else
return new LiteralImpl(new Integer((int) longVal));
}
|
java
|
static Selector parseFloatingLiteral(String val) {
// Determine if this is a float constant by checking the suffix
Number value; // was NumericValue
char tag = val.charAt(val.length()-1);
if (tag == 'f' || tag == 'F')
value = new Float(val);
else
value = new Double(val);
return new LiteralImpl(value);
}
|
java
|
static Selector convertSet(Selector expr, List set) {
Selector ans = null;
for (int i = 0; i < set.size(); i++) {
Selector comparand = (Selector) set.get(i);
Selector comparison = new OperatorImpl(Operator.EQ, (Selector) expr.clone(), comparand);
if (ans == null)
ans = comparison;
else
ans = new OperatorImpl(Operator.OR, ans, comparison);
}
return ans;
}
|
java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.