repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java
ProxyQueueConversationGroupImpl.close
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 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"); }
[ "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\"", ")", ";", "}" ]
Closes this proxy queue conversation group.
[ "Closes", "this", "proxy", "queue", "conversation", "group", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java#L520-L532
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java
ProxyQueueConversationGroupImpl.conversationDroppedNotification
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 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"); }
[ "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\"", ")", ";", "}" ]
Invoked to notify the group that the conversation that backs it has gone away. Iterate over the queues and notify them.
[ "Invoked", "to", "notify", "the", "group", "that", "the", "conversation", "that", "backs", "it", "has", "gone", "away", ".", "Iterate", "over", "the", "queues", "and", "notify", "them", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java#L538-L557
train
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElement.java
ConfigElement.setExtraAttribute
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 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); } }
[ "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", ")", ";", "}", "}" ]
Sets an attribute on this element that does not have an explicit setter. @param name the name @param value the value
[ "Sets", "an", "attribute", "on", "this", "element", "that", "does", "not", "have", "an", "explicit", "setter", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElement.java#L55-L64
train
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElement.java
ConfigElement.getValue
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 getValue(String value) { if (value == null) { return null; } String v = removeQuotes(value.trim()).trim(); if (v.isEmpty()) { return null; } return v; }
[ "public", "static", "String", "getValue", "(", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "String", "v", "=", "removeQuotes", "(", "value", ".", "trim", "(", ")", ")", ".", "trim", "(", ")", ";", "if", "(", "v", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "return", "v", ";", "}" ]
Sometimes, the JACL representation of a null or empty value includes quotation marks. Calling this method will parse away the extra JACL syntax and return a real or null value @param value an unchecked input value @return the real value described by the input value
[ "Sometimes", "the", "JACL", "representation", "of", "a", "null", "or", "empty", "value", "includes", "quotation", "marks", ".", "Calling", "this", "method", "will", "parse", "away", "the", "extra", "JACL", "syntax", "and", "return", "a", "real", "or", "null", "value" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElement.java#L75-L84
train
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElement.java
ConfigElement.removeQuotes
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
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; }
[ "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", ";", "}" ]
Removes leading and trailing quotes from the input argument, if they exist. @param arg The argument you want to parse @return The argument, without leading and trailing quotes
[ "Removes", "leading", "and", "trailing", "quotes", "from", "the", "input", "argument", "if", "they", "exist", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElement.java#L94-L103
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java
WorkQueueManager.processWork
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 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; }
[ "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", ";", "}" ]
Processes the request. If the request is already associated with a work queue - send it there. Otherwise round robin requests amongst our set of queues. @param req @param options @return VirtualConnections
[ "Processes", "the", "request", ".", "If", "the", "request", "is", "already", "associated", "with", "a", "work", "queue", "-", "send", "it", "there", ".", "Otherwise", "round", "robin", "requests", "amongst", "our", "set", "of", "queues", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java#L288-L311
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java
WorkQueueManager.dispatch
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
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)); }
[ "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", ")", ")", ";", "}" ]
Dispatches requests to workrer threds, or notifies waiting thread. @param req @param ioe @return boolean, true if request was dispatched
[ "Dispatches", "requests", "to", "workrer", "threds", "or", "notifies", "waiting", "thread", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java#L733-L747
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java
WorkQueueManager.dispatchWorker
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
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; }
[ "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", ";", "}" ]
Dispatch a work item. @param worker @return boolean, true if dispatched
[ "Dispatch", "a", "work", "item", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java#L755-L771
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java
WorkQueueManager.queueConnectForSelector
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 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"); } }
[ "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\"", ")", ";", "}", "}" ]
This method is called when work must be added to the connect selector. @param connectInfo
[ "This", "method", "is", "called", "when", "work", "must", "be", "added", "to", "the", "connect", "selector", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java#L778-L796
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java
WorkQueueManager.createNewThread
protected void createNewThread(ChannelSelector sr, int threadType, int number) { StartPrivilegedThread privThread = new StartPrivilegedThread(sr, threadType, number, this.tGroup); AccessController.doPrivileged(privThread); }
java
protected void createNewThread(ChannelSelector sr, int threadType, int number) { StartPrivilegedThread privThread = new StartPrivilegedThread(sr, threadType, number, this.tGroup); AccessController.doPrivileged(privThread); }
[ "protected", "void", "createNewThread", "(", "ChannelSelector", "sr", ",", "int", "threadType", ",", "int", "number", ")", "{", "StartPrivilegedThread", "privThread", "=", "new", "StartPrivilegedThread", "(", "sr", ",", "threadType", ",", "number", ",", "this", ".", "tGroup", ")", ";", "AccessController", ".", "doPrivileged", "(", "privThread", ")", ";", "}" ]
Create a new reader thread. Provided so we can support pulling these from a thread pool in the SyncWorkQueueManager. This will allow these threads to have WSTHreadLocal. @param sr @param threadType @param number
[ "Create", "a", "new", "reader", "thread", ".", "Provided", "so", "we", "can", "support", "pulling", "these", "from", "a", "thread", "pool", "in", "the", "SyncWorkQueueManager", ".", "This", "will", "allow", "these", "threads", "to", "have", "WSTHreadLocal", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java#L808-L811
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java
WorkQueueManager.workerRun
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
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); } } }
[ "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", ")", ";", "}", "}", "}" ]
Main worker thread routine. @param req @param ioe
[ "Main", "worker", "thread", "routine", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java#L942-L983
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java
WorkQueueManager.dispatchConnect
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
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)); }
[ "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", ")", ")", ";", "}" ]
This is the entry point where work is added to the connect work list. As a result, a separate thread from the caller will do the work. @param work information about the connect @return true if request was dispatched, false if not
[ "This", "is", "the", "entry", "point", "where", "work", "is", "added", "to", "the", "connect", "work", "list", ".", "As", "a", "result", "a", "separate", "thread", "from", "the", "caller", "will", "do", "the", "work", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java#L1012-L1020
train
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/application/_NavigationUtils.java
_NavigationUtils.getEvaluatedNavigationParameters
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
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; }
[ "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", ";", "}" ]
Evaluate all EL expressions found as parameters and return a map that can be used for redirect or render bookmark links @param parameters parameter map retrieved from NavigationCase.getParameters() @return
[ "Evaluate", "all", "EL", "expressions", "found", "as", "parameters", "and", "return", "a", "map", "that", "can", "be", "used", "for", "redirect", "or", "render", "bookmark", "links" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/application/_NavigationUtils.java#L37-L72
train
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/application/_NavigationUtils.java
_NavigationUtils._evaluateValueExpressions
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
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; }
[ "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", ";", "}" ]
Checks the Strings in the List for EL expressions and evaluates them. Note that the returned List will be a copy of the given List, because otherwise it will have unwanted side-effects. @param values @return
[ "Checks", "the", "Strings", "in", "the", "List", "for", "EL", "expressions", "and", "evaluates", "them", ".", "Note", "that", "the", "returned", "List", "will", "be", "a", "copy", "of", "the", "given", "List", "because", "otherwise", "it", "will", "have", "unwanted", "side", "-", "effects", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/application/_NavigationUtils.java#L81-L97
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSRegistry.java
JSRegistry.register
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
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"); }
[ "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\"", ")", ";", "}" ]
Register the JMFEncapsulationManager for a particular Model ID. @param mgr the JMFEncapsulationManager being registered @param id the model ID for which registration is occuring
[ "Register", "the", "JMFEncapsulationManager", "for", "a", "particular", "Model", "ID", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSRegistry.java#L82-L87
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSRegistry.java
JSRegistry.registerInternal
private void registerInternal(JMFSchema schema) { schemaTable.set((HashedArray.Element)schema); Object assoc = schema.getJMFType().getAssociation(); if (assoc != null) associations.put(assoc, schema); }
java
private void registerInternal(JMFSchema schema) { schemaTable.set((HashedArray.Element)schema); Object assoc = schema.getJMFType().getAssociation(); if (assoc != null) associations.put(assoc, schema); }
[ "private", "void", "registerInternal", "(", "JMFSchema", "schema", ")", "{", "schemaTable", ".", "set", "(", "(", "HashedArray", ".", "Element", ")", "schema", ")", ";", "Object", "assoc", "=", "schema", ".", "getJMFType", "(", ")", ".", "getAssociation", "(", ")", ";", "if", "(", "assoc", "!=", "null", ")", "associations", ".", "put", "(", "assoc", ",", "schema", ")", ";", "}" ]
Subroutine used by register and registerAll
[ "Subroutine", "used", "by", "register", "and", "registerAll" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSRegistry.java#L117-L122
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSRegistry.java
JSRegistry.isPresent
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
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; }
[ "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", ";", "}" ]
to the same schema.
[ "to", "the", "same", "schema", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSRegistry.java#L128-L150
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/EncodingUtils.java
EncodingUtils.getLocales
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 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; }
[ "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", ";", "}" ]
Returns a Vector of locales from the passed in request object. @param req The request object to extract the locales from. @return The extracted locales.
[ "Returns", "a", "Vector", "of", "locales", "from", "the", "passed", "in", "request", "object", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/EncodingUtils.java#L218-L257
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/EncodingUtils.java
EncodingUtils.processAcceptLanguage
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 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()); }
[ "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", "(", ")", ")", ";", "}" ]
Processes the accept languages in a passed in String into a Vector object. @param acceptLanguage The accept language String to process. @return The processed accept languages.
[ "Processes", "the", "accept", "languages", "in", "a", "passed", "in", "String", "into", "a", "Vector", "object", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/EncodingUtils.java#L266-L324
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/EncodingUtils.java
EncodingUtils.extractLocales
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 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; }
[ "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", ";", "}" ]
This method will validate the values. Validate language and country values as alphanumeric. Validate variant value as alphanumeric , '_' ,and '-' Add appropriate values in Locale upon validation. Extract the locales from a passed in language Vector. @param languages The language Vector to extract the locales from. @param secure @return The extracted locales.
[ "This", "method", "will", "validate", "the", "values", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/EncodingUtils.java#L350-L392
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/EncodingUtils.java
EncodingUtils.getEncodingFromLocale
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 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; }
[ "public", "static", "String", "getEncodingFromLocale", "(", "Locale", "locale", ")", "{", "init", "(", ")", ";", "if", "(", "locale", "==", "cachedLocale", ")", "{", "return", "cachedEncoding", ";", "}", "String", "encoding", "=", "null", ";", "/*(String) _localeMap.get(locale.toString());\n\n if (encoding == null) {\n encoding = (String) _localeMap.get(locale.getLanguage() + \"_\" + locale.getCountry());\n\n if (encoding == null) {\n encoding = (String) _localeMap.get(locale.getLanguage());\n } \n }*/", "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", ";", "}" ]
Get the encoding for a passed in locale. @param locale The locale. @return The encoding.
[ "Get", "the", "encoding", "for", "a", "passed", "in", "locale", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/EncodingUtils.java#L425-L453
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/EncodingUtils.java
EncodingUtils.getJvmConverter
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 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; } }
[ "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", ";", "}", "}" ]
Get the JVM Converter for the specified encoding. @param encoding The encoding. @return The converter if it exists, otherwise return the encoding.
[ "Get", "the", "JVM", "Converter", "for", "the", "specified", "encoding", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/EncodingUtils.java#L462-L477
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/EncodingUtils.java
EncodingUtils.isCharsetSupported
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 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; }
[ "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", ";", "}" ]
rewritten as part of PK13492
[ "rewritten", "as", "part", "of", "PK13492" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/EncodingUtils.java#L487-L503
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java
Utils.compareInstance
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 <T> boolean compareInstance(T t1, T t2) { if (t1 == t2) { return true; } if (t1 != null && t2 != null && t1.equals(t2)) { return true; } return false; }
[ "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", ";", "}" ]
Compare tow instance. If both are null, still equal @param t1 @param t2 @return
[ "Compare", "tow", "instance", ".", "If", "both", "are", "null", "still", "equal" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java#L28-L37
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java
Utils.compareStrings
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 compareStrings(String s1, String s2) { if (s1 == s2) return true; if (s1 != null && s2 != null && s1.equals(s2)) return true; return false; }
[ "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", ";", "}" ]
Compares two strings for equality. Either or both of the values may be null. @param s1 @param s2 @return true iff the two strings are equal
[ "Compares", "two", "strings", "for", "equality", ".", "Either", "or", "both", "of", "the", "values", "may", "be", "null", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java#L46-L52
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java
Utils.compareQNames
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 compareQNames(QName qn1, QName qn2) { if (qn1 == qn2) return true; if (qn1 == null || qn2 == null) return false; return qn1.equals(qn2); }
[ "public", "static", "boolean", "compareQNames", "(", "QName", "qn1", ",", "QName", "qn2", ")", "{", "if", "(", "qn1", "==", "qn2", ")", "return", "true", ";", "if", "(", "qn1", "==", "null", "||", "qn2", "==", "null", ")", "return", "false", ";", "return", "qn1", ".", "equals", "(", "qn2", ")", ";", "}" ]
Compares two QNames for equality. Either or both of the values may be null. @param qn1 @param qn2 @return
[ "Compares", "two", "QNames", "for", "equality", ".", "Either", "or", "both", "of", "the", "values", "may", "be", "null", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java#L61-L67
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java
Utils.compareStringLists
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 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; }
[ "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", ";", "}" ]
Compares two lists of strings for equality. @param list1 @param list2 @return true iff each list contains the same strings in the same order
[ "Compares", "two", "lists", "of", "strings", "for", "equality", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java#L76-L90
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java
Utils.compareQNameLists
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 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; }
[ "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", ";", "}" ]
Compares two lists of QNames for equality. @param list1 @param list2 @return true iff each list contains the same QName values in the same order
[ "Compares", "two", "lists", "of", "QNames", "for", "equality", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java#L99-L113
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java
Utils.compareLists
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 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; }
[ "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", ";", "}" ]
Compare two lists @param list1 @param list2 @return
[ "Compare", "two", "lists" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java#L122-L136
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/config/CacheProcessor.java
CacheProcessor.preProcess
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 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; }
[ "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", ";", "}" ]
preprocess any data
[ "preprocess", "any", "data" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/config/CacheProcessor.java#L107-L130
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractConsumerKey.java
AbstractConsumerKey.getConsumerSet
public JSConsumerSet getConsumerSet() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getConsumerSet"); SibTr.exit(tc, "getConsumerSet", consumerSet); } return consumerSet; }
java
public JSConsumerSet getConsumerSet() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getConsumerSet"); SibTr.exit(tc, "getConsumerSet", consumerSet); } return consumerSet; }
[ "public", "JSConsumerSet", "getConsumerSet", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"getConsumerSet\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"getConsumerSet\"", ",", "consumerSet", ")", ";", "}", "return", "consumerSet", ";", "}" ]
Returns the consumerSet. @return consumerSet
[ "Returns", "the", "consumerSet", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractConsumerKey.java#L119-L127
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java
TreeMap.size
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 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; }
[ "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", ";", "}" ]
Returns the number of key-value mappings in this map , which ara available to the transaction. @param transaction which sees the tree as this size. @return the number of key-value mappings in this map. @exception ObjectManagerException @see com.ibm.ws.objectManager.Collection#size(com.ibm.ws.objectManager.Transaction)
[ "Returns", "the", "number", "of", "key", "-", "value", "mappings", "in", "this", "map", "which", "ara", "available", "to", "the", "transaction", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java#L222-L243
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java
TreeMap.isEmpty
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
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; }
[ "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", ";", "}" ]
Determines if the tree is empty as viewed by the transaction. Returns true if there are no entries visible to the transaction and false if there are entries visible. @param transaction the transaction which sees the tree as empty. @return true if no entries are visible, false if there are entries visible. @exception ObjectManagerException
[ "Determines", "if", "the", "tree", "is", "empty", "as", "viewed", "by", "the", "transaction", ".", "Returns", "true", "if", "there", "are", "no", "entries", "visible", "to", "the", "transaction", "and", "false", "if", "there", "are", "entries", "visible", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java#L266-L285
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java
TreeMap.getEntry
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
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; }
[ "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", ";", "}" ]
Returns the first Entry matching the key or null if the map does not contain an entry for the key. The entry returned may be uncommited. @param key whose Entry is to be returned. @return Entry matching the key or null if there is none. @exception ObjectManagerException
[ "Returns", "the", "first", "Entry", "matching", "the", "key", "or", "null", "if", "the", "map", "does", "not", "contain", "an", "entry", "for", "the", "key", ".", "The", "entry", "returned", "may", "be", "uncommited", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java#L485-L513
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java
TreeMap.putDuplicate
public synchronized void putDuplicate(Object key, Token value, Transaction transaction) throws ObjectManagerException { put(key, value, transaction, true); }
java
public synchronized void putDuplicate(Object key, Token value, Transaction transaction) throws ObjectManagerException { put(key, value, transaction, true); }
[ "public", "synchronized", "void", "putDuplicate", "(", "Object", "key", ",", "Token", "value", ",", "Transaction", "transaction", ")", "throws", "ObjectManagerException", "{", "put", "(", "key", ",", "value", ",", "transaction", ",", "true", ")", ";", "}" ]
Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is left alone and a new one added. @param key with which the specified value is to be associated. @param value to be associated with the specified key. @param transaction the put will be globally visible once this transaction commits. @throws ClassCastException key cannot be compared with the keys currently in the map. @throws NullPointerException key is <tt>null</tt> and this map uses natural order, or its comparator does not tolerate <tt>null</tt> keys. @throws ObjectManagerException
[ "Associates", "the", "specified", "value", "with", "the", "specified", "key", "in", "this", "map", ".", "If", "the", "map", "previously", "contained", "a", "mapping", "for", "this", "key", "the", "old", "value", "is", "left", "alone", "and", "a", "new", "one", "added", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java#L555-L564
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java
TreeMap.add
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 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); }
[ "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", ")", ";", "}" ]
Add a new value to the tree at a point where they key is after all less than or equal keys and below the currentEntry. @param key for the value. @param value to be added. @param currentEntry which starts the search. @param transaction controlling the addition. @param logSpaceDelta the change in log space to be reserved. @throws ObjectManagerException
[ "Add", "a", "new", "value", "to", "the", "tree", "at", "a", "point", "where", "they", "key", "is", "after", "all", "less", "than", "or", "equal", "keys", "and", "below", "the", "currentEntry", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java#L845-L914
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java
TreeMap.undoPut
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
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); }
[ "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", ")", ";", "}" ]
Reverse the action of addition to the map, used after an add has failed to log anything. @throws ObjectManagerException
[ "Reverse", "the", "action", "of", "addition", "to", "the", "map", "used", "after", "an", "add", "has", "failed", "to", "log", "anything", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java#L922-L933
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java
TreeMap.clear
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
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" ); }
[ "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\"", ")", ";", "}" ]
Removes all mappings from this TreeMap, which are visible to the transaction. Actual deletion of the entries takes place when the transaction commits. @param transaction to control clearing the map. @exception ObjectManagerException If thrown the map may be partially cleared.
[ "Removes", "all", "mappings", "from", "this", "TreeMap", "which", "are", "visible", "to", "the", "transaction", ".", "Actual", "deletion", "of", "the", "entries", "takes", "place", "when", "the", "transaction", "commits", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java#L1067-L1088
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java
TreeMap.compare
private int compare(Object key1, Object key2) { if (comparator == null) return ((Comparable) key1).compareTo(key2); else return comparator.compare(key1, key2); }
java
private int compare(Object key1, Object key2) { if (comparator == null) return ((Comparable) key1).compareTo(key2); else return comparator.compare(key1, key2); }
[ "private", "int", "compare", "(", "Object", "key1", ",", "Object", "key2", ")", "{", "if", "(", "comparator", "==", "null", ")", "return", "(", "(", "Comparable", ")", "key1", ")", ".", "compareTo", "(", "key2", ")", ";", "else", "return", "comparator", ".", "compare", "(", "key1", ",", "key2", ")", ";", "}" ]
Use the comparator to compare the two keys. @param key1 first key to compare. @param key2 second key to compare. @return int -1 if key1 < key2 0 if key1 = key2 1 if key1 > key2
[ "Use", "the", "comparator", "to", "compare", "the", "two", "keys", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java#L1564-L1569
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java
TreeMap.deleteEntry
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
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); }
[ "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", ")", ";", "}" ]
Finalise removal of an Entry from the tree. We have already logged the deletion of the Entry so we now need to rechain those Entries currently refering to it and rebalance the tree. This may be redriven at recovery so we need to detect if the entry has already been removed from the tree so that we don't disrupt other entries in error. @param entry to be removed from the structure of the tree. @param transaction controling the update. @exception ObjectManagerException
[ "Finalise", "removal", "of", "an", "Entry", "from", "the", "tree", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java#L1857-L1890
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java
TreeMap.move
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
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 }); }
[ "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", "}", ")", ";", "}" ]
Move x to occupy the position currently held by y. @param x to be moved. @param y location to be moved to. @throws ObjectManagerException
[ "Move", "x", "to", "occupy", "the", "position", "currently", "held", "by", "y", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java#L1950-L1985
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java
TreeMap.print
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 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... }
[ "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... ", "}" ]
Print a dump of the Map. @param printWriter to be written to.
[ "Print", "a", "dump", "of", "the", "Map", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/TreeMap.java#L2038-L2053
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/helpers/RESTHelper.java
RESTHelper.containsMultipleRoutingContext
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 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; }
[ "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", ";", "}" ]
Quick check for multiple-target routing context, without actually fetching all pieces
[ "Quick", "check", "for", "multiple", "-", "target", "routing", "context", "without", "actually", "fetching", "all", "pieces" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/helpers/RESTHelper.java#L147-L155
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/helpers/RESTHelper.java
RESTHelper.getRoutingContext
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 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; } }
[ "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", ";", "}", "}" ]
This helper method looks for the routing keys in the HTTP headers first, and then fallsback into looking at the query string. @param request of the current request @return a 3-sized String array containing hostName, userDir and serverName respectively, or null if no routing context was found.
[ "This", "helper", "method", "looks", "for", "the", "routing", "keys", "in", "the", "HTTP", "headers", "first", "and", "then", "fallsback", "into", "looking", "at", "the", "query", "string", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/helpers/RESTHelper.java#L171-L237
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java
RendererUtils.isDefaultAttributeValue
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 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; }
[ "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", ";", "}" ]
See JSF Spec. 8.5 Table 8-1 @param value @return boolean
[ "See", "JSF", "Spec", ".", "8", ".", "5", "Table", "8", "-", "1" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java#L495-L533
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java
RendererUtils.findUIOutputConverter
public static Converter findUIOutputConverter(FacesContext facesContext, UIOutput component) throws FacesException { return _SharedRendererUtils.findUIOutputConverter(facesContext, component); }
java
public static Converter findUIOutputConverter(FacesContext facesContext, UIOutput component) throws FacesException { return _SharedRendererUtils.findUIOutputConverter(facesContext, component); }
[ "public", "static", "Converter", "findUIOutputConverter", "(", "FacesContext", "facesContext", ",", "UIOutput", "component", ")", "throws", "FacesException", "{", "return", "_SharedRendererUtils", ".", "findUIOutputConverter", "(", "facesContext", ",", "component", ")", ";", "}" ]
Find the proper Converter for the given UIOutput component. @return the Converter or null if no Converter specified or needed @throws FacesException if the Converter could not be created
[ "Find", "the", "proper", "Converter", "for", "the", "given", "UIOutput", "component", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java#L540-L545
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java
RendererUtils.findUISelectManyConverter
public static Converter findUISelectManyConverter( FacesContext facesContext, UISelectMany component) { return findUISelectManyConverter(facesContext, component, false); }
java
public static Converter findUISelectManyConverter( FacesContext facesContext, UISelectMany component) { return findUISelectManyConverter(facesContext, component, false); }
[ "public", "static", "Converter", "findUISelectManyConverter", "(", "FacesContext", "facesContext", ",", "UISelectMany", "component", ")", "{", "return", "findUISelectManyConverter", "(", "facesContext", ",", "component", ",", "false", ")", ";", "}" ]
Calls findUISelectManyConverter with considerValueType = false. @param facesContext @param component @return
[ "Calls", "findUISelectManyConverter", "with", "considerValueType", "=", "false", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java#L553-L557
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java
RendererUtils.findUISelectManyConverter
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 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; } }
[ "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", ";", "}", "}" ]
Find proper Converter for the entries in the associated Collection or array of the given UISelectMany as specified in API Doc of UISelectMany. If considerValueType is true, the valueType attribute will be used in addition to the standard algorithm to get a valid converter. @return the Converter or null if no Converter specified or needed @throws FacesException if the Converter could not be created
[ "Find", "proper", "Converter", "for", "the", "entries", "in", "the", "associated", "Collection", "or", "array", "of", "the", "given", "UISelectMany", "as", "specified", "in", "API", "Doc", "of", "UISelectMany", ".", "If", "considerValueType", "is", "true", "the", "valueType", "attribute", "will", "be", "used", "in", "addition", "to", "the", "standard", "algorithm", "to", "get", "a", "valid", "converter", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java#L568-L655
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java
RendererUtils.getSelectedValuesAsSet
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 Set getSelectedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany) { Object selectedValues = uiSelectMany.getValue(); return internalSubmittedOrSelectedValuesAsSet(context, component, converter, uiSelectMany, selectedValues, true); }
[ "public", "static", "Set", "getSelectedValuesAsSet", "(", "FacesContext", "context", ",", "UIComponent", "component", ",", "Converter", "converter", ",", "UISelectMany", "uiSelectMany", ")", "{", "Object", "selectedValues", "=", "uiSelectMany", ".", "getValue", "(", ")", ";", "return", "internalSubmittedOrSelectedValuesAsSet", "(", "context", ",", "component", ",", "converter", ",", "uiSelectMany", ",", "selectedValues", ",", "true", ")", ";", "}" ]
Convenient utility method that returns the currently selected values of a UISelectMany component as a Set, of which the contains method can then be easily used to determine if a value is currently selected. Calling the contains method of this Set with the item value as argument returns true if this item is selected. @param uiSelectMany @return Set containing all currently selected values
[ "Convenient", "utility", "method", "that", "returns", "the", "currently", "selected", "values", "of", "a", "UISelectMany", "component", "as", "a", "Set", "of", "which", "the", "contains", "method", "can", "then", "be", "easily", "used", "to", "determine", "if", "a", "value", "is", "currently", "selected", ".", "Calling", "the", "contains", "method", "of", "this", "Set", "with", "the", "item", "value", "as", "argument", "returns", "true", "if", "this", "item", "is", "selected", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java#L837-L845
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java
RendererUtils.getConvertedStringValue
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, 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); }
[ "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", ")", ";", "}" ]
Convenient utility method that returns the currently given value as String, using the given converter. Especially usefull for dealing with primitive types.
[ "Convenient", "utility", "method", "that", "returns", "the", "currently", "given", "value", "as", "String", "using", "the", "given", "converter", ".", "Especially", "usefull", "for", "dealing", "with", "primitive", "types", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java#L852-L872
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java
RendererUtils.getConvertedStringValue
public static String getConvertedStringValue(FacesContext context, UIComponent component, Converter converter, SelectItem selectItem) { return getConvertedStringValue(context, component, converter, selectItem.getValue()); }
java
public static String getConvertedStringValue(FacesContext context, UIComponent component, Converter converter, SelectItem selectItem) { return getConvertedStringValue(context, component, converter, selectItem.getValue()); }
[ "public", "static", "String", "getConvertedStringValue", "(", "FacesContext", "context", ",", "UIComponent", "component", ",", "Converter", "converter", ",", "SelectItem", "selectItem", ")", "{", "return", "getConvertedStringValue", "(", "context", ",", "component", ",", "converter", ",", "selectItem", ".", "getValue", "(", ")", ")", ";", "}" ]
Convenient utility method that returns the currently given SelectItem value as String, using the given converter. Especially usefull for dealing with primitive types.
[ "Convenient", "utility", "method", "that", "returns", "the", "currently", "given", "SelectItem", "value", "as", "String", "using", "the", "given", "converter", ".", "Especially", "usefull", "for", "dealing", "with", "primitive", "types", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java#L879-L884
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java
RendererUtils.getConvertedUISelectManyValue
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 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); }
[ "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", ")", ";", "}" ]
Gets the converted value of a UISelectMany component. @param facesContext @param selectMany @param submittedValue @param considerValueType if true, the valueType attribute of the component will also be used (applies for Tomahawk UISelectMany components) @return @throws ConverterException
[ "Gets", "the", "converted", "value", "of", "a", "UISelectMany", "component", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java#L1045-L1064
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java
RendererUtils.initPartialValidationAndModelUpdate
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
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); } } }
[ "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", ")", ";", "}", "}", "}" ]
check for partial validation or model update attributes being set and initialize the request-map accordingly. SubForms will work with this information.
[ "check", "for", "partial", "validation", "or", "model", "update", "attributes", "being", "set", "and", "initialize", "the", "request", "-", "map", "accordingly", ".", "SubForms", "will", "work", "with", "this", "information", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java#L1414-L1437
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java
RendererUtils.getResponseStateManager
@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
@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(); }
[ "@", "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", "(", ")", ";", "}" ]
Gets the ResponseStateManager for the renderKit Id provided @deprecated use FacesContext.getRenderKit() or getRenderKitFactory().getRenderKit( context, renderKitId).getResponseStateManager()
[ "Gets", "the", "ResponseStateManager", "for", "the", "renderKit", "Id", "provided" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java#L1455-L1496
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java
RendererUtils.toResourceUri
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
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); } }
[ "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", ")", ";", "}", "}" ]
Coerces an object into a resource URI, calling the view-handler.
[ "Coerces", "an", "object", "into", "a", "resource", "URI", "calling", "the", "view", "-", "handler", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java#L1571-L1614
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/LibertyCustomizeBindingOutInterceptor.java
LibertyCustomizeBindingOutInterceptor.trim
public final static String trim(String value) { String result = null; if (null != value) { result = value.trim(); } return result; }
java
public final static String trim(String value) { String result = null; if (null != value) { result = value.trim(); } return result; }
[ "public", "final", "static", "String", "trim", "(", "String", "value", ")", "{", "String", "result", "=", "null", ";", "if", "(", "null", "!=", "value", ")", "{", "result", "=", "value", ".", "trim", "(", ")", ";", "}", "return", "result", ";", "}" ]
remove the blank characters in the left and right for a given value. @param value @return
[ "remove", "the", "blank", "characters", "in", "the", "left", "and", "right", "for", "a", "given", "value", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/LibertyCustomizeBindingOutInterceptor.java#L106-L115
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/LibertyCustomizeBindingOutInterceptor.java
LibertyCustomizeBindingOutInterceptor.customizeClientProperties
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 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); } } }
[ "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", ")", ";", "}", "}", "}" ]
Customize the client properties. @param message
[ "Customize", "the", "client", "properties", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/LibertyCustomizeBindingOutInterceptor.java#L196-L218
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/LibertyCustomizeBindingOutInterceptor.java
LibertyCustomizeBindingOutInterceptor.customizePortAddress
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
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); } }
[ "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", ")", ";", "}", "}" ]
Customize the port address @param message
[ "Customize", "the", "port", "address" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/LibertyCustomizeBindingOutInterceptor.java#L225-L244
train
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.el.3.0/src/javax/el/ExpressionFactory.java
ExpressionFactory.discoverClassName
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 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; }
[ "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", ";", "}" ]
Discover the name of class that implements ExpressionFactory. @param tccl {@code ClassLoader} @return Class name. There is default, so it is never {@code null}.
[ "Discover", "the", "name", "of", "class", "that", "implements", "ExpressionFactory", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.el.3.0/src/javax/el/ExpressionFactory.java#L364-L404
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/EsaParser.java
EsaParser.addBundleManifestRequireCapability
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 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(); } } }
[ "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", "(", ")", ";", "}", "}", "}" ]
Adds the Require-Capability Strings from a bundle jar to the Map of Require-Capabilities found @param zipSystem - the FileSystem mapping to the feature containing this bundle @param bundle - the bundle within a zipped up feature @param requiresMap - Map of Path to Require-Capability @throws IOException
[ "Adds", "the", "Require", "-", "Capability", "Strings", "from", "a", "bundle", "jar", "to", "the", "Map", "of", "Require", "-", "Capabilities", "found" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/EsaParser.java#L542-L575
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/EsaParser.java
EsaParser.addSubsystemManifestRequireCapability
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
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(); } } }
[ "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", "(", ")", ";", "}", "}", "}" ]
Adds the Require-Capability Strings from a SUBSYSTEM.MF to the Map of Require-Capabilities found @param esa - the feature file containing the SUBSYSTEM.MF @param requiresMap - Map of Path to Require-Capability @throws IOException
[ "Adds", "the", "Require", "-", "Capability", "Strings", "from", "a", "SUBSYSTEM", ".", "MF", "to", "the", "Map", "of", "Require", "-", "Capabilities", "found" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/EsaParser.java#L585-L613
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jwt/src/com/ibm/websphere/security/jwt/JwtHeaderInjecter.java
JwtHeaderInjecter.filter
@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
@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); }
[ "@", "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", ")", ";", "}" ]
Adds the JWT token to the Authorization header in the jax-rs client requests to propagate the token. @param requestContext jax-rs client request context
[ "Adds", "the", "JWT", "token", "to", "the", "Authorization", "header", "in", "the", "jax", "-", "rs", "client", "requests", "to", "propagate", "the", "token", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/websphere/security/jwt/JwtHeaderInjecter.java#L73-L90
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/util/UrlUtils.java
UrlUtils.urlDecode
public static String urlDecode(String value, String enc) { return urlDecode(value, enc, false); }
java
public static String urlDecode(String value, String enc) { return urlDecode(value, enc, false); }
[ "public", "static", "String", "urlDecode", "(", "String", "value", ",", "String", "enc", ")", "{", "return", "urlDecode", "(", "value", ",", "enc", ",", "false", ")", ";", "}" ]
Decodes using URLDecoder - use when queries or form post values are decoded @param value value to decode @param enc encoding
[ "Decodes", "using", "URLDecoder", "-", "use", "when", "queries", "or", "form", "post", "values", "are", "decoded" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/util/UrlUtils.java#L73-L75
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/util/UrlUtils.java
UrlUtils.pathDecode
public static String pathDecode(String value) { return urlDecode(value, StandardCharsets.UTF_8.name(), true); }
java
public static String pathDecode(String value) { return urlDecode(value, StandardCharsets.UTF_8.name(), true); }
[ "public", "static", "String", "pathDecode", "(", "String", "value", ")", "{", "return", "urlDecode", "(", "value", ",", "StandardCharsets", ".", "UTF_8", ".", "name", "(", ")", ",", "true", ")", ";", "}" ]
URL path segments may contain '+' symbols which should not be decoded into ' ' This method replaces '+' with %2B and delegates to URLDecoder @param value value to decode
[ "URL", "path", "segments", "may", "contain", "+", "symbols", "which", "should", "not", "be", "decoded", "into", "This", "method", "replaces", "+", "with", "%2B", "and", "delegates", "to", "URLDecoder" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/util/UrlUtils.java#L141-L143
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/util/UrlUtils.java
UrlUtils.parseQueryString
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 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; }
[ "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", ";", "}" ]
Create a map from String to String that represents the contents of the query portion of a URL. For each x=y, x is the key and y is the value. @param s the query part of the URI. @return the map.
[ "Create", "a", "map", "from", "String", "to", "String", "that", "represents", "the", "contents", "of", "the", "query", "portion", "of", "a", "URL", ".", "For", "each", "x", "=", "y", "x", "is", "the", "key", "and", "y", "is", "the", "value", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/util/UrlUtils.java#L152-L166
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/util/UrlUtils.java
UrlUtils.getStem
public static String getStem(String baseURI) { int idx = baseURI.lastIndexOf('/'); String result = baseURI; if (idx != -1) { result = baseURI.substring(0, idx); } return result; }
java
public static String getStem(String baseURI) { int idx = baseURI.lastIndexOf('/'); String result = baseURI; if (idx != -1) { result = baseURI.substring(0, idx); } return result; }
[ "public", "static", "String", "getStem", "(", "String", "baseURI", ")", "{", "int", "idx", "=", "baseURI", ".", "lastIndexOf", "(", "'", "'", ")", ";", "String", "result", "=", "baseURI", ";", "if", "(", "idx", "!=", "-", "1", ")", "{", "result", "=", "baseURI", ".", "substring", "(", "0", ",", "idx", ")", ";", "}", "return", "result", ";", "}" ]
Return everything in the path up to the last slash in a URI. @param baseURI @return the trailing
[ "Return", "everything", "in", "the", "path", "up", "to", "the", "last", "slash", "in", "a", "URI", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/util/UrlUtils.java#L174-L181
train
OpenLiberty/open-liberty
dev/com.ibm.ws.session/src/com/ibm/ws/session/utils/LRUHashMap.java
LRUHashMap.updateCacheList
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
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; }
[ "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", ";", "}" ]
remove the input entry from it's spot in the list and make it the mru
[ "remove", "the", "input", "entry", "from", "it", "s", "spot", "in", "the", "list", "and", "make", "it", "the", "mru" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/utils/LRUHashMap.java#L372-L403
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaSessionImpl.java
JmsJcaSessionImpl.getSICoreConnection
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
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; }
[ "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", ";", "}" ]
A convenience method that returns the core connection associated with this session's connection. @return the core connection @throws IllegalStateException if this session has been closed or invalidated
[ "A", "convenience", "method", "that", "returns", "the", "core", "connection", "associated", "with", "this", "session", "s", "connection", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaSessionImpl.java#L149-L176
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaSessionImpl.java
JmsJcaSessionImpl.dissociate
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 dissociate() { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, "dissociate"); } _managedConnection = null; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, "dissociate"); } }
[ "void", "dissociate", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "this", ",", "TRACE", ",", "\"dissociate\"", ")", ";", "}", "_managedConnection", "=", "null", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "this", ",", "TRACE", ",", "\"dissociate\"", ")", ";", "}", "}" ]
Dissociates this session from its current managed connection.
[ "Dissociates", "this", "session", "from", "its", "current", "managed", "connection", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaSessionImpl.java#L797-L809
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaSessionImpl.java
JmsJcaSessionImpl.associate
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 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"); } }
[ "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\"", ")", ";", "}", "}" ]
Associates this session with a new managed connection. @param managedConnection the new managed connection
[ "Associates", "this", "session", "with", "a", "new", "managed", "connection", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaSessionImpl.java#L817-L832
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaSessionImpl.java
JmsJcaSessionImpl.invalidate
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 invalidate() { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, "invalidate"); } _sessionInvalidated = true; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, "invalidate"); } }
[ "void", "invalidate", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "this", ",", "TRACE", ",", "\"invalidate\"", ")", ";", "}", "_sessionInvalidated", "=", "true", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "this", ",", "TRACE", ",", "\"invalidate\"", ")", ";", "}", "}" ]
Marks this session as invalid.
[ "Marks", "this", "session", "as", "invalid", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaSessionImpl.java#L871-L883
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaSessionImpl.java
JmsJcaSessionImpl.setParentConnection
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
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"); } }
[ "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\"", ")", ";", "}", "}" ]
Sets the parent connection for this session. @param connection the parent connection
[ "Sets", "the", "parent", "connection", "for", "this", "session", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaSessionImpl.java#L891-L903
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java
InterceptorMetaDataFactory.createInterceptorMetaData
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
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; }
[ "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", ";", "}" ]
Create InterceptorMetaData instance to use for a specified EJB module and bean meta data object. Also, update EJBMethodInfoImpl object with method level interceptor data as needed. <dl> <dt>pre-conditions:</dt> <dd>bmd.ivModuleVersion >= BeanMetaData.J2EE_EJB_VERSION_3_0, which means this method must only be called for EJB 3 module versions or later.</dd> <dd>bmd.isEntityBean() == false, which means this method must only only be called for non-EntityBeans in a EJB 3 module version or later.</dd> </dl> @param bmd is the BeanMetaData object for the EJB. @param methodInfoMap is a Map of java reflection Method object to a list of EJBMethodInfoImpl objects for the method. The Method object must be a Method object from the EJB class rather than a Method object obtained from one of the interfaces implemented by the EJB class. The list of EJBMethodInfoImpl objects represents the list of interface methods that is available to application when invoking a method implemented by EJB class. @return InterceptorMetaData object if this EJB has atleast 1 interceptor method (either around invoke or lifecycle callback). A null reference is returned if an interceptor method never needs to be called for this EJB. @throws EJBConfigurationException is thrown if an error is detected in the interceptor configuration for this EJB.
[ "Create", "InterceptorMetaData", "instance", "to", "use", "for", "a", "specified", "EJB", "module", "and", "bean", "meta", "data", "object", ".", "Also", "update", "EJBMethodInfoImpl", "object", "with", "method", "level", "interceptor", "data", "as", "needed", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java#L259-L369
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java
InterceptorMetaDataFactory.addJCDIInterceptors
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 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); } } }
[ "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", ")", ";", "}", "}", "}" ]
F743-15628 d649636
[ "F743", "-", "15628", "d649636" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java#L1154-L1183
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java
InterceptorMetaDataFactory.addLoadedInterceptorClasses
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 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; }
[ "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", ";", "}" ]
Adds a class to the list of loaded classes. getInterceptorProxies relies on every interceptor class either being added via updateNamesToClassMap or this method. @param klass the class @return the list of class names
[ "Adds", "a", "class", "to", "the", "list", "of", "loaded", "classes", ".", "getInterceptorProxies", "relies", "on", "every", "interceptor", "class", "either", "being", "added", "via", "updateNamesToClassMap", "or", "this", "method", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java#L1237-L1248
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java
InterceptorMetaDataFactory.addMethodLevelInterceptors
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 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; }
[ "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", ";", "}" ]
d367572.9 updated for xml and metadata-complete.
[ "d367572", ".", "9", "updated", "for", "xml", "and", "metadata", "-", "complete", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java#L1261-L1318
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java
InterceptorMetaDataFactory.updateEJBMethodInfoInterceptorProxies
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 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); } }
[ "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", ")", ";", "}", "}" ]
d367572.9 updated for xml
[ "d367572", ".", "9", "updated", "for", "xml" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java#L1329-L1376
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java
InterceptorMetaDataFactory.getAroundInterceptorProxies
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 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; }
[ "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", ";", "}" ]
Get the array of InterceptorProxy objects required for invoking the AroundInvoke or AroundTimeout interceptors methods when a method is invoked. @param kind the interceptor kind; must be either AROUND_INVOKE or AROUND_TIMEOUT @param m the method @return array of InterceptorProxy for invoking interceptors or a null reference if no around invoke interceptor methods need to be invoked. @throws EJBConfigurationException is thrown if interceptor-order element is used for specified business method and the order is incomplete.
[ "Get", "the", "array", "of", "InterceptorProxy", "objects", "required", "for", "invoking", "the", "AroundInvoke", "or", "AroundTimeout", "interceptors", "methods", "when", "a", "method", "is", "invoked", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java#L1390-L1414
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java
InterceptorMetaDataFactory.processBeanInterceptors
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 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; } } } } } } }
[ "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", ";", "}", "}", "}", "}", "}", "}", "}" ]
Processes interceptor methods on the bean class. @throws EJBConfigurationException
[ "Processes", "interceptor", "methods", "on", "the", "bean", "class", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java#L1497-L1530
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java
InterceptorMetaDataFactory.getInterceptorProxies
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 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; }
[ "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", ";", "}" ]
Gets an ordered list of interceptor proxies of the specified kind. processBeanInterceptors must have been called prior to calling this method. @param kind the interceptor kind @param orderedList an ordered list of interceptor class names, all of which have been passed through loadInterceptorClass or addLoadedInterceptorClass @return an ordered list of interceptor proxies, or null if neither the bean class nor the ordered list of interceptor classes has any interceptors of the specified kind @throws EJBConfigurationException
[ "Gets", "an", "ordered", "list", "of", "interceptor", "proxies", "of", "the", "specified", "kind", ".", "processBeanInterceptors", "must", "have", "been", "called", "prior", "to", "calling", "this", "method", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java#L1546-L1659
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java
InterceptorMetaDataFactory.validateEJBCallbackMethod
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 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()); } }
[ "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", "(", ")", ")", ";", "}", "}" ]
d463727 entire method added.
[ "d463727", "entire", "method", "added", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java#L1934-L1998
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java
InterceptorMetaDataFactory.orderClassLevelInterceptors
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> 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; }
[ "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", ";", "}" ]
Get an ordered list of class level interceptors to be used for this EJB. @return ordered list of interceptors to use at class level. @throws EJBConfigurationException is thrown if interceptor-order element is not a total ordering of the interceptors for this class.
[ "Get", "an", "ordered", "list", "of", "class", "level", "interceptors", "to", "be", "used", "for", "this", "EJB", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java#L2120-L2197
train
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java
InterceptorMetaDataFactory.orderMethodLevelInterceptors
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
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; }
[ "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", ";", "}" ]
Get an ordered list of method level interceptors for specified method of an EJB. @param m the method @return ordered list of interceptors to use for this method. @throws EJBConfigurationException is thrown if order is not a total ordering of the interceptors for the method as required by EJB specification.
[ "Get", "an", "ordered", "list", "of", "method", "level", "interceptors", "for", "specified", "method", "of", "an", "EJB", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java#L2210-L2303
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.containsCacheId
@Override public boolean containsCacheId(Object cacheId) { boolean found = false; if (cacheId != null) { found = this.coreCache.containsCacheId(cacheId); } return found; }
java
@Override public boolean containsCacheId(Object cacheId) { boolean found = false; if (cacheId != null) { found = this.coreCache.containsCacheId(cacheId); } return found; }
[ "@", "Override", "public", "boolean", "containsCacheId", "(", "Object", "cacheId", ")", "{", "boolean", "found", "=", "false", ";", "if", "(", "cacheId", "!=", "null", ")", "{", "found", "=", "this", ".", "coreCache", ".", "containsCacheId", "(", "cacheId", ")", ";", "}", "return", "found", ";", "}" ]
Returns true if memory cache contains a mapping for the specified cache ID. @param cacheId cache ID is to be tested. @return <code>true</code> if the memory cache contains the specified cacheID.
[ "Returns", "true", "if", "memory", "cache", "contains", "a", "mapping", "for", "the", "specified", "cache", "ID", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L96-L103
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.getEntryFromMemory
@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 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; }
[ "@", "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", ";", "}" ]
This returns the cache entry from memory cache identified by the specified cache id. It returns null if not in the cache. @param id The cache id for the entry. The id cannot be null. @return The entry identified by the cache id.
[ "This", "returns", "the", "cache", "entry", "from", "memory", "cache", "identified", "by", "the", "specified", "cache", "id", ".", "It", "returns", "null", "if", "not", "in", "the", "cache", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L215-L223
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.getAllIds
@Override public Enumeration getAllIds() { Set ids = this.coreCache.getCacheIds(); ValueSet idvs = new ValueSet(ids.iterator()); return idvs.elements(); }
java
@Override public Enumeration getAllIds() { Set ids = this.coreCache.getCacheIds(); ValueSet idvs = new ValueSet(ids.iterator()); return idvs.elements(); }
[ "@", "Override", "public", "Enumeration", "getAllIds", "(", ")", "{", "Set", "ids", "=", "this", ".", "coreCache", ".", "getCacheIds", "(", ")", ";", "ValueSet", "idvs", "=", "new", "ValueSet", "(", "ids", ".", "iterator", "(", ")", ")", ";", "return", "idvs", ".", "elements", "(", ")", ";", "}" ]
Returns an enumeration view of the cache IDs contained in the memory cache. @return An enumeration of cache IDs or empty if there is no cache ID.
[ "Returns", "an", "enumeration", "view", "of", "the", "cache", "IDs", "contained", "in", "the", "memory", "cache", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L230-L235
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.internalInvalidateByDepId
@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 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); }
[ "@", "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", ")", ";", "}" ]
This invalidates all entries in this Cache having a dependency on this dependency id. @param id dependency id. @param causeOfInvalidation The cause of invalidation @param source The source of invalidation (local or remote) @param bFireIL True to fire invalidation event
[ "This", "invalidates", "all", "entries", "in", "this", "Cache", "having", "a", "dependency", "on", "this", "dependency", "id", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L466-L474
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.invalidateByTemplate
@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 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); }
[ "@", "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", ")", ";", "}" ]
This invalidates all entries in this Cache having a dependency on this template. @param template The template name. @param waitOnInvalidation True indicates that this method should not return until the invalidations have taken effect on all caches. False indicates that the invalidations will be queued for later batch processing.
[ "This", "invalidates", "all", "entries", "in", "this", "Cache", "having", "a", "dependency", "on", "this", "template", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L535-L543
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.addAlias
@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 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; }
[ "@", "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", ";", "}" ]
Adds an alias for the given key in the cache's mapping table. If the alias is already associated with another key, it will be changed to associate with the new key. @param key the key assoicated with alias @param aliasArray the alias to use for lookups @param askPermission True implies that execution must ask the coordinating CacheUnit for permission (No effect on CoreCache). @param coordinate Indicates that the value should be set in other caches caching this value. (No effect on CoreCache)
[ "Adds", "an", "alias", "for", "the", "given", "key", "in", "the", "cache", "s", "mapping", "table", ".", "If", "the", "alias", "is", "already", "associated", "with", "another", "key", "it", "will", "be", "changed", "to", "associate", "with", "the", "new", "key", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L695-L706
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.removeAlias
@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 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; }
[ "@", "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", ";", "}" ]
Removes an alias from the cache mapping. @param alias the alias assoicated with cache id @param askPermission True implies that execution must ask the coordinating CacheUnit for permission (No effect on CoreCache). @param coordinate Indicates that the value should be set in other caches caching this value. (No effect on CoreCache)
[ "Removes", "an", "alias", "from", "the", "cache", "mapping", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L715-L726
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.getCacheIdsInPushPullTable
@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 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; }
[ "@", "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", ";", "}" ]
Returns all of the cache IDs in the PushPullTable
[ "Returns", "all", "of", "the", "cache", "IDs", "in", "the", "PushPullTable" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L756-L769
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.shouldPull
@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 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; }
[ "@", "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", ";", "}" ]
Return to indicate the entry can be pulled from other remote caches which caching this value. @param share sharing policy @id cache ID
[ "Return", "to", "indicate", "the", "entry", "can", "be", "pulled", "from", "other", "remote", "caches", "which", "caching", "this", "value", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L794-L807
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.getDepIdsSizeDisk
@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 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; }
[ "@", "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", ";", "}" ]
Returns the current dependency IDs size for the disk cache. @return The current dependency ids size for the disk cache.
[ "Returns", "the", "current", "dependency", "IDs", "size", "for", "the", "disk", "cache", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L1041-L1059
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.getDiskCacheException
@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 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; }
[ "@", "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", ";", "}" ]
Returns the exception object from the disk cache because disk cache reported the error. @return The exception object
[ "Returns", "the", "exception", "object", "from", "the", "disk", "cache", "because", "disk", "cache", "reported", "the", "error", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L1066-L1085
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.resetPMICounters
@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 resetPMICounters() { // TODO needs to change if cache provider supports PMI counters. final String methodName = "resetPMICounters()"; if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " cacheName=" + cacheName); } }
[ "@", "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", ")", ";", "}", "}" ]
This method needs to change if cache provider supports PMI counters.
[ "This", "method", "needs", "to", "change", "if", "cache", "provider", "supports", "PMI", "counters", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L1485-L1492
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.updateStatisticsForVBC
@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
@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); } }
[ "@", "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", ")", ";", "}", "}" ]
This method needs to change if cache provider supports PMI and CacheStatisticsListener.
[ "This", "method", "needs", "to", "change", "if", "cache", "provider", "supports", "PMI", "and", "CacheStatisticsListener", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L1497-L1508
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java
ParseUtil.reduceStringLiteralToken
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
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; }
[ "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", ";", "}" ]
processing ' characters in the image
[ "processing", "characters", "in", "the", "image" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java#L40-L49
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java
ParseUtil.parseIntegerLiteral
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 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)); }
[ "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", "==", "'", "'", "||", "tag", "==", "'", "'", ")", "{", "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", ")", ")", ";", "}" ]
Parse an integer literal @param image a String containing the image of the parse token for the literal @return a Selector representing the literal
[ "Parse", "an", "integer", "literal" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java#L57-L71
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java
ParseUtil.parseFloatingLiteral
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 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); }
[ "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", "==", "'", "'", "||", "tag", "==", "'", "'", ")", "value", "=", "new", "Float", "(", "val", ")", ";", "else", "value", "=", "new", "Double", "(", "val", ")", ";", "return", "new", "LiteralImpl", "(", "value", ")", ";", "}" ]
Parse a floating point literal @param image a String containing the image of the parse token for the literal @return a Selector representing the literal
[ "Parse", "a", "floating", "point", "literal" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java#L79-L88
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java
ParseUtil.convertSet
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
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; }
[ "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", ";", "}" ]
Convert a partially parsed set expression into its more primitive form as a disjunction of equalities. @param expr the expression whose set membership is being tested @param set the set itself, as a FastVector containing Selector trees representing expressions @return a Selector representing the set expression its more primitive form
[ "Convert", "a", "partially", "parsed", "set", "expression", "into", "its", "more", "primitive", "form", "as", "a", "disjunction", "of", "equalities", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java#L100-L111
train