repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
sequence
docstring
stringlengths
3
16k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/HTTPLoggingServiceImpl.java
HTTPLoggingServiceImpl.parseAccessLog
private void parseAccessLog(Map<String, Object> config) { String filename = (String) config.get("access.filePath"); if (null == filename || 0 == filename.trim().length()) { return; } try { this.ncsaLog = new AccessLogger(filename.trim()); } catch (Throwable t) { FFDCFilter.processException(t, getClass().getName() + ".parseAccessLog", "1", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Logging service was unable to open a file: " + filename + "; " + t); } return; } // save the NCSA format value String format = (String) config.get("access.logFormat"); this.ncsaLog.setFormat(LogUtils.convertNCSAFormat(format)); // now check for the maximum file size String size = (String) config.get("access.maximumSize"); if (null != size) { // convert from MB to bytes if (!this.ncsaLog.setMaximumSize(convertInt(size, 0) * 1048576L)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Logging service has invalid access log size: " + size); } } } // check for the max backup files String backups = (String) config.get("access.maximumBackupFiles"); if (null != backups) { this.ncsaLog.setMaximumBackupFiles(convertInt(backups, 1)); } }
java
private void parseAccessLog(Map<String, Object> config) { String filename = (String) config.get("access.filePath"); if (null == filename || 0 == filename.trim().length()) { return; } try { this.ncsaLog = new AccessLogger(filename.trim()); } catch (Throwable t) { FFDCFilter.processException(t, getClass().getName() + ".parseAccessLog", "1", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Logging service was unable to open a file: " + filename + "; " + t); } return; } // save the NCSA format value String format = (String) config.get("access.logFormat"); this.ncsaLog.setFormat(LogUtils.convertNCSAFormat(format)); // now check for the maximum file size String size = (String) config.get("access.maximumSize"); if (null != size) { // convert from MB to bytes if (!this.ncsaLog.setMaximumSize(convertInt(size, 0) * 1048576L)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Logging service has invalid access log size: " + size); } } } // check for the max backup files String backups = (String) config.get("access.maximumBackupFiles"); if (null != backups) { this.ncsaLog.setMaximumBackupFiles(convertInt(backups, 1)); } }
[ "private", "void", "parseAccessLog", "(", "Map", "<", "String", ",", "Object", ">", "config", ")", "{", "String", "filename", "=", "(", "String", ")", "config", ".", "get", "(", "\"access.filePath\"", ")", ";", "if", "(", "null", "==", "filename", "||", "0", "==", "filename", ".", "trim", "(", ")", ".", "length", "(", ")", ")", "{", "return", ";", "}", "try", "{", "this", ".", "ncsaLog", "=", "new", "AccessLogger", "(", "filename", ".", "trim", "(", ")", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "FFDCFilter", ".", "processException", "(", "t", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".parseAccessLog\"", ",", "\"1\"", ",", "this", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Logging service was unable to open a file: \"", "+", "filename", "+", "\"; \"", "+", "t", ")", ";", "}", "return", ";", "}", "// save the NCSA format value", "String", "format", "=", "(", "String", ")", "config", ".", "get", "(", "\"access.logFormat\"", ")", ";", "this", ".", "ncsaLog", ".", "setFormat", "(", "LogUtils", ".", "convertNCSAFormat", "(", "format", ")", ")", ";", "// now check for the maximum file size", "String", "size", "=", "(", "String", ")", "config", ".", "get", "(", "\"access.maximumSize\"", ")", ";", "if", "(", "null", "!=", "size", ")", "{", "// convert from MB to bytes", "if", "(", "!", "this", ".", "ncsaLog", ".", "setMaximumSize", "(", "convertInt", "(", "size", ",", "0", ")", "*", "1048576L", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Logging service has invalid access log size: \"", "+", "size", ")", ";", "}", "}", "}", "// check for the max backup files", "String", "backups", "=", "(", "String", ")", "config", ".", "get", "(", "\"access.maximumBackupFiles\"", ")", ";", "if", "(", "null", "!=", "backups", ")", "{", "this", ".", "ncsaLog", ".", "setMaximumBackupFiles", "(", "convertInt", "(", "backups", ",", "1", ")", ")", ";", "}", "}" ]
Parse the access log related information from the config. @param config
[ "Parse", "the", "access", "log", "related", "information", "from", "the", "config", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/HTTPLoggingServiceImpl.java#L87-L123
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/HTTPLoggingServiceImpl.java
HTTPLoggingServiceImpl.parseErrorLog
private void parseErrorLog(Map<String, Object> config) { String filename = (String) config.get("error.filePath"); if (null == filename || 0 == filename.trim().length()) { return; } try { this.debugLog = new DebugLogger(filename); } catch (Throwable t) { FFDCFilter.processException(t, getClass().getName() + ".parseErrorLog", "1", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Logging service was unable to open debug file: " + filename + "; " + t); } return; } // check the debug log level setting String levelName = (String) config.get("error.logLevel"); this.debugLog.setCurrentLevel(LogUtils.convertDebugLevel(levelName)); String size = (String) config.get("error.maximumSize"); if (null != size) { // convert from MB to bytes if (!this.debugLog.setMaximumSize(convertInt(size, 0) * 1048576L)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Logging service has invalid error log size: " + size); } } } // check for the max backup files String backups = (String) config.get("error.maximumBackupFiles"); if (null != backups) { this.debugLog.setMaximumBackupFiles(convertInt(backups, 1)); } }
java
private void parseErrorLog(Map<String, Object> config) { String filename = (String) config.get("error.filePath"); if (null == filename || 0 == filename.trim().length()) { return; } try { this.debugLog = new DebugLogger(filename); } catch (Throwable t) { FFDCFilter.processException(t, getClass().getName() + ".parseErrorLog", "1", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Logging service was unable to open debug file: " + filename + "; " + t); } return; } // check the debug log level setting String levelName = (String) config.get("error.logLevel"); this.debugLog.setCurrentLevel(LogUtils.convertDebugLevel(levelName)); String size = (String) config.get("error.maximumSize"); if (null != size) { // convert from MB to bytes if (!this.debugLog.setMaximumSize(convertInt(size, 0) * 1048576L)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Logging service has invalid error log size: " + size); } } } // check for the max backup files String backups = (String) config.get("error.maximumBackupFiles"); if (null != backups) { this.debugLog.setMaximumBackupFiles(convertInt(backups, 1)); } }
[ "private", "void", "parseErrorLog", "(", "Map", "<", "String", ",", "Object", ">", "config", ")", "{", "String", "filename", "=", "(", "String", ")", "config", ".", "get", "(", "\"error.filePath\"", ")", ";", "if", "(", "null", "==", "filename", "||", "0", "==", "filename", ".", "trim", "(", ")", ".", "length", "(", ")", ")", "{", "return", ";", "}", "try", "{", "this", ".", "debugLog", "=", "new", "DebugLogger", "(", "filename", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "FFDCFilter", ".", "processException", "(", "t", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".parseErrorLog\"", ",", "\"1\"", ",", "this", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Logging service was unable to open debug file: \"", "+", "filename", "+", "\"; \"", "+", "t", ")", ";", "}", "return", ";", "}", "// check the debug log level setting", "String", "levelName", "=", "(", "String", ")", "config", ".", "get", "(", "\"error.logLevel\"", ")", ";", "this", ".", "debugLog", ".", "setCurrentLevel", "(", "LogUtils", ".", "convertDebugLevel", "(", "levelName", ")", ")", ";", "String", "size", "=", "(", "String", ")", "config", ".", "get", "(", "\"error.maximumSize\"", ")", ";", "if", "(", "null", "!=", "size", ")", "{", "// convert from MB to bytes", "if", "(", "!", "this", ".", "debugLog", ".", "setMaximumSize", "(", "convertInt", "(", "size", ",", "0", ")", "*", "1048576L", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Logging service has invalid error log size: \"", "+", "size", ")", ";", "}", "}", "}", "// check for the max backup files", "String", "backups", "=", "(", "String", ")", "config", ".", "get", "(", "\"error.maximumBackupFiles\"", ")", ";", "if", "(", "null", "!=", "backups", ")", "{", "this", ".", "debugLog", ".", "setMaximumBackupFiles", "(", "convertInt", "(", "backups", ",", "1", ")", ")", ";", "}", "}" ]
Parse the error log related information from the config. @param config
[ "Parse", "the", "error", "log", "related", "information", "from", "the", "config", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/HTTPLoggingServiceImpl.java#L130-L165
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/HTTPLoggingServiceImpl.java
HTTPLoggingServiceImpl.stop
public void stop() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "stop"); } if (this.bRunning) { this.bRunning = false; this.ncsaLog.stop(); this.frcaLog.stop(); this.debugLog.stop(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "stop"); } }
java
public void stop() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "stop"); } if (this.bRunning) { this.bRunning = false; this.ncsaLog.stop(); this.frcaLog.stop(); this.debugLog.stop(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "stop"); } }
[ "public", "void", "stop", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"stop\"", ")", ";", "}", "if", "(", "this", ".", "bRunning", ")", "{", "this", ".", "bRunning", "=", "false", ";", "this", ".", "ncsaLog", ".", "stop", "(", ")", ";", "this", ".", "frcaLog", ".", "stop", "(", ")", ";", "this", ".", "debugLog", ".", "stop", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"stop\"", ")", ";", "}", "}" ]
Stop this service. It can be restarted after this method call.
[ "Stop", "this", "service", ".", "It", "can", "be", "restarted", "after", "this", "method", "call", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/HTTPLoggingServiceImpl.java#L233-L247
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/HTTPLoggingServiceImpl.java
HTTPLoggingServiceImpl.destroy
public void destroy() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "destroy"); } this.bRunning = false; this.ncsaLog.disable(); this.frcaLog.disable(); this.debugLog.disable(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "destroy"); } }
java
public void destroy() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "destroy"); } this.bRunning = false; this.ncsaLog.disable(); this.frcaLog.disable(); this.debugLog.disable(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "destroy"); } }
[ "public", "void", "destroy", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"destroy\"", ")", ";", "}", "this", ".", "bRunning", "=", "false", ";", "this", ".", "ncsaLog", ".", "disable", "(", ")", ";", "this", ".", "frcaLog", ".", "disable", "(", ")", ";", "this", ".", "debugLog", ".", "disable", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"destroy\"", ")", ";", "}", "}" ]
Final call when the service is being destroyed. The service cannot be restarted once this is used.
[ "Final", "call", "when", "the", "service", "is", "being", "destroyed", ".", "The", "service", "cannot", "be", "restarted", "once", "this", "is", "used", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/HTTPLoggingServiceImpl.java#L254-L266
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/HTTPLoggingServiceImpl.java
HTTPLoggingServiceImpl.convertInt
private int convertInt(String input, int defaultValue) { try { return Integer.parseInt(input.trim()); } catch (NumberFormatException nfe) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Malformed input: " + input); } return defaultValue; } }
java
private int convertInt(String input, int defaultValue) { try { return Integer.parseInt(input.trim()); } catch (NumberFormatException nfe) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Malformed input: " + input); } return defaultValue; } }
[ "private", "int", "convertInt", "(", "String", "input", ",", "int", "defaultValue", ")", "{", "try", "{", "return", "Integer", ".", "parseInt", "(", "input", ".", "trim", "(", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "nfe", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Malformed input: \"", "+", "input", ")", ";", "}", "return", "defaultValue", ";", "}", "}" ]
Convert the input string to an int value. @param input @param defaultValue - if malformed, then return this instead @return int
[ "Convert", "the", "input", "string", "to", "an", "int", "value", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/HTTPLoggingServiceImpl.java#L297-L306
train
OpenLiberty/open-liberty
dev/com.ibm.ws.org.apache.cxf.cxf.rt.rs.mp.client.3.3/src/org/apache/cxf/microprofile/client/cdi/RestClientExtension.java
RestClientExtension.findClients
public void findClients(@Observes @WithAnnotations({RegisterRestClient.class}) ProcessAnnotatedType<?> pat) { Class<?> restClient = pat.getAnnotatedType().getJavaClass(); if (restClient.isInterface()) { restClientClasses.add(restClient); pat.veto(); } else { errors.add(new IllegalArgumentException("The class " + restClient + " is not an interface")); } }
java
public void findClients(@Observes @WithAnnotations({RegisterRestClient.class}) ProcessAnnotatedType<?> pat) { Class<?> restClient = pat.getAnnotatedType().getJavaClass(); if (restClient.isInterface()) { restClientClasses.add(restClient); pat.veto(); } else { errors.add(new IllegalArgumentException("The class " + restClient + " is not an interface")); } }
[ "public", "void", "findClients", "(", "@", "Observes", "@", "WithAnnotations", "(", "{", "RegisterRestClient", ".", "class", "}", ")", "ProcessAnnotatedType", "<", "?", ">", "pat", ")", "{", "Class", "<", "?", ">", "restClient", "=", "pat", ".", "getAnnotatedType", "(", ")", ".", "getJavaClass", "(", ")", ";", "if", "(", "restClient", ".", "isInterface", "(", ")", ")", "{", "restClientClasses", ".", "add", "(", "restClient", ")", ";", "pat", ".", "veto", "(", ")", ";", "}", "else", "{", "errors", ".", "add", "(", "new", "IllegalArgumentException", "(", "\"The class \"", "+", "restClient", "+", "\" is not an interface\"", ")", ")", ";", "}", "}" ]
Liberty change - removed static
[ "Liberty", "change", "-", "removed", "static" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.rs.mp.client.3.3/src/org/apache/cxf/microprofile/client/cdi/RestClientExtension.java#L37-L46
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Proxy.java
Proxy.setOpen
protected void setOpen () { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setOpen"); closed = false; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setOpen"); }
java
protected void setOpen () { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setOpen"); closed = false; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setOpen"); }
[ "protected", "void", "setOpen", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"setOpen\"", ")", ";", "closed", "=", "false", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"setOpen\"", ")", ";", "}" ]
Marks this proxy object as being open.
[ "Marks", "this", "proxy", "object", "as", "being", "open", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Proxy.java#L89-L93
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Proxy.java
Proxy.isClosed
public boolean isClosed() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "isClosed"); boolean retValue = false; if (connectionProxy == null) { retValue = closed; } else { retValue = closed || connectionProxy.isClosed(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "isClosed", ""+retValue); return retValue; }
java
public boolean isClosed() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "isClosed"); boolean retValue = false; if (connectionProxy == null) { retValue = closed; } else { retValue = closed || connectionProxy.isClosed(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "isClosed", ""+retValue); return retValue; }
[ "public", "boolean", "isClosed", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"isClosed\"", ")", ";", "boolean", "retValue", "=", "false", ";", "if", "(", "connectionProxy", "==", "null", ")", "{", "retValue", "=", "closed", ";", "}", "else", "{", "retValue", "=", "closed", "||", "connectionProxy", ".", "isClosed", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"isClosed\"", ",", "\"\"", "+", "retValue", ")", ";", "return", "retValue", ";", "}" ]
This method identifies whether we are able to close this proxy object. If this object represents a session object, then this can only be closed if we have not been closed and if the connection has not been closed. If it represents a connection, then we can only close if we have not already been closed. @return Returns true if we have already been closed or if the underlying connection has been closed.
[ "This", "method", "identifies", "whether", "we", "are", "able", "to", "close", "this", "proxy", "object", ".", "If", "this", "object", "represents", "a", "session", "object", "then", "this", "can", "only", "be", "closed", "if", "we", "have", "not", "been", "closed", "and", "if", "the", "connection", "has", "not", "been", "closed", ".", "If", "it", "represents", "a", "connection", "then", "we", "can", "only", "close", "if", "we", "have", "not", "already", "been", "closed", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Proxy.java#L105-L121
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Proxy.java
Proxy.setClosed
protected void setClosed() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setClosed"); closed = true; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setClosed"); }
java
protected void setClosed() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setClosed"); closed = true; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setClosed"); }
[ "protected", "void", "setClosed", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"setClosed\"", ")", ";", "closed", "=", "true", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"setClosed\"", ")", ";", "}" ]
Marks this proxy object as being closed.
[ "Marks", "this", "proxy", "object", "as", "being", "closed", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Proxy.java#L127-L132
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Proxy.java
Proxy.getProxyID
public short getProxyID() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getProxyID"); if (!proxyIDSet) { // Someone is trying to use the ID of this proxy object but it has not been set yet. This // is an error as the ID will be invalid anyway. SIErrorException e = new SIErrorException( nls.getFormattedMessage("PROXY_ID_NOT_SET_SICO1052", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".getProxyID", CommsConstants.PROXY_GETPROXYID_01, this); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getProxyID", ""+proxyID); return proxyID; }
java
public short getProxyID() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getProxyID"); if (!proxyIDSet) { // Someone is trying to use the ID of this proxy object but it has not been set yet. This // is an error as the ID will be invalid anyway. SIErrorException e = new SIErrorException( nls.getFormattedMessage("PROXY_ID_NOT_SET_SICO1052", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".getProxyID", CommsConstants.PROXY_GETPROXYID_01, this); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getProxyID", ""+proxyID); return proxyID; }
[ "public", "short", "getProxyID", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"getProxyID\"", ")", ";", "if", "(", "!", "proxyIDSet", ")", "{", "// Someone is trying to use the ID of this proxy object but it has not been set yet. This", "// is an error as the ID will be invalid anyway.", "SIErrorException", "e", "=", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"PROXY_ID_NOT_SET_SICO1052\"", ",", "null", ",", "null", ")", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "CLASS_NAME", "+", "\".getProxyID\"", ",", "CommsConstants", ".", "PROXY_GETPROXYID_01", ",", "this", ")", ";", "throw", "e", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"getProxyID\"", ",", "\"\"", "+", "proxyID", ")", ";", "return", "proxyID", ";", "}" ]
Returns the proxy's Id correspondoing to the real object on the server @return ID The ID of the proxy object
[ "Returns", "the", "proxy", "s", "Id", "correspondoing", "to", "the", "real", "object", "on", "the", "server" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Proxy.java#L138-L158
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Proxy.java
Proxy.getConnectionProxy
protected ConnectionProxy getConnectionProxy() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getConnectionProxy"); if (connectionProxy == null) { // Someone is trying to use the connection proxy associated with this proxy object but it // has not been set or has been nulled out. SIErrorException e = new SIErrorException( nls.getFormattedMessage("CONNECTION_PROXY_NOT_SET_SICO1053", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".getConnectionProxy", CommsConstants.PROXY_GETCONNECTIONPROXY_01, this); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getConnectionProxy", connectionProxy); return connectionProxy; }
java
protected ConnectionProxy getConnectionProxy() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getConnectionProxy"); if (connectionProxy == null) { // Someone is trying to use the connection proxy associated with this proxy object but it // has not been set or has been nulled out. SIErrorException e = new SIErrorException( nls.getFormattedMessage("CONNECTION_PROXY_NOT_SET_SICO1053", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".getConnectionProxy", CommsConstants.PROXY_GETCONNECTIONPROXY_01, this); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getConnectionProxy", connectionProxy); return connectionProxy; }
[ "protected", "ConnectionProxy", "getConnectionProxy", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"getConnectionProxy\"", ")", ";", "if", "(", "connectionProxy", "==", "null", ")", "{", "// Someone is trying to use the connection proxy associated with this proxy object but it", "// has not been set or has been nulled out.", "SIErrorException", "e", "=", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"CONNECTION_PROXY_NOT_SET_SICO1053\"", ",", "null", ",", "null", ")", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "CLASS_NAME", "+", "\".getConnectionProxy\"", ",", "CommsConstants", ".", "PROXY_GETCONNECTIONPROXY_01", ",", "this", ")", ";", "throw", "e", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"getConnectionProxy\"", ",", "connectionProxy", ")", ";", "return", "connectionProxy", ";", "}" ]
Returns a reference to the Connection Proxy @return ConnectionProxy The Connection proxy
[ "Returns", "a", "reference", "to", "the", "Connection", "Proxy" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Proxy.java#L164-L184
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Proxy.java
Proxy.setProxyID
protected void setProxyID(short s) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setProxyID", ""+s); proxyID = s; proxyIDSet = true; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setProxyID"); }
java
protected void setProxyID(short s) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setProxyID", ""+s); proxyID = s; proxyIDSet = true; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setProxyID"); }
[ "protected", "void", "setProxyID", "(", "short", "s", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"setProxyID\"", ",", "\"\"", "+", "s", ")", ";", "proxyID", "=", "s", ";", "proxyIDSet", "=", "true", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"setProxyID\"", ")", ";", "}" ]
Sets the ID corresponding to the real object on the server @param s
[ "Sets", "the", "ID", "corresponding", "to", "the", "real", "object", "on", "the", "server" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/Proxy.java#L190-L196
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/ZipClient.java
ZipClient.getAttachment
@Override public InputStream getAttachment(final Asset asset, final Attachment attachment) throws IOException, BadVersionException, RequestFailureException { final ZipFile repoZip = createZipFile(); if (null == repoZip) { return null; } InputStream retInputStream = null; String attachmentId = attachment.get_id(); try { if (attachmentId.contains("#")) { String assetId = asset.get_id(); // new funky code to get an input stream to the license *inside* the main attachment. The start of // the assetId will point to the main attachment file. ZipEntry entry = createFromRelative(assetId); // If the entry wasn't found return null if (null == entry) { return null; } // Get zip input stream to the asset inside the zip ZipInputStream zis = new ZipInputStream(repoZip.getInputStream(entry)); // Get the input stream to the attachment inside the zip retInputStream = getInputStreamToLicenseInsideZip(zis, assetId, attachmentId); } else { // Get input stream to the attachment ZipEntry entry = createFromRelative(attachmentId); retInputStream = repoZip.getInputStream(entry); } } finally { // If we are throwing an exception the InputStream is never created so the logic below // to close the ZipFile when the InputStream is closed will never be called. So lets close // the ZipFile now as there is no InputStream to read from. if (retInputStream == null) { repoZip.close(); } } // When the input stream gets closed we also need to close the ZipFile, however // the caller only has the input stream. So lets wrap the input stream and close // both the inputStream and the ZipFile when the caller calls close on the wrapped // input stream final InputStream is = retInputStream; InputStream wrappedIs = new InputStream() { /** {@inheritDoc} */ @Override public int read(byte[] b) throws IOException { return is.read(b); } /** {@inheritDoc} */ @Override public int read(byte[] b, int off, int len) throws IOException { return is.read(b, off, len); } /** {@inheritDoc} */ @Override public long skip(long n) throws IOException { return is.skip(n); } /** {@inheritDoc} */ @Override public int available() throws IOException { return is.available(); } /** {@inheritDoc} */ @Override public synchronized void mark(int readlimit) { is.mark(readlimit); } /** {@inheritDoc} */ @Override public synchronized void reset() throws IOException { is.reset(); } /** {@inheritDoc} */ @Override public boolean markSupported() { return is.markSupported(); } /** {@inheritDoc} */ @Override public int read() throws IOException { return is.read(); } /** {@inheritDoc} */ @Override public void close() throws IOException { // When the input stream is closed, also close the zip file is.close(); repoZip.close(); } }; return wrappedIs; }
java
@Override public InputStream getAttachment(final Asset asset, final Attachment attachment) throws IOException, BadVersionException, RequestFailureException { final ZipFile repoZip = createZipFile(); if (null == repoZip) { return null; } InputStream retInputStream = null; String attachmentId = attachment.get_id(); try { if (attachmentId.contains("#")) { String assetId = asset.get_id(); // new funky code to get an input stream to the license *inside* the main attachment. The start of // the assetId will point to the main attachment file. ZipEntry entry = createFromRelative(assetId); // If the entry wasn't found return null if (null == entry) { return null; } // Get zip input stream to the asset inside the zip ZipInputStream zis = new ZipInputStream(repoZip.getInputStream(entry)); // Get the input stream to the attachment inside the zip retInputStream = getInputStreamToLicenseInsideZip(zis, assetId, attachmentId); } else { // Get input stream to the attachment ZipEntry entry = createFromRelative(attachmentId); retInputStream = repoZip.getInputStream(entry); } } finally { // If we are throwing an exception the InputStream is never created so the logic below // to close the ZipFile when the InputStream is closed will never be called. So lets close // the ZipFile now as there is no InputStream to read from. if (retInputStream == null) { repoZip.close(); } } // When the input stream gets closed we also need to close the ZipFile, however // the caller only has the input stream. So lets wrap the input stream and close // both the inputStream and the ZipFile when the caller calls close on the wrapped // input stream final InputStream is = retInputStream; InputStream wrappedIs = new InputStream() { /** {@inheritDoc} */ @Override public int read(byte[] b) throws IOException { return is.read(b); } /** {@inheritDoc} */ @Override public int read(byte[] b, int off, int len) throws IOException { return is.read(b, off, len); } /** {@inheritDoc} */ @Override public long skip(long n) throws IOException { return is.skip(n); } /** {@inheritDoc} */ @Override public int available() throws IOException { return is.available(); } /** {@inheritDoc} */ @Override public synchronized void mark(int readlimit) { is.mark(readlimit); } /** {@inheritDoc} */ @Override public synchronized void reset() throws IOException { is.reset(); } /** {@inheritDoc} */ @Override public boolean markSupported() { return is.markSupported(); } /** {@inheritDoc} */ @Override public int read() throws IOException { return is.read(); } /** {@inheritDoc} */ @Override public void close() throws IOException { // When the input stream is closed, also close the zip file is.close(); repoZip.close(); } }; return wrappedIs; }
[ "@", "Override", "public", "InputStream", "getAttachment", "(", "final", "Asset", "asset", ",", "final", "Attachment", "attachment", ")", "throws", "IOException", ",", "BadVersionException", ",", "RequestFailureException", "{", "final", "ZipFile", "repoZip", "=", "createZipFile", "(", ")", ";", "if", "(", "null", "==", "repoZip", ")", "{", "return", "null", ";", "}", "InputStream", "retInputStream", "=", "null", ";", "String", "attachmentId", "=", "attachment", ".", "get_id", "(", ")", ";", "try", "{", "if", "(", "attachmentId", ".", "contains", "(", "\"#\"", ")", ")", "{", "String", "assetId", "=", "asset", ".", "get_id", "(", ")", ";", "// new funky code to get an input stream to the license *inside* the main attachment. The start of", "// the assetId will point to the main attachment file.", "ZipEntry", "entry", "=", "createFromRelative", "(", "assetId", ")", ";", "// If the entry wasn't found return null", "if", "(", "null", "==", "entry", ")", "{", "return", "null", ";", "}", "// Get zip input stream to the asset inside the zip", "ZipInputStream", "zis", "=", "new", "ZipInputStream", "(", "repoZip", ".", "getInputStream", "(", "entry", ")", ")", ";", "// Get the input stream to the attachment inside the zip", "retInputStream", "=", "getInputStreamToLicenseInsideZip", "(", "zis", ",", "assetId", ",", "attachmentId", ")", ";", "}", "else", "{", "// Get input stream to the attachment", "ZipEntry", "entry", "=", "createFromRelative", "(", "attachmentId", ")", ";", "retInputStream", "=", "repoZip", ".", "getInputStream", "(", "entry", ")", ";", "}", "}", "finally", "{", "// If we are throwing an exception the InputStream is never created so the logic below", "// to close the ZipFile when the InputStream is closed will never be called. So lets close", "// the ZipFile now as there is no InputStream to read from.", "if", "(", "retInputStream", "==", "null", ")", "{", "repoZip", ".", "close", "(", ")", ";", "}", "}", "// When the input stream gets closed we also need to close the ZipFile, however", "// the caller only has the input stream. So lets wrap the input stream and close", "// both the inputStream and the ZipFile when the caller calls close on the wrapped", "// input stream", "final", "InputStream", "is", "=", "retInputStream", ";", "InputStream", "wrappedIs", "=", "new", "InputStream", "(", ")", "{", "/** {@inheritDoc} */", "@", "Override", "public", "int", "read", "(", "byte", "[", "]", "b", ")", "throws", "IOException", "{", "return", "is", ".", "read", "(", "b", ")", ";", "}", "/** {@inheritDoc} */", "@", "Override", "public", "int", "read", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "return", "is", ".", "read", "(", "b", ",", "off", ",", "len", ")", ";", "}", "/** {@inheritDoc} */", "@", "Override", "public", "long", "skip", "(", "long", "n", ")", "throws", "IOException", "{", "return", "is", ".", "skip", "(", "n", ")", ";", "}", "/** {@inheritDoc} */", "@", "Override", "public", "int", "available", "(", ")", "throws", "IOException", "{", "return", "is", ".", "available", "(", ")", ";", "}", "/** {@inheritDoc} */", "@", "Override", "public", "synchronized", "void", "mark", "(", "int", "readlimit", ")", "{", "is", ".", "mark", "(", "readlimit", ")", ";", "}", "/** {@inheritDoc} */", "@", "Override", "public", "synchronized", "void", "reset", "(", ")", "throws", "IOException", "{", "is", ".", "reset", "(", ")", ";", "}", "/** {@inheritDoc} */", "@", "Override", "public", "boolean", "markSupported", "(", ")", "{", "return", "is", ".", "markSupported", "(", ")", ";", "}", "/** {@inheritDoc} */", "@", "Override", "public", "int", "read", "(", ")", "throws", "IOException", "{", "return", "is", ".", "read", "(", ")", ";", "}", "/** {@inheritDoc} */", "@", "Override", "public", "void", "close", "(", ")", "throws", "IOException", "{", "// When the input stream is closed, also close the zip file", "is", ".", "close", "(", ")", ";", "repoZip", ".", "close", "(", ")", ";", "}", "}", ";", "return", "wrappedIs", ";", "}" ]
This gets an input stream to the specified attachment in the zip.
[ "This", "gets", "an", "input", "stream", "to", "the", "specified", "attachment", "in", "the", "zip", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/ZipClient.java#L78-L185
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/ZipClient.java
ZipClient.hasChildren
@Override protected boolean hasChildren(final String relative) throws IOException { ZipFile zip = createZipFile(); if (null == zip) { return false; } Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); if ((relative.equals("")) || entry.getName().startsWith(relative + File.separator)) { return true; } } zip.close(); return false; }
java
@Override protected boolean hasChildren(final String relative) throws IOException { ZipFile zip = createZipFile(); if (null == zip) { return false; } Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); if ((relative.equals("")) || entry.getName().startsWith(relative + File.separator)) { return true; } } zip.close(); return false; }
[ "@", "Override", "protected", "boolean", "hasChildren", "(", "final", "String", "relative", ")", "throws", "IOException", "{", "ZipFile", "zip", "=", "createZipFile", "(", ")", ";", "if", "(", "null", "==", "zip", ")", "{", "return", "false", ";", "}", "Enumeration", "<", "?", "extends", "ZipEntry", ">", "entries", "=", "zip", ".", "entries", "(", ")", ";", "while", "(", "entries", ".", "hasMoreElements", "(", ")", ")", "{", "ZipEntry", "entry", "=", "entries", ".", "nextElement", "(", ")", ";", "if", "(", "(", "relative", ".", "equals", "(", "\"\"", ")", ")", "||", "entry", ".", "getName", "(", ")", ".", "startsWith", "(", "relative", "+", "File", ".", "separator", ")", ")", "{", "return", "true", ";", "}", "}", "zip", ".", "close", "(", ")", ";", "return", "false", ";", "}" ]
See if there are any assets under the specified directory in the zip
[ "See", "if", "there", "are", "any", "assets", "under", "the", "specified", "directory", "in", "the", "zip" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/ZipClient.java#L204-L220
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/ZipClient.java
ZipClient.getChildren
@Override protected Collection<String> getChildren(final String relative) throws IOException { ZipFile zip = createZipFile(); if (null == zip) { return Collections.emptyList(); } Collection<String> children = new ArrayList<String>(); Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); if (entry.isDirectory()) { continue; } if ((relative.equals("")) || entry.getName().startsWith(relative + File.separator)) { children.add(entry.getName()); } } zip.close(); return children; }
java
@Override protected Collection<String> getChildren(final String relative) throws IOException { ZipFile zip = createZipFile(); if (null == zip) { return Collections.emptyList(); } Collection<String> children = new ArrayList<String>(); Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); if (entry.isDirectory()) { continue; } if ((relative.equals("")) || entry.getName().startsWith(relative + File.separator)) { children.add(entry.getName()); } } zip.close(); return children; }
[ "@", "Override", "protected", "Collection", "<", "String", ">", "getChildren", "(", "final", "String", "relative", ")", "throws", "IOException", "{", "ZipFile", "zip", "=", "createZipFile", "(", ")", ";", "if", "(", "null", "==", "zip", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "Collection", "<", "String", ">", "children", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "Enumeration", "<", "?", "extends", "ZipEntry", ">", "entries", "=", "zip", ".", "entries", "(", ")", ";", "while", "(", "entries", ".", "hasMoreElements", "(", ")", ")", "{", "ZipEntry", "entry", "=", "entries", ".", "nextElement", "(", ")", ";", "if", "(", "entry", ".", "isDirectory", "(", ")", ")", "{", "continue", ";", "}", "if", "(", "(", "relative", ".", "equals", "(", "\"\"", ")", ")", "||", "entry", ".", "getName", "(", ")", ".", "startsWith", "(", "relative", "+", "File", ".", "separator", ")", ")", "{", "children", ".", "add", "(", "entry", ".", "getName", "(", ")", ")", ";", "}", "}", "zip", ".", "close", "(", ")", ";", "return", "children", ";", "}" ]
Gets the entries under the specified directory in the zip file. This currently gets all entries in all sub directories too but does not return other directories as I think this will be more efficient than trying to recursively go through sub directories and we only call this method when we want all entries under the specified directory, including all sub directories.
[ "Gets", "the", "entries", "under", "the", "specified", "directory", "in", "the", "zip", "file", ".", "This", "currently", "gets", "all", "entries", "in", "all", "sub", "directories", "too", "but", "does", "not", "return", "other", "directories", "as", "I", "think", "this", "will", "be", "more", "efficient", "than", "trying", "to", "recursively", "go", "through", "sub", "directories", "and", "we", "only", "call", "this", "method", "when", "we", "want", "all", "entries", "under", "the", "specified", "directory", "including", "all", "sub", "directories", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/ZipClient.java#L228-L250
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/ZipClient.java
ZipClient.getSize
@Override protected long getSize(final String relative) { ZipEntry entry = createFromRelative(relative); return (entry == null ? 0 : entry.getSize()); }
java
@Override protected long getSize(final String relative) { ZipEntry entry = createFromRelative(relative); return (entry == null ? 0 : entry.getSize()); }
[ "@", "Override", "protected", "long", "getSize", "(", "final", "String", "relative", ")", "{", "ZipEntry", "entry", "=", "createFromRelative", "(", "relative", ")", ";", "return", "(", "entry", "==", "null", "?", "0", ":", "entry", ".", "getSize", "(", ")", ")", ";", "}" ]
Gets the uncompressed size of the file specified, will return 0 if the entry was not found
[ "Gets", "the", "uncompressed", "size", "of", "the", "file", "specified", "will", "return", "0", "if", "the", "entry", "was", "not", "found" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/ZipClient.java#L255-L259
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSCompatibleMessageImpl.java
JSCompatibleMessageImpl.getEncodingMessage
final JMFNativePart getEncodingMessage() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "getEncodingMessage"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "getEncodingMessage", encoding); return encoding; }
java
final JMFNativePart getEncodingMessage() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "getEncodingMessage"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "getEncodingMessage", encoding); return encoding; }
[ "final", "JMFNativePart", "getEncodingMessage", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "JmfTr", ".", "entry", "(", "this", ",", "tc", ",", "\"getEncodingMessage\"", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "JmfTr", ".", "exit", "(", "this", ",", "tc", ",", "\"getEncodingMessage\"", ",", "encoding", ")", ";", "return", "encoding", ";", "}" ]
Return the underlying encoding
[ "Return", "the", "underlying", "encoding" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSCompatibleMessageImpl.java#L123-L127
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java
CommsUtils.getRuntimeProperty
public static String getRuntimeProperty(String property, String defaultValue) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getRuntimeProperty", new Object[] {property, defaultValue}); String runtimeProp = RuntimeInfo.getPropertyWithMsg(property, defaultValue); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRuntimeProperty", runtimeProp); return runtimeProp; }
java
public static String getRuntimeProperty(String property, String defaultValue) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getRuntimeProperty", new Object[] {property, defaultValue}); String runtimeProp = RuntimeInfo.getPropertyWithMsg(property, defaultValue); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRuntimeProperty", runtimeProp); return runtimeProp; }
[ "public", "static", "String", "getRuntimeProperty", "(", "String", "property", ",", "String", "defaultValue", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"getRuntimeProperty\"", ",", "new", "Object", "[", "]", "{", "property", ",", "defaultValue", "}", ")", ";", "String", "runtimeProp", "=", "RuntimeInfo", ".", "getPropertyWithMsg", "(", "property", ",", "defaultValue", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getRuntimeProperty\"", ",", "runtimeProp", ")", ";", "return", "runtimeProp", ";", "}" ]
This method will get a runtime property from the sib.properties file. @param property The property key used to look up in the file. @param defaultValue The default value if the property is not in the file. @return Returns the property value.
[ "This", "method", "will", "get", "a", "runtime", "property", "from", "the", "sib", ".", "properties", "file", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java#L59-L68
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java
CommsUtils.getRuntimeBooleanProperty
public static boolean getRuntimeBooleanProperty(String property, String defaultValue) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getRuntimeBooleanProperty", new Object[] {property, defaultValue}); boolean runtimeProp = Boolean.valueOf(RuntimeInfo.getPropertyWithMsg(property, defaultValue)).booleanValue(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRuntimeBooleanProperty", ""+runtimeProp); return runtimeProp; }
java
public static boolean getRuntimeBooleanProperty(String property, String defaultValue) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getRuntimeBooleanProperty", new Object[] {property, defaultValue}); boolean runtimeProp = Boolean.valueOf(RuntimeInfo.getPropertyWithMsg(property, defaultValue)).booleanValue(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRuntimeBooleanProperty", ""+runtimeProp); return runtimeProp; }
[ "public", "static", "boolean", "getRuntimeBooleanProperty", "(", "String", "property", ",", "String", "defaultValue", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"getRuntimeBooleanProperty\"", ",", "new", "Object", "[", "]", "{", "property", ",", "defaultValue", "}", ")", ";", "boolean", "runtimeProp", "=", "Boolean", ".", "valueOf", "(", "RuntimeInfo", ".", "getPropertyWithMsg", "(", "property", ",", "defaultValue", ")", ")", ".", "booleanValue", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getRuntimeBooleanProperty\"", ",", "\"\"", "+", "runtimeProp", ")", ";", "return", "runtimeProp", ";", "}" ]
This method will get a runtime property from the sib.properties file as a boolean. @param property The property key used to look up in the file. @param defaultValue The default value if the property is not in the file. @return Returns the property value.
[ "This", "method", "will", "get", "a", "runtime", "property", "from", "the", "sib", ".", "properties", "file", "as", "a", "boolean", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java#L77-L86
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java
CommsUtils.checkFapLevel
public static void checkFapLevel(HandshakeProperties handShakeProps, short fapLevel) throws SIIncorrectCallException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "checkFapLevel", ""+fapLevel); short actualFapVersion = handShakeProps.getFapLevel(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Actual FAP Level: ", ""+actualFapVersion); if (fapLevel > actualFapVersion) { throw new SIIncorrectCallException( nls.getFormattedMessage("CALL_NOT_SUPPORTED_AT_FAP_LEVEL_SICO0101", new Object[] {"" + actualFapVersion}, "CALL_NOT_SUPPORTED_AT_FAP_LEVEL_SICO0101") ); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "checkFapLevel"); }
java
public static void checkFapLevel(HandshakeProperties handShakeProps, short fapLevel) throws SIIncorrectCallException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "checkFapLevel", ""+fapLevel); short actualFapVersion = handShakeProps.getFapLevel(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Actual FAP Level: ", ""+actualFapVersion); if (fapLevel > actualFapVersion) { throw new SIIncorrectCallException( nls.getFormattedMessage("CALL_NOT_SUPPORTED_AT_FAP_LEVEL_SICO0101", new Object[] {"" + actualFapVersion}, "CALL_NOT_SUPPORTED_AT_FAP_LEVEL_SICO0101") ); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "checkFapLevel"); }
[ "public", "static", "void", "checkFapLevel", "(", "HandshakeProperties", "handShakeProps", ",", "short", "fapLevel", ")", "throws", "SIIncorrectCallException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"checkFapLevel\"", ",", "\"\"", "+", "fapLevel", ")", ";", "short", "actualFapVersion", "=", "handShakeProps", ".", "getFapLevel", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Actual FAP Level: \"", ",", "\"\"", "+", "actualFapVersion", ")", ";", "if", "(", "fapLevel", ">", "actualFapVersion", ")", "{", "throw", "new", "SIIncorrectCallException", "(", "nls", ".", "getFormattedMessage", "(", "\"CALL_NOT_SUPPORTED_AT_FAP_LEVEL_SICO0101\"", ",", "new", "Object", "[", "]", "{", "\"\"", "+", "actualFapVersion", "}", ",", "\"CALL_NOT_SUPPORTED_AT_FAP_LEVEL_SICO0101\"", ")", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"checkFapLevel\"", ")", ";", "}" ]
This method is used on API calls when checking to see if the call is supported for the current FAP level. Before making a call in a method that is only supported in a particular FAP version call this method passing in the lowest FAP version this method is supported in. If the current negotiated FAP version is lower than this then an SIIncorrectCallException will be thrown. @param handShakeProps The handshake properties where the FAP level lives @param fapLevel The lowest fap level to accept on this call. @throws SIIncorrectCallException if the current FAP level is lower than the allowed minimum for this call.
[ "This", "method", "is", "used", "on", "API", "calls", "when", "checking", "to", "see", "if", "the", "call", "is", "supported", "for", "the", "current", "FAP", "level", ".", "Before", "making", "a", "call", "in", "a", "method", "that", "is", "only", "supported", "in", "a", "particular", "FAP", "version", "call", "this", "method", "passing", "in", "the", "lowest", "FAP", "version", "this", "method", "is", "supported", "in", ".", "If", "the", "current", "negotiated", "FAP", "version", "is", "lower", "than", "this", "then", "an", "SIIncorrectCallException", "will", "be", "thrown", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java#L168-L186
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java
CommsUtils.isRecoverable
public static boolean isRecoverable(final SIBusMessage mess, final Reliability maxUnrecoverableReliability) { if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "isRecoverable", new Object[] {mess, maxUnrecoverableReliability}); final Reliability messageReliability = mess.getReliability(); if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Message Reliability: ", messageReliability); final boolean recoverable = messageReliability.compareTo(maxUnrecoverableReliability) > 0; if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "isRecoverable", recoverable); return recoverable; }
java
public static boolean isRecoverable(final SIBusMessage mess, final Reliability maxUnrecoverableReliability) { if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "isRecoverable", new Object[] {mess, maxUnrecoverableReliability}); final Reliability messageReliability = mess.getReliability(); if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Message Reliability: ", messageReliability); final boolean recoverable = messageReliability.compareTo(maxUnrecoverableReliability) > 0; if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "isRecoverable", recoverable); return recoverable; }
[ "public", "static", "boolean", "isRecoverable", "(", "final", "SIBusMessage", "mess", ",", "final", "Reliability", "maxUnrecoverableReliability", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"isRecoverable\"", ",", "new", "Object", "[", "]", "{", "mess", ",", "maxUnrecoverableReliability", "}", ")", ";", "final", "Reliability", "messageReliability", "=", "mess", ".", "getReliability", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Message Reliability: \"", ",", "messageReliability", ")", ";", "final", "boolean", "recoverable", "=", "messageReliability", ".", "compareTo", "(", "maxUnrecoverableReliability", ")", ">", "0", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"isRecoverable\"", ",", "recoverable", ")", ";", "return", "recoverable", ";", "}" ]
Determines whether a message is recoverable compared to the supplied maxUnrecoverableReliability. @param mess the message to check. @para maxUnrecoverableReliability the most reliable reliability that is considered unrecoverable in the context in which this method is executed. @return true for any message which is more recoverable than maxUnrecoverableReliability, otherwise a false is returned.
[ "Determines", "whether", "a", "message", "is", "recoverable", "compared", "to", "the", "supplied", "maxUnrecoverableReliability", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java#L220-L232
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLAlpnNegotiator.java
SSLAlpnNegotiator.tryToRegisterAlpnNegotiator
protected ThirdPartyAlpnNegotiator tryToRegisterAlpnNegotiator(SSLEngine engine, SSLConnectionLink link, boolean useAlpn) { if (isNativeAlpnActive()) { if (useAlpn) { registerNativeAlpn(engine); } } else if (isIbmAlpnActive()) { registerIbmAlpn(engine, useAlpn); } else if (this.isJettyAlpnActive() && useAlpn) { return registerJettyAlpn(engine, link); } else if (this.isGrizzlyAlpnActive() && useAlpn) { return registerGrizzlyAlpn(engine, link); } return null; }
java
protected ThirdPartyAlpnNegotiator tryToRegisterAlpnNegotiator(SSLEngine engine, SSLConnectionLink link, boolean useAlpn) { if (isNativeAlpnActive()) { if (useAlpn) { registerNativeAlpn(engine); } } else if (isIbmAlpnActive()) { registerIbmAlpn(engine, useAlpn); } else if (this.isJettyAlpnActive() && useAlpn) { return registerJettyAlpn(engine, link); } else if (this.isGrizzlyAlpnActive() && useAlpn) { return registerGrizzlyAlpn(engine, link); } return null; }
[ "protected", "ThirdPartyAlpnNegotiator", "tryToRegisterAlpnNegotiator", "(", "SSLEngine", "engine", ",", "SSLConnectionLink", "link", ",", "boolean", "useAlpn", ")", "{", "if", "(", "isNativeAlpnActive", "(", ")", ")", "{", "if", "(", "useAlpn", ")", "{", "registerNativeAlpn", "(", "engine", ")", ";", "}", "}", "else", "if", "(", "isIbmAlpnActive", "(", ")", ")", "{", "registerIbmAlpn", "(", "engine", ",", "useAlpn", ")", ";", "}", "else", "if", "(", "this", ".", "isJettyAlpnActive", "(", ")", "&&", "useAlpn", ")", "{", "return", "registerJettyAlpn", "(", "engine", ",", "link", ")", ";", "}", "else", "if", "(", "this", ".", "isGrizzlyAlpnActive", "(", ")", "&&", "useAlpn", ")", "{", "return", "registerGrizzlyAlpn", "(", "engine", ",", "link", ")", ";", "}", "return", "null", ";", "}" ]
Check for the Java 9 ALPN API, IBM's ALPNJSSEExt, jetty-alpn, and grizzly-npn; if any are present, set up the connection for ALPN. Order of preference is Java 9 ALPN API, IBM's ALPNJSSEExt, jetty-alpn, then grizzly-npn. @param SSLEngine @param SSLConnectionLink @param useAlpn true if alpn should be used @return ThirdPartyAlpnNegotiator used for this connection, or null if ALPN is not available or the Java 9 / IBM provider was used
[ "Check", "for", "the", "Java", "9", "ALPN", "API", "IBM", "s", "ALPNJSSEExt", "jetty", "-", "alpn", "and", "grizzly", "-", "npn", ";", "if", "any", "are", "present", "set", "up", "the", "connection", "for", "ALPN", ".", "Order", "of", "preference", "is", "Java", "9", "ALPN", "API", "IBM", "s", "ALPNJSSEExt", "jetty", "-", "alpn", "then", "grizzly", "-", "npn", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLAlpnNegotiator.java#L202-L215
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLAlpnNegotiator.java
SSLAlpnNegotiator.tryToRemoveAlpnNegotiator
protected void tryToRemoveAlpnNegotiator(ThirdPartyAlpnNegotiator negotiator, SSLEngine engine, SSLConnectionLink link) { // the Java 9 and IBM JSSE ALPN implementations don't use a negotiator object if (negotiator == null && isNativeAlpnActive()) { getNativeAlpnChoice(engine, link); } else if (negotiator == null && isIbmAlpnActive()) { getAndRemoveIbmAlpnChoice(engine, link); } else if (negotiator != null && isJettyAlpnActive() && negotiator instanceof JettyServerNegotiator) { ((JettyServerNegotiator) negotiator).removeEngine(); } else if (negotiator != null && isGrizzlyAlpnActive() && negotiator instanceof GrizzlyAlpnNegotiator) { ((GrizzlyAlpnNegotiator) negotiator).removeServerNegotiatorEngine(); } }
java
protected void tryToRemoveAlpnNegotiator(ThirdPartyAlpnNegotiator negotiator, SSLEngine engine, SSLConnectionLink link) { // the Java 9 and IBM JSSE ALPN implementations don't use a negotiator object if (negotiator == null && isNativeAlpnActive()) { getNativeAlpnChoice(engine, link); } else if (negotiator == null && isIbmAlpnActive()) { getAndRemoveIbmAlpnChoice(engine, link); } else if (negotiator != null && isJettyAlpnActive() && negotiator instanceof JettyServerNegotiator) { ((JettyServerNegotiator) negotiator).removeEngine(); } else if (negotiator != null && isGrizzlyAlpnActive() && negotiator instanceof GrizzlyAlpnNegotiator) { ((GrizzlyAlpnNegotiator) negotiator).removeServerNegotiatorEngine(); } }
[ "protected", "void", "tryToRemoveAlpnNegotiator", "(", "ThirdPartyAlpnNegotiator", "negotiator", ",", "SSLEngine", "engine", ",", "SSLConnectionLink", "link", ")", "{", "// the Java 9 and IBM JSSE ALPN implementations don't use a negotiator object", "if", "(", "negotiator", "==", "null", "&&", "isNativeAlpnActive", "(", ")", ")", "{", "getNativeAlpnChoice", "(", "engine", ",", "link", ")", ";", "}", "else", "if", "(", "negotiator", "==", "null", "&&", "isIbmAlpnActive", "(", ")", ")", "{", "getAndRemoveIbmAlpnChoice", "(", "engine", ",", "link", ")", ";", "}", "else", "if", "(", "negotiator", "!=", "null", "&&", "isJettyAlpnActive", "(", ")", "&&", "negotiator", "instanceof", "JettyServerNegotiator", ")", "{", "(", "(", "JettyServerNegotiator", ")", "negotiator", ")", ".", "removeEngine", "(", ")", ";", "}", "else", "if", "(", "negotiator", "!=", "null", "&&", "isGrizzlyAlpnActive", "(", ")", "&&", "negotiator", "instanceof", "GrizzlyAlpnNegotiator", ")", "{", "(", "(", "GrizzlyAlpnNegotiator", ")", "negotiator", ")", ".", "removeServerNegotiatorEngine", "(", ")", ";", "}", "}" ]
If ALPN is active, try to remove the ThirdPartyAlpnNegotiator from the map of active negotiators @param ThirdPartyAlpnNegotiator @param SSLEngine @param SSLConnectionLink
[ "If", "ALPN", "is", "active", "try", "to", "remove", "the", "ThirdPartyAlpnNegotiator", "from", "the", "map", "of", "active", "negotiators" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLAlpnNegotiator.java#L224-L235
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLAlpnNegotiator.java
SSLAlpnNegotiator.getAndRemoveIbmAlpnChoice
protected void getAndRemoveIbmAlpnChoice(SSLEngine engine, SSLConnectionLink link) { if (this.isIbmAlpnActive()) { try { // invoke ALPNJSSEExt.get(engine) String[] alpnResult = (String[]) ibmAlpnGet.invoke(null, engine); // invoke ALPNJSSEExt.delete(engine) ibmAlpnDelete.invoke(null, engine); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { StringBuilder sb = new StringBuilder(); sb.append("getAndRemoveIbmAlpnChoice"); if (alpnResult != null && alpnResult.length > 0) { sb.append(" results:"); for (String s : alpnResult) { sb.append(" " + s); } sb.append(" " + engine); } else { sb.append(": ALPN not used for " + engine); } Tr.debug(tc, sb.toString()); } if (alpnResult != null && alpnResult.length == 1 && h2.equals(alpnResult[0])) { if (link.getAlpnProtocol() == null) { link.setAlpnProtocol(h2); } } } catch (InvocationTargetException ie) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getAndRemoveIbmAlpnChoice exception: " + ie.getTargetException()); } } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getAndRemoveIbmAlpnChoice exception: " + e); } } } }
java
protected void getAndRemoveIbmAlpnChoice(SSLEngine engine, SSLConnectionLink link) { if (this.isIbmAlpnActive()) { try { // invoke ALPNJSSEExt.get(engine) String[] alpnResult = (String[]) ibmAlpnGet.invoke(null, engine); // invoke ALPNJSSEExt.delete(engine) ibmAlpnDelete.invoke(null, engine); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { StringBuilder sb = new StringBuilder(); sb.append("getAndRemoveIbmAlpnChoice"); if (alpnResult != null && alpnResult.length > 0) { sb.append(" results:"); for (String s : alpnResult) { sb.append(" " + s); } sb.append(" " + engine); } else { sb.append(": ALPN not used for " + engine); } Tr.debug(tc, sb.toString()); } if (alpnResult != null && alpnResult.length == 1 && h2.equals(alpnResult[0])) { if (link.getAlpnProtocol() == null) { link.setAlpnProtocol(h2); } } } catch (InvocationTargetException ie) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getAndRemoveIbmAlpnChoice exception: " + ie.getTargetException()); } } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getAndRemoveIbmAlpnChoice exception: " + e); } } } }
[ "protected", "void", "getAndRemoveIbmAlpnChoice", "(", "SSLEngine", "engine", ",", "SSLConnectionLink", "link", ")", "{", "if", "(", "this", ".", "isIbmAlpnActive", "(", ")", ")", "{", "try", "{", "// invoke ALPNJSSEExt.get(engine)", "String", "[", "]", "alpnResult", "=", "(", "String", "[", "]", ")", "ibmAlpnGet", ".", "invoke", "(", "null", ",", "engine", ")", ";", "// invoke ALPNJSSEExt.delete(engine)", "ibmAlpnDelete", ".", "invoke", "(", "null", ",", "engine", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"getAndRemoveIbmAlpnChoice\"", ")", ";", "if", "(", "alpnResult", "!=", "null", "&&", "alpnResult", ".", "length", ">", "0", ")", "{", "sb", ".", "append", "(", "\" results:\"", ")", ";", "for", "(", "String", "s", ":", "alpnResult", ")", "{", "sb", ".", "append", "(", "\" \"", "+", "s", ")", ";", "}", "sb", ".", "append", "(", "\" \"", "+", "engine", ")", ";", "}", "else", "{", "sb", ".", "append", "(", "\": ALPN not used for \"", "+", "engine", ")", ";", "}", "Tr", ".", "debug", "(", "tc", ",", "sb", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "alpnResult", "!=", "null", "&&", "alpnResult", ".", "length", "==", "1", "&&", "h2", ".", "equals", "(", "alpnResult", "[", "0", "]", ")", ")", "{", "if", "(", "link", ".", "getAlpnProtocol", "(", ")", "==", "null", ")", "{", "link", ".", "setAlpnProtocol", "(", "h2", ")", ";", "}", "}", "}", "catch", "(", "InvocationTargetException", "ie", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"getAndRemoveIbmAlpnChoice exception: \"", "+", "ie", ".", "getTargetException", "(", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"getAndRemoveIbmAlpnChoice exception: \"", "+", "e", ")", ";", "}", "}", "}", "}" ]
Ask the JSSE ALPN provider for the protocol selected for the given SSLEngine, then delete the engine from the ALPN provider's map. If the selected protocol was "h2", set that as the protocol to use on the given link. @param SSLEngine @param SSLConnectionLink
[ "Ask", "the", "JSSE", "ALPN", "provider", "for", "the", "protocol", "selected", "for", "the", "given", "SSLEngine", "then", "delete", "the", "engine", "from", "the", "ALPN", "provider", "s", "map", ".", "If", "the", "selected", "protocol", "was", "h2", "set", "that", "as", "the", "protocol", "to", "use", "on", "the", "given", "link", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLAlpnNegotiator.java#L344-L384
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLAlpnNegotiator.java
SSLAlpnNegotiator.registerGrizzlyAlpn
protected GrizzlyAlpnNegotiator registerGrizzlyAlpn(SSLEngine engine, SSLConnectionLink link) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerGrizzlyAlpn entry " + engine); } if (grizzlyNegotiationSupport != null && grizzlyAlpnClientNegotiator != null && grizzlyAlpnServerNegotiator != null && grizzlyNegotiationSupportObject != null) { try { GrizzlyAlpnNegotiator negotiator = new GrizzlyAlpnNegotiator(engine, link); if (!engine.getUseClientMode()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "initializeAlpn invoke AlpnServerNegotiator " + engine); } // client mode is disabled; call NegotiationSuppoer.addNegotiator(SSLEngine, (AlpnServerNegotiator) this) Method m = grizzlyNegotiationSupport.getMethod("addNegotiator", SSLEngine.class, grizzlyAlpnServerNegotiator); m.invoke(grizzlyNegotiationSupportObject, new Object[] { engine, java.lang.reflect.Proxy.newProxyInstance( grizzlyAlpnServerNegotiator.getClassLoader(), new java.lang.Class[] { grizzlyAlpnServerNegotiator }, negotiator) }); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "initializeAlpn invoke AlpnClientNegotiator " + engine); } // client mode is enabled; call NegotiationSuppoer.addNegotiator(SSLEngine, (AlpnClientNegotiator) this) Method m = grizzlyNegotiationSupport.getMethod("addNegotiator", SSLEngine.class, grizzlyAlpnClientNegotiator); m.invoke(grizzlyNegotiationSupportObject, new Object[] { engine, java.lang.reflect.Proxy.newProxyInstance( grizzlyAlpnClientNegotiator.getClassLoader(), new java.lang.Class[] { grizzlyAlpnClientNegotiator }, negotiator) }); } return negotiator; } catch (InvocationTargetException ie) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerGrizzlyAlpn exception: " + ie.getTargetException()); } } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerGrizzlyAlpn grizzly-npn exception: " + e); } } } return null; }
java
protected GrizzlyAlpnNegotiator registerGrizzlyAlpn(SSLEngine engine, SSLConnectionLink link) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerGrizzlyAlpn entry " + engine); } if (grizzlyNegotiationSupport != null && grizzlyAlpnClientNegotiator != null && grizzlyAlpnServerNegotiator != null && grizzlyNegotiationSupportObject != null) { try { GrizzlyAlpnNegotiator negotiator = new GrizzlyAlpnNegotiator(engine, link); if (!engine.getUseClientMode()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "initializeAlpn invoke AlpnServerNegotiator " + engine); } // client mode is disabled; call NegotiationSuppoer.addNegotiator(SSLEngine, (AlpnServerNegotiator) this) Method m = grizzlyNegotiationSupport.getMethod("addNegotiator", SSLEngine.class, grizzlyAlpnServerNegotiator); m.invoke(grizzlyNegotiationSupportObject, new Object[] { engine, java.lang.reflect.Proxy.newProxyInstance( grizzlyAlpnServerNegotiator.getClassLoader(), new java.lang.Class[] { grizzlyAlpnServerNegotiator }, negotiator) }); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "initializeAlpn invoke AlpnClientNegotiator " + engine); } // client mode is enabled; call NegotiationSuppoer.addNegotiator(SSLEngine, (AlpnClientNegotiator) this) Method m = grizzlyNegotiationSupport.getMethod("addNegotiator", SSLEngine.class, grizzlyAlpnClientNegotiator); m.invoke(grizzlyNegotiationSupportObject, new Object[] { engine, java.lang.reflect.Proxy.newProxyInstance( grizzlyAlpnClientNegotiator.getClassLoader(), new java.lang.Class[] { grizzlyAlpnClientNegotiator }, negotiator) }); } return negotiator; } catch (InvocationTargetException ie) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerGrizzlyAlpn exception: " + ie.getTargetException()); } } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerGrizzlyAlpn grizzly-npn exception: " + e); } } } return null; }
[ "protected", "GrizzlyAlpnNegotiator", "registerGrizzlyAlpn", "(", "SSLEngine", "engine", ",", "SSLConnectionLink", "link", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"registerGrizzlyAlpn entry \"", "+", "engine", ")", ";", "}", "if", "(", "grizzlyNegotiationSupport", "!=", "null", "&&", "grizzlyAlpnClientNegotiator", "!=", "null", "&&", "grizzlyAlpnServerNegotiator", "!=", "null", "&&", "grizzlyNegotiationSupportObject", "!=", "null", ")", "{", "try", "{", "GrizzlyAlpnNegotiator", "negotiator", "=", "new", "GrizzlyAlpnNegotiator", "(", "engine", ",", "link", ")", ";", "if", "(", "!", "engine", ".", "getUseClientMode", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"initializeAlpn invoke AlpnServerNegotiator \"", "+", "engine", ")", ";", "}", "// client mode is disabled; call NegotiationSuppoer.addNegotiator(SSLEngine, (AlpnServerNegotiator) this)", "Method", "m", "=", "grizzlyNegotiationSupport", ".", "getMethod", "(", "\"addNegotiator\"", ",", "SSLEngine", ".", "class", ",", "grizzlyAlpnServerNegotiator", ")", ";", "m", ".", "invoke", "(", "grizzlyNegotiationSupportObject", ",", "new", "Object", "[", "]", "{", "engine", ",", "java", ".", "lang", ".", "reflect", ".", "Proxy", ".", "newProxyInstance", "(", "grizzlyAlpnServerNegotiator", ".", "getClassLoader", "(", ")", ",", "new", "java", ".", "lang", ".", "Class", "[", "]", "{", "grizzlyAlpnServerNegotiator", "}", ",", "negotiator", ")", "}", ")", ";", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"initializeAlpn invoke AlpnClientNegotiator \"", "+", "engine", ")", ";", "}", "// client mode is enabled; call NegotiationSuppoer.addNegotiator(SSLEngine, (AlpnClientNegotiator) this)", "Method", "m", "=", "grizzlyNegotiationSupport", ".", "getMethod", "(", "\"addNegotiator\"", ",", "SSLEngine", ".", "class", ",", "grizzlyAlpnClientNegotiator", ")", ";", "m", ".", "invoke", "(", "grizzlyNegotiationSupportObject", ",", "new", "Object", "[", "]", "{", "engine", ",", "java", ".", "lang", ".", "reflect", ".", "Proxy", ".", "newProxyInstance", "(", "grizzlyAlpnClientNegotiator", ".", "getClassLoader", "(", ")", ",", "new", "java", ".", "lang", ".", "Class", "[", "]", "{", "grizzlyAlpnClientNegotiator", "}", ",", "negotiator", ")", "}", ")", ";", "}", "return", "negotiator", ";", "}", "catch", "(", "InvocationTargetException", "ie", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"registerGrizzlyAlpn exception: \"", "+", "ie", ".", "getTargetException", "(", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"registerGrizzlyAlpn grizzly-npn exception: \"", "+", "e", ")", ";", "}", "}", "}", "return", "null", ";", "}" ]
Using grizzly-npn, set up a new GrizzlyAlpnNegotiator to handle ALPN for a given SSLEngine and link @param SSLEngine @param SSLConnectionLink @return GrizzlyAlpnNegotiator or null if ALPN was not set up
[ "Using", "grizzly", "-", "npn", "set", "up", "a", "new", "GrizzlyAlpnNegotiator", "to", "handle", "ALPN", "for", "a", "given", "SSLEngine", "and", "link" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLAlpnNegotiator.java#L393-L436
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLAlpnNegotiator.java
SSLAlpnNegotiator.registerJettyAlpn
protected JettyServerNegotiator registerJettyAlpn(final SSLEngine engine, SSLConnectionLink link) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerJettyAlpn entry " + engine); } try { JettyServerNegotiator negotiator = new JettyServerNegotiator(engine, link); // invoke ALPN.put(engine, provider(this)) Method m = jettyAlpn.getMethod("put", SSLEngine.class, jettyProviderInterface); m.invoke(null, new Object[] { engine, java.lang.reflect.Proxy.newProxyInstance( jettyServerProviderInterface.getClassLoader(), new java.lang.Class[] { jettyServerProviderInterface }, negotiator) }); return negotiator; } catch (InvocationTargetException ie) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerJettyAlpn exception: " + ie.getTargetException()); } } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerJettyAlpn jetty-alpn exception: " + e); } } return null; }
java
protected JettyServerNegotiator registerJettyAlpn(final SSLEngine engine, SSLConnectionLink link) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerJettyAlpn entry " + engine); } try { JettyServerNegotiator negotiator = new JettyServerNegotiator(engine, link); // invoke ALPN.put(engine, provider(this)) Method m = jettyAlpn.getMethod("put", SSLEngine.class, jettyProviderInterface); m.invoke(null, new Object[] { engine, java.lang.reflect.Proxy.newProxyInstance( jettyServerProviderInterface.getClassLoader(), new java.lang.Class[] { jettyServerProviderInterface }, negotiator) }); return negotiator; } catch (InvocationTargetException ie) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerJettyAlpn exception: " + ie.getTargetException()); } } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerJettyAlpn jetty-alpn exception: " + e); } } return null; }
[ "protected", "JettyServerNegotiator", "registerJettyAlpn", "(", "final", "SSLEngine", "engine", ",", "SSLConnectionLink", "link", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"registerJettyAlpn entry \"", "+", "engine", ")", ";", "}", "try", "{", "JettyServerNegotiator", "negotiator", "=", "new", "JettyServerNegotiator", "(", "engine", ",", "link", ")", ";", "// invoke ALPN.put(engine, provider(this))", "Method", "m", "=", "jettyAlpn", ".", "getMethod", "(", "\"put\"", ",", "SSLEngine", ".", "class", ",", "jettyProviderInterface", ")", ";", "m", ".", "invoke", "(", "null", ",", "new", "Object", "[", "]", "{", "engine", ",", "java", ".", "lang", ".", "reflect", ".", "Proxy", ".", "newProxyInstance", "(", "jettyServerProviderInterface", ".", "getClassLoader", "(", ")", ",", "new", "java", ".", "lang", ".", "Class", "[", "]", "{", "jettyServerProviderInterface", "}", ",", "negotiator", ")", "}", ")", ";", "return", "negotiator", ";", "}", "catch", "(", "InvocationTargetException", "ie", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"registerJettyAlpn exception: \"", "+", "ie", ".", "getTargetException", "(", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"registerJettyAlpn jetty-alpn exception: \"", "+", "e", ")", ";", "}", "}", "return", "null", ";", "}" ]
Using jetty-alpn, set up a new JettyServerNotiator to handle ALPN for a given SSLEngine and link @param SSLEngine @param SSLConnectionLink @return JettyServerNegotiator or null if ALPN was not set up
[ "Using", "jetty", "-", "alpn", "set", "up", "a", "new", "JettyServerNotiator", "to", "handle", "ALPN", "for", "a", "given", "SSLEngine", "and", "link" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLAlpnNegotiator.java#L445-L469
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSVariant.java
JSVariant.addCase
public void addCase(JMFType theCase) { if (theCase == null) throw new NullPointerException("Variant case cannot be null"); JSType newCase = (JSType)theCase; if (cases == null) cases = new JSType[1]; else { JSType[] oldCases = cases; cases = new JSType[oldCases.length + 1]; System.arraycopy(oldCases, 0, cases, 0, oldCases.length); } newCase.parent = this; newCase.siblingPosition = cases.length - 1; cases[newCase.siblingPosition] = newCase; }
java
public void addCase(JMFType theCase) { if (theCase == null) throw new NullPointerException("Variant case cannot be null"); JSType newCase = (JSType)theCase; if (cases == null) cases = new JSType[1]; else { JSType[] oldCases = cases; cases = new JSType[oldCases.length + 1]; System.arraycopy(oldCases, 0, cases, 0, oldCases.length); } newCase.parent = this; newCase.siblingPosition = cases.length - 1; cases[newCase.siblingPosition] = newCase; }
[ "public", "void", "addCase", "(", "JMFType", "theCase", ")", "{", "if", "(", "theCase", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"Variant case cannot be null\"", ")", ";", "JSType", "newCase", "=", "(", "JSType", ")", "theCase", ";", "if", "(", "cases", "==", "null", ")", "cases", "=", "new", "JSType", "[", "1", "]", ";", "else", "{", "JSType", "[", "]", "oldCases", "=", "cases", ";", "cases", "=", "new", "JSType", "[", "oldCases", ".", "length", "+", "1", "]", ";", "System", ".", "arraycopy", "(", "oldCases", ",", "0", ",", "cases", ",", "0", ",", "oldCases", ".", "length", ")", ";", "}", "newCase", ".", "parent", "=", "this", ";", "newCase", ".", "siblingPosition", "=", "cases", ".", "length", "-", "1", ";", "cases", "[", "newCase", ".", "siblingPosition", "]", "=", "newCase", ";", "}" ]
Add a case to the variant. Note that every variant must have at least one case.
[ "Add", "a", "case", "to", "the", "variant", ".", "Note", "that", "every", "variant", "must", "have", "at", "least", "one", "case", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSVariant.java#L115-L129
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSVariant.java
JSVariant.setMultiChoiceCount
BigInteger setMultiChoiceCount() { if (boxed == null) { multiChoiceCount = BigInteger.ZERO; for (int i = 0; i < cases.length; i++) multiChoiceCount = multiChoiceCount.add(cases[i].setMultiChoiceCount()); } return multiChoiceCount; }
java
BigInteger setMultiChoiceCount() { if (boxed == null) { multiChoiceCount = BigInteger.ZERO; for (int i = 0; i < cases.length; i++) multiChoiceCount = multiChoiceCount.add(cases[i].setMultiChoiceCount()); } return multiChoiceCount; }
[ "BigInteger", "setMultiChoiceCount", "(", ")", "{", "if", "(", "boxed", "==", "null", ")", "{", "multiChoiceCount", "=", "BigInteger", ".", "ZERO", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cases", ".", "length", ";", "i", "++", ")", "multiChoiceCount", "=", "multiChoiceCount", ".", "(", "cases", "[", "i", "]", ".", "setMultiChoiceCount", "(", ")", ")", ";", "}", "return", "multiChoiceCount", ";", "}" ]
otherwise, it's the sum of the multiChoice counts for the cases.
[ "otherwise", "it", "s", "the", "sum", "of", "the", "multiChoice", "counts", "for", "the", "cases", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSVariant.java#L134-L141
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSVariant.java
JSVariant.getDominatedVariants
public JSVariant[] getDominatedVariants(int i) { if (dominated == null) dominated = new JSVariant[cases.length][]; if (dominated[i] == null) { JSType acase = cases[i]; if (acase instanceof JSVariant) dominated[i] = new JSVariant[] {(JSVariant)acase }; else if (acase instanceof JSTuple) dominated[i] = ((JSTuple)acase).getDominatedVariants(); else // Other cases don't dominate any unboxed variants (JSRepeated always boxes any // variants under it) dominated[i] = new JSVariant[0]; } return dominated[i]; }
java
public JSVariant[] getDominatedVariants(int i) { if (dominated == null) dominated = new JSVariant[cases.length][]; if (dominated[i] == null) { JSType acase = cases[i]; if (acase instanceof JSVariant) dominated[i] = new JSVariant[] {(JSVariant)acase }; else if (acase instanceof JSTuple) dominated[i] = ((JSTuple)acase).getDominatedVariants(); else // Other cases don't dominate any unboxed variants (JSRepeated always boxes any // variants under it) dominated[i] = new JSVariant[0]; } return dominated[i]; }
[ "public", "JSVariant", "[", "]", "getDominatedVariants", "(", "int", "i", ")", "{", "if", "(", "dominated", "==", "null", ")", "dominated", "=", "new", "JSVariant", "[", "cases", ".", "length", "]", "[", "", "]", ";", "if", "(", "dominated", "[", "i", "]", "==", "null", ")", "{", "JSType", "acase", "=", "cases", "[", "i", "]", ";", "if", "(", "acase", "instanceof", "JSVariant", ")", "dominated", "[", "i", "]", "=", "new", "JSVariant", "[", "]", "{", "(", "JSVariant", ")", "acase", "}", ";", "else", "if", "(", "acase", "instanceof", "JSTuple", ")", "dominated", "[", "i", "]", "=", "(", "(", "JSTuple", ")", "acase", ")", ".", "getDominatedVariants", "(", ")", ";", "else", "// Other cases don't dominate any unboxed variants (JSRepeated always boxes any", "// variants under it)", "dominated", "[", "i", "]", "=", "new", "JSVariant", "[", "0", "]", ";", "}", "return", "dominated", "[", "i", "]", ";", "}" ]
Get the unboxed variants dominated by a case of this variant
[ "Get", "the", "unboxed", "variants", "dominated", "by", "a", "case", "of", "this", "variant" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSVariant.java#L146-L161
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSVariant.java
JSVariant.box
JSchema box(Map context) { if (boxed != null) return boxed; // only do it once JSVariant subTop = new JSVariant(); subTop.cases = cases; subTop.boxedBy = this; boxed = (JSchema)context.get(subTop); if (boxed == null) { boxed = new JSchema(subTop, context); for (int i = 0; i < cases.length; i++) cases[i].parent = subTop; context.put(subTop, boxed); } return boxed; }
java
JSchema box(Map context) { if (boxed != null) return boxed; // only do it once JSVariant subTop = new JSVariant(); subTop.cases = cases; subTop.boxedBy = this; boxed = (JSchema)context.get(subTop); if (boxed == null) { boxed = new JSchema(subTop, context); for (int i = 0; i < cases.length; i++) cases[i].parent = subTop; context.put(subTop, boxed); } return boxed; }
[ "JSchema", "box", "(", "Map", "context", ")", "{", "if", "(", "boxed", "!=", "null", ")", "return", "boxed", ";", "// only do it once", "JSVariant", "subTop", "=", "new", "JSVariant", "(", ")", ";", "subTop", ".", "cases", "=", "cases", ";", "subTop", ".", "boxedBy", "=", "this", ";", "boxed", "=", "(", "JSchema", ")", "context", ".", "get", "(", "subTop", ")", ";", "if", "(", "boxed", "==", "null", ")", "{", "boxed", "=", "new", "JSchema", "(", "subTop", ",", "context", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cases", ".", "length", ";", "i", "++", ")", "cases", "[", "i", "]", ".", "parent", "=", "subTop", ";", "context", ".", "put", "(", "subTop", ",", "boxed", ")", ";", "}", "return", "boxed", ";", "}" ]
includes a cyclic reference to a JSchema already under construction.
[ "includes", "a", "cyclic", "reference", "to", "a", "JSchema", "already", "under", "construction", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSVariant.java#L195-L209
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSVariant.java
JSVariant.getBoxAccessor
public int getBoxAccessor(JMFSchema schema) { for (Accessor acc = boxAccessor; acc != null; acc = acc.next) if (schema == acc.schema) return acc.accessor; return -1; }
java
public int getBoxAccessor(JMFSchema schema) { for (Accessor acc = boxAccessor; acc != null; acc = acc.next) if (schema == acc.schema) return acc.accessor; return -1; }
[ "public", "int", "getBoxAccessor", "(", "JMFSchema", "schema", ")", "{", "for", "(", "Accessor", "acc", "=", "boxAccessor", ";", "acc", "!=", "null", ";", "acc", "=", "acc", ".", "next", ")", "if", "(", "schema", "==", "acc", ".", "schema", ")", "return", "acc", ".", "accessor", ";", "return", "-", "1", ";", "}" ]
Implement the general form of getBoxAccessor
[ "Implement", "the", "general", "form", "of", "getBoxAccessor" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSVariant.java#L224-L229
train
OpenLiberty/open-liberty
dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/PartyRole.java
PartyRole.setPrimaryRolePlayer
public void setPrimaryRolePlayer(com.ibm.wsspi.security.wim.model.RolePlayer value) { this.primaryRolePlayer = value; }
java
public void setPrimaryRolePlayer(com.ibm.wsspi.security.wim.model.RolePlayer value) { this.primaryRolePlayer = value; }
[ "public", "void", "setPrimaryRolePlayer", "(", "com", ".", "ibm", ".", "wsspi", ".", "security", ".", "wim", ".", "model", ".", "RolePlayer", "value", ")", "{", "this", ".", "primaryRolePlayer", "=", "value", ";", "}" ]
Sets the value of the primaryRolePlayer property. @param value allowed object is {@link com.ibm.wsspi.security.wim.model.RolePlayer }
[ "Sets", "the", "value", "of", "the", "primaryRolePlayer", "property", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/PartyRole.java#L104-L106
train
OpenLiberty/open-liberty
dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/PartyRole.java
PartyRole.getRelatedRolePlayer
public List<com.ibm.wsspi.security.wim.model.RolePlayer> getRelatedRolePlayer() { if (relatedRolePlayer == null) { relatedRolePlayer = new ArrayList<com.ibm.wsspi.security.wim.model.RolePlayer>(); } return this.relatedRolePlayer; }
java
public List<com.ibm.wsspi.security.wim.model.RolePlayer> getRelatedRolePlayer() { if (relatedRolePlayer == null) { relatedRolePlayer = new ArrayList<com.ibm.wsspi.security.wim.model.RolePlayer>(); } return this.relatedRolePlayer; }
[ "public", "List", "<", "com", ".", "ibm", ".", "wsspi", ".", "security", ".", "wim", ".", "model", ".", "RolePlayer", ">", "getRelatedRolePlayer", "(", ")", "{", "if", "(", "relatedRolePlayer", "==", "null", ")", "{", "relatedRolePlayer", "=", "new", "ArrayList", "<", "com", ".", "ibm", ".", "wsspi", ".", "security", ".", "wim", ".", "model", ".", "RolePlayer", ">", "(", ")", ";", "}", "return", "this", ".", "relatedRolePlayer", ";", "}" ]
Gets the value of the relatedRolePlayer property. <p> This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for the relatedRolePlayer property. <p> For example, to add a new item, do as follows: <pre> getRelatedRolePlayer().add(newItem); </pre> <p> Objects of the following type(s) are allowed in the list {@link com.ibm.wsspi.security.wim.model.RolePlayer }
[ "Gets", "the", "value", "of", "the", "relatedRolePlayer", "property", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/PartyRole.java#L134-L139
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel.osgi/src/com/ibm/ws/logging/internal/osgi/hpel/AbstractHPELConfigService.java
AbstractHPELConfigService.stop
void stop() { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Stopping the HPEL managed service"); } // disconnect from the config admin this.configRef.unregister(); }
java
void stop() { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Stopping the HPEL managed service"); } // disconnect from the config admin this.configRef.unregister(); }
[ "void", "stop", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Stopping the HPEL managed service\"", ")", ";", "}", "// disconnect from the config admin", "this", ".", "configRef", ".", "unregister", "(", ")", ";", "}" ]
Stop this service and free any allocated resources when the owning bundle is being stopped.
[ "Stop", "this", "service", "and", "free", "any", "allocated", "resources", "when", "the", "owning", "bundle", "is", "being", "stopped", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel.osgi/src/com/ibm/ws/logging/internal/osgi/hpel/AbstractHPELConfigService.java#L82-L88
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/parser/JSParser.java
JSParser.reconcile
private static void reconcile(JSType top, List defs, Map refs) { List unres = (List) refs.get(top.getFeatureName()); if (unres != null) for (Iterator iter = unres.iterator(); iter.hasNext(); ) ((JSDynamic) iter.next()).setExpectedType(top); for (Iterator iter = defs.iterator(); iter.hasNext(); ) { JSType one = (JSType) iter.next(); List ur = (List) refs.get(one.getFeatureName()); if (ur != null) for (Iterator jter = ur.iterator(); jter.hasNext(); ) ((JSDynamic) jter.next()).setExpectedType(one); } }
java
private static void reconcile(JSType top, List defs, Map refs) { List unres = (List) refs.get(top.getFeatureName()); if (unres != null) for (Iterator iter = unres.iterator(); iter.hasNext(); ) ((JSDynamic) iter.next()).setExpectedType(top); for (Iterator iter = defs.iterator(); iter.hasNext(); ) { JSType one = (JSType) iter.next(); List ur = (List) refs.get(one.getFeatureName()); if (ur != null) for (Iterator jter = ur.iterator(); jter.hasNext(); ) ((JSDynamic) jter.next()).setExpectedType(one); } }
[ "private", "static", "void", "reconcile", "(", "JSType", "top", ",", "List", "defs", ",", "Map", "refs", ")", "{", "List", "unres", "=", "(", "List", ")", "refs", ".", "get", "(", "top", ".", "getFeatureName", "(", ")", ")", ";", "if", "(", "unres", "!=", "null", ")", "for", "(", "Iterator", "iter", "=", "unres", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "", "(", "(", "JSDynamic", ")", "iter", ".", "next", "(", ")", ")", ".", "setExpectedType", "(", "top", ")", ";", "for", "(", "Iterator", "iter", "=", "defs", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "JSType", "one", "=", "(", "JSType", ")", "iter", ".", "next", "(", ")", ";", "List", "ur", "=", "(", "List", ")", "refs", ".", "get", "(", "one", ".", "getFeatureName", "(", ")", ")", ";", "if", "(", "ur", "!=", "null", ")", "for", "(", "Iterator", "jter", "=", "ur", ".", "iterator", "(", ")", ";", "jter", ".", "hasNext", "(", ")", ";", ")", "", "(", "(", "JSDynamic", ")", "jter", ".", "next", "(", ")", ")", ".", "setExpectedType", "(", "one", ")", ";", "}", "}" ]
Subroutine to resolve dangling "expected" references
[ "Subroutine", "to", "resolve", "dangling", "expected", "references" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/parser/JSParser.java#L94-L106
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/parser/JSParser.java
JSParser.addRef
private static void addRef(Map refs, String key, JSDynamic unres) { List thisKey = (List) refs.get(key); if (thisKey == null) { thisKey = new ArrayList(); refs.put(key, thisKey); } thisKey.add(unres); }
java
private static void addRef(Map refs, String key, JSDynamic unres) { List thisKey = (List) refs.get(key); if (thisKey == null) { thisKey = new ArrayList(); refs.put(key, thisKey); } thisKey.add(unres); }
[ "private", "static", "void", "addRef", "(", "Map", "refs", ",", "String", "key", ",", "JSDynamic", "unres", ")", "{", "List", "thisKey", "=", "(", "List", ")", "refs", ".", "get", "(", "key", ")", ";", "if", "(", "thisKey", "==", "null", ")", "{", "thisKey", "=", "new", "ArrayList", "(", ")", ";", "refs", ".", "put", "(", "key", ",", "thisKey", ")", ";", "}", "thisKey", ".", "add", "(", "unres", ")", ";", "}" ]
Subroutine to enter a dangling "expected" reference in the refs map
[ "Subroutine", "to", "enter", "a", "dangling", "expected", "reference", "in", "the", "refs", "map" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/parser/JSParser.java#L111-L118
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/strategies/writeable/AddThenHideOldStrategy.java
AddThenHideOldStrategy.getNewerResource
private RepositoryResource getNewerResource(RepositoryResource res1, RepositoryResource res2) throws RepositoryResourceValidationException { // if one of the resources is beta and the other not, return the non-beta one RepositoryResource singleNonBetaResource = returnNonBetaResourceOrNull(res1, res2); if (singleNonBetaResource != null) { return singleNonBetaResource; } if (res1.getType() == ResourceType.INSTALL) { // have two String versions .. convert them into Version objects,checking that they are valid versions in the process Version4Digit res1Version = null; Version4Digit res2Version = null; try { res1Version = new Version4Digit(((ProductResourceWritable) res1).getProductVersion()); } catch (IllegalArgumentException iae) { // the version was not a proper osgi version throw new RepositoryResourceValidationException("The product version was invalid: " + res1Version, res1.getId(), iae); } try { res2Version = new Version4Digit(((ProductResourceWritable) res2).getProductVersion()); } catch (IllegalArgumentException iae) { // the version was not a proper osgi version throw new RepositoryResourceValidationException("The product version was invalid: " + res2Version, res2.getId(), iae); } if (res1Version.compareTo(res2Version) > 0) { return res1; } else { return res2; } } else if (res1.getType() == ResourceType.TOOL) { // tools don't have product versions or applies to so just return res1 return res1; } else { return compareNonProductResourceAppliesTo(res1, res2); } }
java
private RepositoryResource getNewerResource(RepositoryResource res1, RepositoryResource res2) throws RepositoryResourceValidationException { // if one of the resources is beta and the other not, return the non-beta one RepositoryResource singleNonBetaResource = returnNonBetaResourceOrNull(res1, res2); if (singleNonBetaResource != null) { return singleNonBetaResource; } if (res1.getType() == ResourceType.INSTALL) { // have two String versions .. convert them into Version objects,checking that they are valid versions in the process Version4Digit res1Version = null; Version4Digit res2Version = null; try { res1Version = new Version4Digit(((ProductResourceWritable) res1).getProductVersion()); } catch (IllegalArgumentException iae) { // the version was not a proper osgi version throw new RepositoryResourceValidationException("The product version was invalid: " + res1Version, res1.getId(), iae); } try { res2Version = new Version4Digit(((ProductResourceWritable) res2).getProductVersion()); } catch (IllegalArgumentException iae) { // the version was not a proper osgi version throw new RepositoryResourceValidationException("The product version was invalid: " + res2Version, res2.getId(), iae); } if (res1Version.compareTo(res2Version) > 0) { return res1; } else { return res2; } } else if (res1.getType() == ResourceType.TOOL) { // tools don't have product versions or applies to so just return res1 return res1; } else { return compareNonProductResourceAppliesTo(res1, res2); } }
[ "private", "RepositoryResource", "getNewerResource", "(", "RepositoryResource", "res1", ",", "RepositoryResource", "res2", ")", "throws", "RepositoryResourceValidationException", "{", "// if one of the resources is beta and the other not, return the non-beta one", "RepositoryResource", "singleNonBetaResource", "=", "returnNonBetaResourceOrNull", "(", "res1", ",", "res2", ")", ";", "if", "(", "singleNonBetaResource", "!=", "null", ")", "{", "return", "singleNonBetaResource", ";", "}", "if", "(", "res1", ".", "getType", "(", ")", "==", "ResourceType", ".", "INSTALL", ")", "{", "// have two String versions .. convert them into Version objects,checking that they are valid versions in the process", "Version4Digit", "res1Version", "=", "null", ";", "Version4Digit", "res2Version", "=", "null", ";", "try", "{", "res1Version", "=", "new", "Version4Digit", "(", "(", "(", "ProductResourceWritable", ")", "res1", ")", ".", "getProductVersion", "(", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "// the version was not a proper osgi version", "throw", "new", "RepositoryResourceValidationException", "(", "\"The product version was invalid: \"", "+", "res1Version", ",", "res1", ".", "getId", "(", ")", ",", "iae", ")", ";", "}", "try", "{", "res2Version", "=", "new", "Version4Digit", "(", "(", "(", "ProductResourceWritable", ")", "res2", ")", ".", "getProductVersion", "(", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "// the version was not a proper osgi version", "throw", "new", "RepositoryResourceValidationException", "(", "\"The product version was invalid: \"", "+", "res2Version", ",", "res2", ".", "getId", "(", ")", ",", "iae", ")", ";", "}", "if", "(", "res1Version", ".", "compareTo", "(", "res2Version", ")", ">", "0", ")", "{", "return", "res1", ";", "}", "else", "{", "return", "res2", ";", "}", "}", "else", "if", "(", "res1", ".", "getType", "(", ")", "==", "ResourceType", ".", "TOOL", ")", "{", "// tools don't have product versions or applies to so just return res1", "return", "res1", ";", "}", "else", "{", "return", "compareNonProductResourceAppliesTo", "(", "res1", ",", "res2", ")", ";", "}", "}" ]
Return the higher version of the resource or the first one if this cannot be determined. For Products this is based off the ProductVersion and for everything else it is based of the appliesTo information. For resources that have the same appliesTo version the version field is used to determine which to return. If the higher version cannot be determined the first resource is returned. If one resource is beta and one non-beta the non-beta one is returned. @param res1 resource to compare @param res2 resource to compare @return RepositoryResource of the higher level, or res1 if the same level @throws RepositoryResourceValidationException @throws RepositoryIllegalArgumentException
[ "Return", "the", "higher", "version", "of", "the", "resource", "or", "the", "first", "one", "if", "this", "cannot", "be", "determined", ".", "For", "Products", "this", "is", "based", "off", "the", "ProductVersion", "and", "for", "everything", "else", "it", "is", "based", "of", "the", "appliesTo", "information", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/strategies/writeable/AddThenHideOldStrategy.java#L243-L283
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/strategies/writeable/AddThenHideOldStrategy.java
AddThenHideOldStrategy.compareNonProductResourceAppliesTo
private RepositoryResource compareNonProductResourceAppliesTo(RepositoryResource res1, RepositoryResource res2) { // all types other than INSTALLS or TOOLS use appliesTo to determine which is the higher level String res1AppliesTo = ((ApplicableToProduct) res1).getAppliesTo(); String res2AppliesTo = ((ApplicableToProduct) res2).getAppliesTo(); // on the basis that we will work with the appliesTo of a resource, if we find one that has an applies to // and one that doesn't we will the one WITH the applies to is assumed to be newer (if both null we look // at the version field) if (res1AppliesTo == null && res2AppliesTo == null) { // if both appliesTo are null look at the versions return getNonProductResourceWithHigherVersion(res1, res2); } else if (res1AppliesTo == null || res2AppliesTo == null) { // if one of them is null we can't compare them so return res1 return res1; } MinAndMaxVersion res1MinMax = getMinAndMaxAppliesToVersionFromAppliesTo(res1AppliesTo); MinAndMaxVersion res2MinMax = getMinAndMaxAppliesToVersionFromAppliesTo(res2AppliesTo); // compare the versions and return the resource that applies to the higher minimum version if (res1MinMax.min.compareTo(res2MinMax.min) > 0) { return res1; } else if (res1MinMax.min.compareTo(res2MinMax.min) == 0) { // if they apply to the same minimum version then select the one with the highest max versions if (res1MinMax.max.compareTo(res2MinMax.max) > 0) { return res1; } else if (res1MinMax.max.compareTo(res2MinMax.max) < 0) { return res2; } else { // if they are still the same decide on the version return getNonProductResourceWithHigherVersion(res1, res2); } } else { return res2; } }
java
private RepositoryResource compareNonProductResourceAppliesTo(RepositoryResource res1, RepositoryResource res2) { // all types other than INSTALLS or TOOLS use appliesTo to determine which is the higher level String res1AppliesTo = ((ApplicableToProduct) res1).getAppliesTo(); String res2AppliesTo = ((ApplicableToProduct) res2).getAppliesTo(); // on the basis that we will work with the appliesTo of a resource, if we find one that has an applies to // and one that doesn't we will the one WITH the applies to is assumed to be newer (if both null we look // at the version field) if (res1AppliesTo == null && res2AppliesTo == null) { // if both appliesTo are null look at the versions return getNonProductResourceWithHigherVersion(res1, res2); } else if (res1AppliesTo == null || res2AppliesTo == null) { // if one of them is null we can't compare them so return res1 return res1; } MinAndMaxVersion res1MinMax = getMinAndMaxAppliesToVersionFromAppliesTo(res1AppliesTo); MinAndMaxVersion res2MinMax = getMinAndMaxAppliesToVersionFromAppliesTo(res2AppliesTo); // compare the versions and return the resource that applies to the higher minimum version if (res1MinMax.min.compareTo(res2MinMax.min) > 0) { return res1; } else if (res1MinMax.min.compareTo(res2MinMax.min) == 0) { // if they apply to the same minimum version then select the one with the highest max versions if (res1MinMax.max.compareTo(res2MinMax.max) > 0) { return res1; } else if (res1MinMax.max.compareTo(res2MinMax.max) < 0) { return res2; } else { // if they are still the same decide on the version return getNonProductResourceWithHigherVersion(res1, res2); } } else { return res2; } }
[ "private", "RepositoryResource", "compareNonProductResourceAppliesTo", "(", "RepositoryResource", "res1", ",", "RepositoryResource", "res2", ")", "{", "// all types other than INSTALLS or TOOLS use appliesTo to determine which is the higher level", "String", "res1AppliesTo", "=", "(", "(", "ApplicableToProduct", ")", "res1", ")", ".", "getAppliesTo", "(", ")", ";", "String", "res2AppliesTo", "=", "(", "(", "ApplicableToProduct", ")", "res2", ")", ".", "getAppliesTo", "(", ")", ";", "// on the basis that we will work with the appliesTo of a resource, if we find one that has an applies to", "// and one that doesn't we will the one WITH the applies to is assumed to be newer (if both null we look", "// at the version field)", "if", "(", "res1AppliesTo", "==", "null", "&&", "res2AppliesTo", "==", "null", ")", "{", "// if both appliesTo are null look at the versions", "return", "getNonProductResourceWithHigherVersion", "(", "res1", ",", "res2", ")", ";", "}", "else", "if", "(", "res1AppliesTo", "==", "null", "||", "res2AppliesTo", "==", "null", ")", "{", "// if one of them is null we can't compare them so return res1", "return", "res1", ";", "}", "MinAndMaxVersion", "res1MinMax", "=", "getMinAndMaxAppliesToVersionFromAppliesTo", "(", "res1AppliesTo", ")", ";", "MinAndMaxVersion", "res2MinMax", "=", "getMinAndMaxAppliesToVersionFromAppliesTo", "(", "res2AppliesTo", ")", ";", "// compare the versions and return the resource that applies to the higher minimum version", "if", "(", "res1MinMax", ".", "min", ".", "compareTo", "(", "res2MinMax", ".", "min", ")", ">", "0", ")", "{", "return", "res1", ";", "}", "else", "if", "(", "res1MinMax", ".", "min", ".", "compareTo", "(", "res2MinMax", ".", "min", ")", "==", "0", ")", "{", "// if they apply to the same minimum version then select the one with the highest max versions", "if", "(", "res1MinMax", ".", "max", ".", "compareTo", "(", "res2MinMax", ".", "max", ")", ">", "0", ")", "{", "return", "res1", ";", "}", "else", "if", "(", "res1MinMax", ".", "max", ".", "compareTo", "(", "res2MinMax", ".", "max", ")", "<", "0", ")", "{", "return", "res2", ";", "}", "else", "{", "// if they are still the same decide on the version", "return", "getNonProductResourceWithHigherVersion", "(", "res1", ",", "res2", ")", ";", "}", "}", "else", "{", "return", "res2", ";", "}", "}" ]
This routine handles non product resources @param res1 - a non-product resource @param res2 - a non-product resource @return the newer resource
[ "This", "routine", "handles", "non", "product", "resources" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/strategies/writeable/AddThenHideOldStrategy.java#L327-L366
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/strategies/writeable/AddThenHideOldStrategy.java
AddThenHideOldStrategy.getNonProductResourceWithHigherVersion
private RepositoryResource getNonProductResourceWithHigherVersion(RepositoryResource res1, RepositoryResource res2) { if (res1.getVersion() == null || res2.getVersion() == null) { return res1; // don't have two versions so can't compare } // have two String versions .. convert them into Version objects,checking that they are valid versions in the process Version4Digit res1Version = null; Version4Digit res2Version = null; try { res1Version = new Version4Digit(res1.getVersion()); res2Version = new Version4Digit(res2.getVersion()); } catch (IllegalArgumentException iae) { // at least one of the one or more of Versions is not a proper osgi // version so we cannot compare the version fields. Just return res1. return res1; } if (res1Version.compareTo(res2Version) > 0) { return res1; } else { return res2; } }
java
private RepositoryResource getNonProductResourceWithHigherVersion(RepositoryResource res1, RepositoryResource res2) { if (res1.getVersion() == null || res2.getVersion() == null) { return res1; // don't have two versions so can't compare } // have two String versions .. convert them into Version objects,checking that they are valid versions in the process Version4Digit res1Version = null; Version4Digit res2Version = null; try { res1Version = new Version4Digit(res1.getVersion()); res2Version = new Version4Digit(res2.getVersion()); } catch (IllegalArgumentException iae) { // at least one of the one or more of Versions is not a proper osgi // version so we cannot compare the version fields. Just return res1. return res1; } if (res1Version.compareTo(res2Version) > 0) { return res1; } else { return res2; } }
[ "private", "RepositoryResource", "getNonProductResourceWithHigherVersion", "(", "RepositoryResource", "res1", ",", "RepositoryResource", "res2", ")", "{", "if", "(", "res1", ".", "getVersion", "(", ")", "==", "null", "||", "res2", ".", "getVersion", "(", ")", "==", "null", ")", "{", "return", "res1", ";", "// don't have two versions so can't compare", "}", "// have two String versions .. convert them into Version objects,checking that they are valid versions in the process", "Version4Digit", "res1Version", "=", "null", ";", "Version4Digit", "res2Version", "=", "null", ";", "try", "{", "res1Version", "=", "new", "Version4Digit", "(", "res1", ".", "getVersion", "(", ")", ")", ";", "res2Version", "=", "new", "Version4Digit", "(", "res2", ".", "getVersion", "(", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "// at least one of the one or more of Versions is not a proper osgi", "// version so we cannot compare the version fields. Just return res1.", "return", "res1", ";", "}", "if", "(", "res1Version", ".", "compareTo", "(", "res2Version", ")", ">", "0", ")", "{", "return", "res1", ";", "}", "else", "{", "return", "res2", ";", "}", "}" ]
Return the resource with the highest version for when the appliesTo versions are equal @param res1 resource to compare @param res2 resource to compare @return RepositoryResource with the higher version field
[ "Return", "the", "resource", "with", "the", "highest", "version", "for", "when", "the", "appliesTo", "versions", "are", "equal" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/strategies/writeable/AddThenHideOldStrategy.java#L375-L398
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/strategies/writeable/AddThenHideOldStrategy.java
AddThenHideOldStrategy.getMinAndMaxAppliesToVersionFromAppliesTo
private MinAndMaxVersion getMinAndMaxAppliesToVersionFromAppliesTo(String appliesTo) { List<AppliesToFilterInfo> res1Filters = AppliesToProcessor.parseAppliesToHeader(appliesTo); Version4Digit highestVersion = null; Version4Digit lowestVersion = null; for (AppliesToFilterInfo f : res1Filters) { Version4Digit vHigh = (f.getMaxVersion() == null) ? MAX_VERSION : new Version4Digit(f.getMaxVersion().getValue()); Version4Digit vLow = (f.getMinVersion() == null) ? MIN_VERSION : new Version4Digit(f.getMinVersion().getValue()); if (highestVersion == null || vHigh.compareTo(highestVersion) > 0) { highestVersion = vHigh; lowestVersion = vLow; } else if (vHigh.compareTo(highestVersion) == 0) { if (lowestVersion == null || vLow.compareTo(lowestVersion) > 0) { highestVersion = vHigh; lowestVersion = vLow; } } } return new MinAndMaxVersion(lowestVersion, highestVersion); }
java
private MinAndMaxVersion getMinAndMaxAppliesToVersionFromAppliesTo(String appliesTo) { List<AppliesToFilterInfo> res1Filters = AppliesToProcessor.parseAppliesToHeader(appliesTo); Version4Digit highestVersion = null; Version4Digit lowestVersion = null; for (AppliesToFilterInfo f : res1Filters) { Version4Digit vHigh = (f.getMaxVersion() == null) ? MAX_VERSION : new Version4Digit(f.getMaxVersion().getValue()); Version4Digit vLow = (f.getMinVersion() == null) ? MIN_VERSION : new Version4Digit(f.getMinVersion().getValue()); if (highestVersion == null || vHigh.compareTo(highestVersion) > 0) { highestVersion = vHigh; lowestVersion = vLow; } else if (vHigh.compareTo(highestVersion) == 0) { if (lowestVersion == null || vLow.compareTo(lowestVersion) > 0) { highestVersion = vHigh; lowestVersion = vLow; } } } return new MinAndMaxVersion(lowestVersion, highestVersion); }
[ "private", "MinAndMaxVersion", "getMinAndMaxAppliesToVersionFromAppliesTo", "(", "String", "appliesTo", ")", "{", "List", "<", "AppliesToFilterInfo", ">", "res1Filters", "=", "AppliesToProcessor", ".", "parseAppliesToHeader", "(", "appliesTo", ")", ";", "Version4Digit", "highestVersion", "=", "null", ";", "Version4Digit", "lowestVersion", "=", "null", ";", "for", "(", "AppliesToFilterInfo", "f", ":", "res1Filters", ")", "{", "Version4Digit", "vHigh", "=", "(", "f", ".", "getMaxVersion", "(", ")", "==", "null", ")", "?", "MAX_VERSION", ":", "new", "Version4Digit", "(", "f", ".", "getMaxVersion", "(", ")", ".", "getValue", "(", ")", ")", ";", "Version4Digit", "vLow", "=", "(", "f", ".", "getMinVersion", "(", ")", "==", "null", ")", "?", "MIN_VERSION", ":", "new", "Version4Digit", "(", "f", ".", "getMinVersion", "(", ")", ".", "getValue", "(", ")", ")", ";", "if", "(", "highestVersion", "==", "null", "||", "vHigh", ".", "compareTo", "(", "highestVersion", ")", ">", "0", ")", "{", "highestVersion", "=", "vHigh", ";", "lowestVersion", "=", "vLow", ";", "}", "else", "if", "(", "vHigh", ".", "compareTo", "(", "highestVersion", ")", "==", "0", ")", "{", "if", "(", "lowestVersion", "==", "null", "||", "vLow", ".", "compareTo", "(", "lowestVersion", ")", ">", "0", ")", "{", "highestVersion", "=", "vHigh", ";", "lowestVersion", "=", "vLow", ";", "}", "}", "}", "return", "new", "MinAndMaxVersion", "(", "lowestVersion", ",", "highestVersion", ")", ";", "}" ]
Parse an appliesTo to get the lowest and highest version that this asset applies to and return an object describing this. @param apliesTo the appliesTo String @return MinAndMaxVersion object describing the range of levels supported
[ "Parse", "an", "appliesTo", "to", "get", "the", "lowest", "and", "highest", "version", "that", "this", "asset", "applies", "to", "and", "return", "an", "object", "describing", "this", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/strategies/writeable/AddThenHideOldStrategy.java#L407-L426
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/ResourceAdapterService.java
ResourceAdapterService.rarFileExists
public boolean rarFileExists() { final File zipFile = new File(rarFilePath); return AccessController.doPrivileged(new PrivilegedAction<Boolean>() { @Override public Boolean run() { return zipFile.exists(); } }); }
java
public boolean rarFileExists() { final File zipFile = new File(rarFilePath); return AccessController.doPrivileged(new PrivilegedAction<Boolean>() { @Override public Boolean run() { return zipFile.exists(); } }); }
[ "public", "boolean", "rarFileExists", "(", ")", "{", "final", "File", "zipFile", "=", "new", "File", "(", "rarFilePath", ")", ";", "return", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "Boolean", ">", "(", ")", "{", "@", "Override", "public", "Boolean", "run", "(", ")", "{", "return", "zipFile", ".", "exists", "(", ")", ";", "}", "}", ")", ";", "}" ]
Check that resource adapter path exists @return true if path exists, false if it does not
[ "Check", "that", "resource", "adapter", "path", "exists" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/ResourceAdapterService.java#L187-L195
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/ResourceAdapterService.java
ResourceAdapterService.getClassLoader
public ClassLoader getClassLoader() throws UnableToAdaptException, MalformedURLException { lock.readLock().lock(); try { if (classloader != null) return classloader; } finally { lock.readLock().unlock(); } if (!rarFileExists()) return null; lock.writeLock().lock(); try { if (classloader == null) { classloader = createRarClassLoader(); } return classloader; } finally { lock.writeLock().unlock(); } }
java
public ClassLoader getClassLoader() throws UnableToAdaptException, MalformedURLException { lock.readLock().lock(); try { if (classloader != null) return classloader; } finally { lock.readLock().unlock(); } if (!rarFileExists()) return null; lock.writeLock().lock(); try { if (classloader == null) { classloader = createRarClassLoader(); } return classloader; } finally { lock.writeLock().unlock(); } }
[ "public", "ClassLoader", "getClassLoader", "(", ")", "throws", "UnableToAdaptException", ",", "MalformedURLException", "{", "lock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "classloader", "!=", "null", ")", "return", "classloader", ";", "}", "finally", "{", "lock", ".", "readLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "if", "(", "!", "rarFileExists", "(", ")", ")", "return", "null", ";", "lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "classloader", "==", "null", ")", "{", "classloader", "=", "createRarClassLoader", "(", ")", ";", "}", "return", "classloader", ";", "}", "finally", "{", "lock", ".", "writeLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}" ]
Returns the class loader for the resource adapter. @return class loader @throws UnableToAdaptException @throws MalformedURLException
[ "Returns", "the", "class", "loader", "for", "the", "resource", "adapter", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/ResourceAdapterService.java#L204-L223
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/ResourceAdapterService.java
ResourceAdapterService.getProtectionDomain
private ProtectionDomain getProtectionDomain(Container rarContainer) throws UnableToAdaptException, MalformedURLException { PermissionCollection perms = new Permissions(); CodeSource codeSource; try { // codesource must start file:/// // assume loc starts with 0 or 1 / String loc = rarFilePath; codeSource = new CodeSource(new URL("file://" + (loc.startsWith("/") ? "" : "/") + loc), (java.security.cert.Certificate[]) null); } catch (MalformedURLException e) { if (tc.isDebugEnabled()) { Tr.debug(tc, "CodeSource could not be created for RA file path of: rarFilePath", e); } throw e; } if (!java2SecurityEnabled()) { perms.add(new AllPermission()); } else { PermissionsConfig permissionsConfig = null; try { permissionsConfig = rarContainer.adapt(PermissionsConfig.class); } catch (UnableToAdaptException ex) { //J2CA8817E: Resource adapter {0} encountered a parse error when processing deployment descriptor {1}: {2} Tr.error(tc, "J2CA8817.parse.deployment.descriptor.failed", rarContainer.getName(), "META-INF/permissions.xml", ex); throw ex; } if (permissionsConfig != null) { List<com.ibm.ws.javaee.dd.permissions.Permission> configuredPermissions = permissionsConfig.getPermissions(); addPermissions(codeSource, configuredPermissions); } ArrayList<Permission> mergedPermissions = permissionManager.getEffectivePermissions(rarFilePath); int count = mergedPermissions.size(); for (int i = 0; i < count; i++) perms.add(mergedPermissions.get(i)); } return new ProtectionDomain(codeSource, perms); }
java
private ProtectionDomain getProtectionDomain(Container rarContainer) throws UnableToAdaptException, MalformedURLException { PermissionCollection perms = new Permissions(); CodeSource codeSource; try { // codesource must start file:/// // assume loc starts with 0 or 1 / String loc = rarFilePath; codeSource = new CodeSource(new URL("file://" + (loc.startsWith("/") ? "" : "/") + loc), (java.security.cert.Certificate[]) null); } catch (MalformedURLException e) { if (tc.isDebugEnabled()) { Tr.debug(tc, "CodeSource could not be created for RA file path of: rarFilePath", e); } throw e; } if (!java2SecurityEnabled()) { perms.add(new AllPermission()); } else { PermissionsConfig permissionsConfig = null; try { permissionsConfig = rarContainer.adapt(PermissionsConfig.class); } catch (UnableToAdaptException ex) { //J2CA8817E: Resource adapter {0} encountered a parse error when processing deployment descriptor {1}: {2} Tr.error(tc, "J2CA8817.parse.deployment.descriptor.failed", rarContainer.getName(), "META-INF/permissions.xml", ex); throw ex; } if (permissionsConfig != null) { List<com.ibm.ws.javaee.dd.permissions.Permission> configuredPermissions = permissionsConfig.getPermissions(); addPermissions(codeSource, configuredPermissions); } ArrayList<Permission> mergedPermissions = permissionManager.getEffectivePermissions(rarFilePath); int count = mergedPermissions.size(); for (int i = 0; i < count; i++) perms.add(mergedPermissions.get(i)); } return new ProtectionDomain(codeSource, perms); }
[ "private", "ProtectionDomain", "getProtectionDomain", "(", "Container", "rarContainer", ")", "throws", "UnableToAdaptException", ",", "MalformedURLException", "{", "PermissionCollection", "perms", "=", "new", "Permissions", "(", ")", ";", "CodeSource", "codeSource", ";", "try", "{", "// codesource must start file:///", "// assume loc starts with 0 or 1 /", "String", "loc", "=", "rarFilePath", ";", "codeSource", "=", "new", "CodeSource", "(", "new", "URL", "(", "\"file://\"", "+", "(", "loc", ".", "startsWith", "(", "\"/\"", ")", "?", "\"\"", ":", "\"/\"", ")", "+", "loc", ")", ",", "(", "java", ".", "security", ".", "cert", ".", "Certificate", "[", "]", ")", "null", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"CodeSource could not be created for RA file path of: rarFilePath\"", ",", "e", ")", ";", "}", "throw", "e", ";", "}", "if", "(", "!", "java2SecurityEnabled", "(", ")", ")", "{", "perms", ".", "add", "(", "new", "AllPermission", "(", ")", ")", ";", "}", "else", "{", "PermissionsConfig", "permissionsConfig", "=", "null", ";", "try", "{", "permissionsConfig", "=", "rarContainer", ".", "adapt", "(", "PermissionsConfig", ".", "class", ")", ";", "}", "catch", "(", "UnableToAdaptException", "ex", ")", "{", "//J2CA8817E: Resource adapter {0} encountered a parse error when processing deployment descriptor {1}: {2}", "Tr", ".", "error", "(", "tc", ",", "\"J2CA8817.parse.deployment.descriptor.failed\"", ",", "rarContainer", ".", "getName", "(", ")", ",", "\"META-INF/permissions.xml\"", ",", "ex", ")", ";", "throw", "ex", ";", "}", "if", "(", "permissionsConfig", "!=", "null", ")", "{", "List", "<", "com", ".", "ibm", ".", "ws", ".", "javaee", ".", "dd", ".", "permissions", ".", "Permission", ">", "configuredPermissions", "=", "permissionsConfig", ".", "getPermissions", "(", ")", ";", "addPermissions", "(", "codeSource", ",", "configuredPermissions", ")", ";", "}", "ArrayList", "<", "Permission", ">", "mergedPermissions", "=", "permissionManager", ".", "getEffectivePermissions", "(", "rarFilePath", ")", ";", "int", "count", "=", "mergedPermissions", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "perms", ".", "(", "mergedPermissions", ".", "get", "(", "i", ")", ")", ";", "}", "return", "new", "ProtectionDomain", "(", "codeSource", ",", "perms", ")", ";", "}" ]
Create a protection domain for the given RA, that includes the effective server java security permissions as well as those defined in the RA's permissions.xml. @param rarContainer resource adapter container object @return ProtectionDomain object configured for the resource adapter @throws UnableToAdaptException @throws MalformedURLException
[ "Create", "a", "protection", "domain", "for", "the", "given", "RA", "that", "includes", "the", "effective", "server", "java", "security", "permissions", "as", "well", "as", "those", "defined", "in", "the", "RA", "s", "permissions", ".", "xml", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/ResourceAdapterService.java#L386-L427
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/ResourceAdapterService.java
ResourceAdapterService.deleteBundleCacheDir
private boolean deleteBundleCacheDir(File path) { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (FileUtils.fileExists(path)) { if (trace && tc.isDebugEnabled()) { Tr.debug(this, tc, "Path specified exists: " + path.getPath()); } } else { if (trace && tc.isDebugEnabled()) { Tr.debug(this, tc, "Path specified does not exist: " + path.getPath()); } return true; } boolean deleteWorked = true; for (File file : FileUtils.listFiles(path)) { if (FileUtils.fileIsDirectory(file)) { if (trace && tc.isDebugEnabled()) { Tr.debug(this, tc, "Delete directory contents: " + file.toString()); } deleteWorked &= deleteBundleCacheDir(file); } else { if (trace && tc.isDebugEnabled()) { Tr.debug(this, tc, "Delete file: " + file.toString()); } if (!FileUtils.fileDelete(file)) { deleteWorked = false; if (trace && tc.isDebugEnabled()) { Tr.debug(this, tc, "Directory or file not deleted"); } } } } if (trace && tc.isDebugEnabled()) { Tr.debug(this, tc, "Delete path: " + path); } if (!FileUtils.fileDelete(path)) { deleteWorked = false; if (trace && tc.isDebugEnabled()) { Tr.debug(this, tc, "Path not deleted"); } } return deleteWorked; }
java
private boolean deleteBundleCacheDir(File path) { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (FileUtils.fileExists(path)) { if (trace && tc.isDebugEnabled()) { Tr.debug(this, tc, "Path specified exists: " + path.getPath()); } } else { if (trace && tc.isDebugEnabled()) { Tr.debug(this, tc, "Path specified does not exist: " + path.getPath()); } return true; } boolean deleteWorked = true; for (File file : FileUtils.listFiles(path)) { if (FileUtils.fileIsDirectory(file)) { if (trace && tc.isDebugEnabled()) { Tr.debug(this, tc, "Delete directory contents: " + file.toString()); } deleteWorked &= deleteBundleCacheDir(file); } else { if (trace && tc.isDebugEnabled()) { Tr.debug(this, tc, "Delete file: " + file.toString()); } if (!FileUtils.fileDelete(file)) { deleteWorked = false; if (trace && tc.isDebugEnabled()) { Tr.debug(this, tc, "Directory or file not deleted"); } } } } if (trace && tc.isDebugEnabled()) { Tr.debug(this, tc, "Delete path: " + path); } if (!FileUtils.fileDelete(path)) { deleteWorked = false; if (trace && tc.isDebugEnabled()) { Tr.debug(this, tc, "Path not deleted"); } } return deleteWorked; }
[ "private", "boolean", "deleteBundleCacheDir", "(", "File", "path", ")", "{", "final", "boolean", "trace", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "FileUtils", ".", "fileExists", "(", "path", ")", ")", "{", "if", "(", "trace", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Path specified exists: \"", "+", "path", ".", "getPath", "(", ")", ")", ";", "}", "}", "else", "{", "if", "(", "trace", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Path specified does not exist: \"", "+", "path", ".", "getPath", "(", ")", ")", ";", "}", "return", "true", ";", "}", "boolean", "deleteWorked", "=", "true", ";", "for", "(", "File", "file", ":", "FileUtils", ".", "listFiles", "(", "path", ")", ")", "{", "if", "(", "FileUtils", ".", "fileIsDirectory", "(", "file", ")", ")", "{", "if", "(", "trace", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Delete directory contents: \"", "+", "file", ".", "toString", "(", ")", ")", ";", "}", "deleteWorked", "&=", "deleteBundleCacheDir", "(", "file", ")", ";", "}", "else", "{", "if", "(", "trace", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Delete file: \"", "+", "file", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "!", "FileUtils", ".", "fileDelete", "(", "file", ")", ")", "{", "deleteWorked", "=", "false", ";", "if", "(", "trace", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Directory or file not deleted\"", ")", ";", "}", "}", "}", "}", "if", "(", "trace", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Delete path: \"", "+", "path", ")", ";", "}", "if", "(", "!", "FileUtils", ".", "fileDelete", "(", "path", ")", ")", "{", "deleteWorked", "=", "false", ";", "if", "(", "trace", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Path not deleted\"", ")", ";", "}", "}", "return", "deleteWorked", ";", "}" ]
Deletes the directory and its contents or the file that is specified @param path to cache directory to delete @return true if path was deleted or if it did not exist
[ "Deletes", "the", "directory", "and", "its", "contents", "or", "the", "file", "that", "is", "specified" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/ResourceAdapterService.java#L484-L527
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/UnifiedClassLoader.java
UnifiedClassLoader.addTransformer
@Override public boolean addTransformer(final ClassFileTransformer cft) { boolean added = false; for (ClassLoader loader : followOnClassLoaders) { if (loader instanceof SpringLoader) { added |= ((SpringLoader) loader).addTransformer(cft); } } return added; }
java
@Override public boolean addTransformer(final ClassFileTransformer cft) { boolean added = false; for (ClassLoader loader : followOnClassLoaders) { if (loader instanceof SpringLoader) { added |= ((SpringLoader) loader).addTransformer(cft); } } return added; }
[ "@", "Override", "public", "boolean", "addTransformer", "(", "final", "ClassFileTransformer", "cft", ")", "{", "boolean", "added", "=", "false", ";", "for", "(", "ClassLoader", "loader", ":", "followOnClassLoaders", ")", "{", "if", "(", "loader", "instanceof", "SpringLoader", ")", "{", "added", "|=", "(", "(", "SpringLoader", ")", "loader", ")", ".", "addTransformer", "(", "cft", ")", ";", "}", "}", "return", "added", ";", "}" ]
Spring to register the given ClassFileTransformer on this ClassLoader
[ "Spring", "to", "register", "the", "given", "ClassFileTransformer", "on", "this", "ClassLoader" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/UnifiedClassLoader.java#L45-L54
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/UnifiedClassLoader.java
UnifiedClassLoader.getThrowawayClassLoader
@Override public ClassLoader getThrowawayClassLoader() { ClassLoader newParent = getThrowawayVersion(getParent()); ClassLoader[] newFollowOns = new ClassLoader[followOnClassLoaders.size()]; for (int i = 0; i < newFollowOns.length; i++) { newFollowOns[i] = getThrowawayVersion(followOnClassLoaders.get(i)); } return new UnifiedClassLoader(newParent, newFollowOns); }
java
@Override public ClassLoader getThrowawayClassLoader() { ClassLoader newParent = getThrowawayVersion(getParent()); ClassLoader[] newFollowOns = new ClassLoader[followOnClassLoaders.size()]; for (int i = 0; i < newFollowOns.length; i++) { newFollowOns[i] = getThrowawayVersion(followOnClassLoaders.get(i)); } return new UnifiedClassLoader(newParent, newFollowOns); }
[ "@", "Override", "public", "ClassLoader", "getThrowawayClassLoader", "(", ")", "{", "ClassLoader", "newParent", "=", "getThrowawayVersion", "(", "getParent", "(", ")", ")", ";", "ClassLoader", "[", "]", "newFollowOns", "=", "new", "ClassLoader", "[", "followOnClassLoaders", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "newFollowOns", ".", "length", ";", "i", "++", ")", "{", "newFollowOns", "[", "i", "]", "=", "getThrowawayVersion", "(", "followOnClassLoaders", ".", "get", "(", "i", ")", ")", ";", "}", "return", "new", "UnifiedClassLoader", "(", "newParent", ",", "newFollowOns", ")", ";", "}" ]
Special method used by Spring to obtain a throwaway class loader for this ClassLoader
[ "Special", "method", "used", "by", "Spring", "to", "obtain", "a", "throwaway", "class", "loader", "for", "this", "ClassLoader" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/UnifiedClassLoader.java#L59-L67
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/logging/MyfacesLogger.java
MyfacesLogger.throwing
public void throwing( Level level, String sourceClass, String sourceMethod, Throwable thrown ) { logp(level, sourceClass, sourceMethod, null, thrown); }
java
public void throwing( Level level, String sourceClass, String sourceMethod, Throwable thrown ) { logp(level, sourceClass, sourceMethod, null, thrown); }
[ "public", "void", "throwing", "(", "Level", "level", ",", "String", "sourceClass", ",", "String", "sourceMethod", ",", "Throwable", "thrown", ")", "{", "logp", "(", "level", ",", "sourceClass", ",", "sourceMethod", ",", "null", ",", "thrown", ")", ";", "}" ]
Log throwing an exception. Comparing to Java Logging function Logger.throwing(sourceClass, sourceMethod, thrown) this function takes one more parameter "level" so that developers can specify the logging level of an exception. Developers should pass value for the "level" parameter using following convention, <p> Level.SEVERE -- Serious exceptions or error conditions such that an application can no longer run. <p> Level.WARNING -- Exceptions or errors that are not fatal, but an application will run with some problems. <p> @param level Java Logging level @param sourceClass name of class that issued the logging request @param sourceMethod name of the method @param thrown The Throwable that is being thrown
[ "Log", "throwing", "an", "exception", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/logging/MyfacesLogger.java#L937-L945
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/TransactionToDispatchableMap.java
TransactionToDispatchableMap.addDispatchableForLocalTransaction
public Dispatchable addDispatchableForLocalTransaction(int clientTransactionId) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "addDispatchableForLocalTransaction", "" + clientTransactionId); if (idToFirstLevelEntryMap.containsKey(clientTransactionId)) { final SIErrorException exception = new SIErrorException(CommsConstants.TRANTODISPATCHMAP_ADDDISPATCHLOCALTX_01); FFDCFilter.processException(exception, CLASS_NAME + ".addDispatchableForLocalTransaction", CommsConstants.TRANTODISPATCHMAP_ADDDISPATCHLOCALTX_01, new Object[] { "" + clientTransactionId, idToFirstLevelEntryMap, this }); if (tc.isEventEnabled()) SibTr.exception(this, tc, exception); throw exception; } LocalFirstLevelMapEntry entry = new LocalFirstLevelMapEntry(); Dispatchable result = entry.getDispatchable(); idToFirstLevelEntryMap.put(clientTransactionId, entry); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "addDispatchableForLocalTransaction", result); return result; }
java
public Dispatchable addDispatchableForLocalTransaction(int clientTransactionId) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "addDispatchableForLocalTransaction", "" + clientTransactionId); if (idToFirstLevelEntryMap.containsKey(clientTransactionId)) { final SIErrorException exception = new SIErrorException(CommsConstants.TRANTODISPATCHMAP_ADDDISPATCHLOCALTX_01); FFDCFilter.processException(exception, CLASS_NAME + ".addDispatchableForLocalTransaction", CommsConstants.TRANTODISPATCHMAP_ADDDISPATCHLOCALTX_01, new Object[] { "" + clientTransactionId, idToFirstLevelEntryMap, this }); if (tc.isEventEnabled()) SibTr.exception(this, tc, exception); throw exception; } LocalFirstLevelMapEntry entry = new LocalFirstLevelMapEntry(); Dispatchable result = entry.getDispatchable(); idToFirstLevelEntryMap.put(clientTransactionId, entry); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "addDispatchableForLocalTransaction", result); return result; }
[ "public", "Dispatchable", "addDispatchableForLocalTransaction", "(", "int", "clientTransactionId", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"addDispatchableForLocalTransaction\"", ",", "\"\"", "+", "clientTransactionId", ")", ";", "if", "(", "idToFirstLevelEntryMap", ".", "containsKey", "(", "clientTransactionId", ")", ")", "{", "final", "SIErrorException", "exception", "=", "new", "SIErrorException", "(", "CommsConstants", ".", "TRANTODISPATCHMAP_ADDDISPATCHLOCALTX_01", ")", ";", "FFDCFilter", ".", "processException", "(", "exception", ",", "CLASS_NAME", "+", "\".addDispatchableForLocalTransaction\"", ",", "CommsConstants", ".", "TRANTODISPATCHMAP_ADDDISPATCHLOCALTX_01", ",", "new", "Object", "[", "]", "{", "\"\"", "+", "clientTransactionId", ",", "idToFirstLevelEntryMap", ",", "this", "}", ")", ";", "if", "(", "tc", ".", "isEventEnabled", "(", ")", ")", "SibTr", ".", "exception", "(", "this", ",", "tc", ",", "exception", ")", ";", "throw", "exception", ";", "}", "LocalFirstLevelMapEntry", "entry", "=", "new", "LocalFirstLevelMapEntry", "(", ")", ";", "Dispatchable", "result", "=", "entry", ".", "getDispatchable", "(", ")", ";", "idToFirstLevelEntryMap", ".", "put", "(", "clientTransactionId", ",", "entry", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"addDispatchableForLocalTransaction\"", ",", "result", ")", ";", "return", "result", ";", "}" ]
Adds a dispatchable for use with a specific local transaction. Typically this is done by the done by the TCP channel thread when it determines it is about to pass the transmission relating to the start of a local transaction to the receive listener dispatcher. @param clientTransactionId Identifies the local transaction that the dispatchable will be used to dispatch work for. @return the dispatchable to use when ordering work for the local transaction. @see com.ibm.ws.sib.comms.server.clientsupport.ServerTransportReceiveListener#getThreadContext(Conversation, WsByteBuffer, int)
[ "Adds", "a", "dispatchable", "for", "use", "with", "a", "specific", "local", "transaction", ".", "Typically", "this", "is", "done", "by", "the", "done", "by", "the", "TCP", "channel", "thread", "when", "it", "determines", "it", "is", "about", "to", "pass", "the", "transmission", "relating", "to", "the", "start", "of", "a", "local", "transaction", "to", "the", "receive", "listener", "dispatcher", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/TransactionToDispatchableMap.java#L61-L79
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/TransactionToDispatchableMap.java
TransactionToDispatchableMap.addEnlistedDispatchableForGlobalTransaction
public Dispatchable addEnlistedDispatchableForGlobalTransaction(int clientXAResourceId, XidProxy xid) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "addEnlistedDispatchableForGlobalTransaction", new Object[] { "" + clientXAResourceId }); AbstractFirstLevelMapEntry firstLevelEntry = null; // Locate the first level map entry - if there is one. if (idToFirstLevelEntryMap.containsKey(clientXAResourceId)) { firstLevelEntry = (AbstractFirstLevelMapEntry) idToFirstLevelEntryMap.get(clientXAResourceId); } GlobalFirstLevelMapEntry entry = null; if (firstLevelEntry == null) { // If there is no first level map entry for this SIXAResource - create one entry = new GlobalFirstLevelMapEntry(); idToFirstLevelEntryMap.put(clientXAResourceId, entry); } else { // This SIXAResource has already particiapted in work - as there is already // an instance - check that it isn't for a local transaction (which would // indicate a programming error). if (firstLevelEntry.isLocalTransaction()) { final SIErrorException exception = new SIErrorException(CommsConstants.TRANTODISPATCHMAP_ADDENLISTEDGLOBALTX_01); FFDCFilter.processException(exception, CLASS_NAME + ".addEnlistedDispatchableForGlobalTransaction", CommsConstants.TRANTODISPATCHMAP_ADDENLISTEDGLOBALTX_01, new Object[] { "" + clientXAResourceId, idToFirstLevelEntryMap, this }); if (tc.isEventEnabled()) SibTr.exception(this, tc, exception); throw exception; } entry = (GlobalFirstLevelMapEntry) firstLevelEntry; } final Dispatchable result = entry.createNewEnlistedDispatchable(xid); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "addEnlistedDispatchableForGlobalTransaction", result); return result; }
java
public Dispatchable addEnlistedDispatchableForGlobalTransaction(int clientXAResourceId, XidProxy xid) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "addEnlistedDispatchableForGlobalTransaction", new Object[] { "" + clientXAResourceId }); AbstractFirstLevelMapEntry firstLevelEntry = null; // Locate the first level map entry - if there is one. if (idToFirstLevelEntryMap.containsKey(clientXAResourceId)) { firstLevelEntry = (AbstractFirstLevelMapEntry) idToFirstLevelEntryMap.get(clientXAResourceId); } GlobalFirstLevelMapEntry entry = null; if (firstLevelEntry == null) { // If there is no first level map entry for this SIXAResource - create one entry = new GlobalFirstLevelMapEntry(); idToFirstLevelEntryMap.put(clientXAResourceId, entry); } else { // This SIXAResource has already particiapted in work - as there is already // an instance - check that it isn't for a local transaction (which would // indicate a programming error). if (firstLevelEntry.isLocalTransaction()) { final SIErrorException exception = new SIErrorException(CommsConstants.TRANTODISPATCHMAP_ADDENLISTEDGLOBALTX_01); FFDCFilter.processException(exception, CLASS_NAME + ".addEnlistedDispatchableForGlobalTransaction", CommsConstants.TRANTODISPATCHMAP_ADDENLISTEDGLOBALTX_01, new Object[] { "" + clientXAResourceId, idToFirstLevelEntryMap, this }); if (tc.isEventEnabled()) SibTr.exception(this, tc, exception); throw exception; } entry = (GlobalFirstLevelMapEntry) firstLevelEntry; } final Dispatchable result = entry.createNewEnlistedDispatchable(xid); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "addEnlistedDispatchableForGlobalTransaction", result); return result; }
[ "public", "Dispatchable", "addEnlistedDispatchableForGlobalTransaction", "(", "int", "clientXAResourceId", ",", "XidProxy", "xid", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"addEnlistedDispatchableForGlobalTransaction\"", ",", "new", "Object", "[", "]", "{", "\"\"", "+", "clientXAResourceId", "}", ")", ";", "AbstractFirstLevelMapEntry", "firstLevelEntry", "=", "null", ";", "// Locate the first level map entry - if there is one.", "if", "(", "idToFirstLevelEntryMap", ".", "containsKey", "(", "clientXAResourceId", ")", ")", "{", "firstLevelEntry", "=", "(", "AbstractFirstLevelMapEntry", ")", "idToFirstLevelEntryMap", ".", "get", "(", "clientXAResourceId", ")", ";", "}", "GlobalFirstLevelMapEntry", "entry", "=", "null", ";", "if", "(", "firstLevelEntry", "==", "null", ")", "{", "// If there is no first level map entry for this SIXAResource - create one", "entry", "=", "new", "GlobalFirstLevelMapEntry", "(", ")", ";", "idToFirstLevelEntryMap", ".", "put", "(", "clientXAResourceId", ",", "entry", ")", ";", "}", "else", "{", "// This SIXAResource has already particiapted in work - as there is already", "// an instance - check that it isn't for a local transaction (which would", "// indicate a programming error).", "if", "(", "firstLevelEntry", ".", "isLocalTransaction", "(", ")", ")", "{", "final", "SIErrorException", "exception", "=", "new", "SIErrorException", "(", "CommsConstants", ".", "TRANTODISPATCHMAP_ADDENLISTEDGLOBALTX_01", ")", ";", "FFDCFilter", ".", "processException", "(", "exception", ",", "CLASS_NAME", "+", "\".addEnlistedDispatchableForGlobalTransaction\"", ",", "CommsConstants", ".", "TRANTODISPATCHMAP_ADDENLISTEDGLOBALTX_01", ",", "new", "Object", "[", "]", "{", "\"\"", "+", "clientXAResourceId", ",", "idToFirstLevelEntryMap", ",", "this", "}", ")", ";", "if", "(", "tc", ".", "isEventEnabled", "(", ")", ")", "SibTr", ".", "exception", "(", "this", ",", "tc", ",", "exception", ")", ";", "throw", "exception", ";", "}", "entry", "=", "(", "GlobalFirstLevelMapEntry", ")", "firstLevelEntry", ";", "}", "final", "Dispatchable", "result", "=", "entry", ".", "createNewEnlistedDispatchable", "(", "xid", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"addEnlistedDispatchableForGlobalTransaction\"", ",", "result", ")", ";", "return", "result", ";", "}" ]
Adds a dispatchable for use with a specific SIXAResource, which is currently enlisted in a global transaction. Typically this is done by the TCP channel thread when it determines that it is about to pass the transmission relating to the XA_START of enlistment into a global transaction to the receive listener dispatcher. @param clientXAResourceId Identifies the SIXAResource that the dispatchable will be used to dispatch work for. @return the dispatchable to use when ordering work for this unit of work being performed in the scope of a global transaction. @see com.ibm.ws.sib.comms.server.clientsupport.ServerTransportReceiveListener#getThreadContext(Conversation, WsByteBuffer, int)
[ "Adds", "a", "dispatchable", "for", "use", "with", "a", "specific", "SIXAResource", "which", "is", "currently", "enlisted", "in", "a", "global", "transaction", ".", "Typically", "this", "is", "done", "by", "the", "TCP", "channel", "thread", "when", "it", "determines", "that", "it", "is", "about", "to", "pass", "the", "transmission", "relating", "to", "the", "XA_START", "of", "enlistment", "into", "a", "global", "transaction", "to", "the", "receive", "listener", "dispatcher", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/TransactionToDispatchableMap.java#L94-L130
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/TransactionToDispatchableMap.java
TransactionToDispatchableMap.getDispatchable
public Dispatchable getDispatchable(int clientId) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getDispatchable", "" + clientId); AbstractFirstLevelMapEntry firstLevelEntry = null; if (idToFirstLevelEntryMap.containsKey(clientId)) { firstLevelEntry = (AbstractFirstLevelMapEntry) idToFirstLevelEntryMap.get(clientId); } final Dispatchable result; if (firstLevelEntry == null) { result = null; } else if (firstLevelEntry.isLocalTransaction()) { result = ((LocalFirstLevelMapEntry) firstLevelEntry).getDispatchable(); } else { result = ((GlobalFirstLevelMapEntry) firstLevelEntry).getEnlistedDispatchable(); } if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getDispatchable", result); return result; }
java
public Dispatchable getDispatchable(int clientId) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getDispatchable", "" + clientId); AbstractFirstLevelMapEntry firstLevelEntry = null; if (idToFirstLevelEntryMap.containsKey(clientId)) { firstLevelEntry = (AbstractFirstLevelMapEntry) idToFirstLevelEntryMap.get(clientId); } final Dispatchable result; if (firstLevelEntry == null) { result = null; } else if (firstLevelEntry.isLocalTransaction()) { result = ((LocalFirstLevelMapEntry) firstLevelEntry).getDispatchable(); } else { result = ((GlobalFirstLevelMapEntry) firstLevelEntry).getEnlistedDispatchable(); } if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getDispatchable", result); return result; }
[ "public", "Dispatchable", "getDispatchable", "(", "int", "clientId", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"getDispatchable\"", ",", "\"\"", "+", "clientId", ")", ";", "AbstractFirstLevelMapEntry", "firstLevelEntry", "=", "null", ";", "if", "(", "idToFirstLevelEntryMap", ".", "containsKey", "(", "clientId", ")", ")", "{", "firstLevelEntry", "=", "(", "AbstractFirstLevelMapEntry", ")", "idToFirstLevelEntryMap", ".", "get", "(", "clientId", ")", ";", "}", "final", "Dispatchable", "result", ";", "if", "(", "firstLevelEntry", "==", "null", ")", "{", "result", "=", "null", ";", "}", "else", "if", "(", "firstLevelEntry", ".", "isLocalTransaction", "(", ")", ")", "{", "result", "=", "(", "(", "LocalFirstLevelMapEntry", ")", "firstLevelEntry", ")", ".", "getDispatchable", "(", ")", ";", "}", "else", "{", "result", "=", "(", "(", "GlobalFirstLevelMapEntry", ")", "firstLevelEntry", ")", ".", "getEnlistedDispatchable", "(", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"getDispatchable\"", ",", "result", ")", ";", "return", "result", ";", "}" ]
Obtains a dispatchable for the specified client side transaction ID. The dispatchable returned will either correspond to an in-flight local transaction or an inflight enlisted SIXAResource. If there is no corresponding dispatchable in the table the a value of null is returned. @param clientId the client id to obtain a dispatchable for @return the dispatchable.
[ "Obtains", "a", "dispatchable", "for", "the", "specified", "client", "side", "transaction", "ID", ".", "The", "dispatchable", "returned", "will", "either", "correspond", "to", "an", "in", "-", "flight", "local", "transaction", "or", "an", "inflight", "enlisted", "SIXAResource", ".", "If", "there", "is", "no", "corresponding", "dispatchable", "in", "the", "table", "the", "a", "value", "of", "null", "is", "returned", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/TransactionToDispatchableMap.java#L141-L162
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/TransactionToDispatchableMap.java
TransactionToDispatchableMap.removeDispatchableForLocalTransaction
public Dispatchable removeDispatchableForLocalTransaction(int clientId) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "removeDispatchableForLocalTransaction", "" + clientId); AbstractFirstLevelMapEntry firstLevelEntry = null; if (idToFirstLevelEntryMap.containsKey(clientId)) { firstLevelEntry = (AbstractFirstLevelMapEntry) idToFirstLevelEntryMap.get(clientId); } final Dispatchable result; if (firstLevelEntry == null) { result = null; } else { if (firstLevelEntry.isLocalTransaction()) { result = ((LocalFirstLevelMapEntry) firstLevelEntry).getDispatchable(); idToFirstLevelEntryMap.remove(clientId); } else { final SIErrorException exception = new SIErrorException(CommsConstants.TRANTODISPATCHMAP_REMOVEFORLOCALTX_01); FFDCFilter.processException(exception, CLASS_NAME + ".removeDispatchableForLocalTransaction", CommsConstants.TRANTODISPATCHMAP_REMOVEFORLOCALTX_01, new Object[] { "" + clientId, firstLevelEntry, idToFirstLevelEntryMap, this }); if (tc.isEventEnabled()) SibTr.exception(this, tc, exception); throw exception; } } if (tc.isEntryEnabled()) SibTr.exit(this, tc, "removeDispatchableForLocalTransaction", result); return result; }
java
public Dispatchable removeDispatchableForLocalTransaction(int clientId) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "removeDispatchableForLocalTransaction", "" + clientId); AbstractFirstLevelMapEntry firstLevelEntry = null; if (idToFirstLevelEntryMap.containsKey(clientId)) { firstLevelEntry = (AbstractFirstLevelMapEntry) idToFirstLevelEntryMap.get(clientId); } final Dispatchable result; if (firstLevelEntry == null) { result = null; } else { if (firstLevelEntry.isLocalTransaction()) { result = ((LocalFirstLevelMapEntry) firstLevelEntry).getDispatchable(); idToFirstLevelEntryMap.remove(clientId); } else { final SIErrorException exception = new SIErrorException(CommsConstants.TRANTODISPATCHMAP_REMOVEFORLOCALTX_01); FFDCFilter.processException(exception, CLASS_NAME + ".removeDispatchableForLocalTransaction", CommsConstants.TRANTODISPATCHMAP_REMOVEFORLOCALTX_01, new Object[] { "" + clientId, firstLevelEntry, idToFirstLevelEntryMap, this }); if (tc.isEventEnabled()) SibTr.exception(this, tc, exception); throw exception; } } if (tc.isEntryEnabled()) SibTr.exit(this, tc, "removeDispatchableForLocalTransaction", result); return result; }
[ "public", "Dispatchable", "removeDispatchableForLocalTransaction", "(", "int", "clientId", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"removeDispatchableForLocalTransaction\"", ",", "\"\"", "+", "clientId", ")", ";", "AbstractFirstLevelMapEntry", "firstLevelEntry", "=", "null", ";", "if", "(", "idToFirstLevelEntryMap", ".", "containsKey", "(", "clientId", ")", ")", "{", "firstLevelEntry", "=", "(", "AbstractFirstLevelMapEntry", ")", "idToFirstLevelEntryMap", ".", "get", "(", "clientId", ")", ";", "}", "final", "Dispatchable", "result", ";", "if", "(", "firstLevelEntry", "==", "null", ")", "{", "result", "=", "null", ";", "}", "else", "{", "if", "(", "firstLevelEntry", ".", "isLocalTransaction", "(", ")", ")", "{", "result", "=", "(", "(", "LocalFirstLevelMapEntry", ")", "firstLevelEntry", ")", ".", "getDispatchable", "(", ")", ";", "idToFirstLevelEntryMap", ".", "remove", "(", "clientId", ")", ";", "}", "else", "{", "final", "SIErrorException", "exception", "=", "new", "SIErrorException", "(", "CommsConstants", ".", "TRANTODISPATCHMAP_REMOVEFORLOCALTX_01", ")", ";", "FFDCFilter", ".", "processException", "(", "exception", ",", "CLASS_NAME", "+", "\".removeDispatchableForLocalTransaction\"", ",", "CommsConstants", ".", "TRANTODISPATCHMAP_REMOVEFORLOCALTX_01", ",", "new", "Object", "[", "]", "{", "\"\"", "+", "clientId", ",", "firstLevelEntry", ",", "idToFirstLevelEntryMap", ",", "this", "}", ")", ";", "if", "(", "tc", ".", "isEventEnabled", "(", ")", ")", "SibTr", ".", "exception", "(", "this", ",", "tc", ",", "exception", ")", ";", "throw", "exception", ";", "}", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"removeDispatchableForLocalTransaction\"", ",", "result", ")", ";", "return", "result", ";", "}" ]
Removes, from the table, the dispatchable corresponding to a local transaction. @param clientId The client transaction id corresponding to the dispatchable to remove @return the removed dispatchable or null if no entry could be found for the specified clientId parameter.
[ "Removes", "from", "the", "table", "the", "dispatchable", "corresponding", "to", "a", "local", "transaction", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/TransactionToDispatchableMap.java#L172-L201
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/TransactionToDispatchableMap.java
TransactionToDispatchableMap.removeAllDispatchablesForTransaction
public void removeAllDispatchablesForTransaction(int clientId) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "removeAllDispatchablesForTransaction", clientId); idToFirstLevelEntryMap.remove(clientId); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "removeAllDispatchablesForTransaction"); }
java
public void removeAllDispatchablesForTransaction(int clientId) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "removeAllDispatchablesForTransaction", clientId); idToFirstLevelEntryMap.remove(clientId); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "removeAllDispatchablesForTransaction"); }
[ "public", "void", "removeAllDispatchablesForTransaction", "(", "int", "clientId", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"removeAllDispatchablesForTransaction\"", ",", "clientId", ")", ";", "idToFirstLevelEntryMap", ".", "remove", "(", "clientId", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"removeAllDispatchablesForTransaction\"", ")", ";", "}" ]
In the event that the connection is going down, we need to ensure that the dispatchable table is cleared of all references to transactions that were created by that connection. @param clientId
[ "In", "the", "event", "that", "the", "connection", "is", "going", "down", "we", "need", "to", "ensure", "that", "the", "dispatchable", "table", "is", "cleared", "of", "all", "references", "to", "transactions", "that", "were", "created", "by", "that", "connection", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/TransactionToDispatchableMap.java#L209-L217
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/TransactionToDispatchableMap.java
TransactionToDispatchableMap.addDispatchableForOptimizedLocalTransaction
public Dispatchable addDispatchableForOptimizedLocalTransaction(int transactionId) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "addDispatchableForOptimizedLocalTransaction", "" + transactionId); final Dispatchable result = addDispatchableForLocalTransaction(transactionId); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "addDispatchableForOptimizedLocalTransaction", result); return result; }
java
public Dispatchable addDispatchableForOptimizedLocalTransaction(int transactionId) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "addDispatchableForOptimizedLocalTransaction", "" + transactionId); final Dispatchable result = addDispatchableForLocalTransaction(transactionId); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "addDispatchableForOptimizedLocalTransaction", result); return result; }
[ "public", "Dispatchable", "addDispatchableForOptimizedLocalTransaction", "(", "int", "transactionId", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"addDispatchableForOptimizedLocalTransaction\"", ",", "\"\"", "+", "transactionId", ")", ";", "final", "Dispatchable", "result", "=", "addDispatchableForLocalTransaction", "(", "transactionId", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"addDispatchableForOptimizedLocalTransaction\"", ",", "result", ")", ";", "return", "result", ";", "}" ]
Adds a new dispatchable to the map for an optimized local transaction. @param transactionId @return
[ "Adds", "a", "new", "dispatchable", "to", "the", "map", "for", "an", "optimized", "local", "transaction", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/TransactionToDispatchableMap.java#L272-L279
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/TransactionToDispatchableMap.java
TransactionToDispatchableMap.getTotalDispatchables
public int getTotalDispatchables() { int count = 0; Iterator i = idToFirstLevelEntryMap.iterator(); while (i.hasNext()) ++count; return count; }
java
public int getTotalDispatchables() { int count = 0; Iterator i = idToFirstLevelEntryMap.iterator(); while (i.hasNext()) ++count; return count; }
[ "public", "int", "getTotalDispatchables", "(", ")", "{", "int", "count", "=", "0", ";", "Iterator", "i", "=", "idToFirstLevelEntryMap", ".", "iterator", "(", ")", ";", "while", "(", "i", ".", "hasNext", "(", ")", ")", "++", "count", ";", "return", "count", ";", "}" ]
For unit test use only! @return the total number of dispatchables currently held within the table.
[ "For", "unit", "test", "use", "only!" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/TransactionToDispatchableMap.java#L435-L441
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java
RepositoryResourceImpl.createNewResource
@SuppressWarnings("unchecked") protected <T extends RepositoryResourceImpl> T createNewResource() { T result; if (null == getType()) { result = (T) createTestResource(getRepositoryConnection()); } else { result = ResourceFactory.getInstance().createResource(getType(), getRepositoryConnection(), null); } return result; }
java
@SuppressWarnings("unchecked") protected <T extends RepositoryResourceImpl> T createNewResource() { T result; if (null == getType()) { result = (T) createTestResource(getRepositoryConnection()); } else { result = ResourceFactory.getInstance().createResource(getType(), getRepositoryConnection(), null); } return result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "<", "T", "extends", "RepositoryResourceImpl", ">", "T", "createNewResource", "(", ")", "{", "T", "result", ";", "if", "(", "null", "==", "getType", "(", ")", ")", "{", "result", "=", "(", "T", ")", "createTestResource", "(", "getRepositoryConnection", "(", ")", ")", ";", "}", "else", "{", "result", "=", "ResourceFactory", ".", "getInstance", "(", ")", ".", "createResource", "(", "getType", "(", ")", ",", "getRepositoryConnection", "(", ")", ",", "null", ")", ";", "}", "return", "result", ";", "}" ]
Creates a new resource using the same logon infomation as this resource @param <T> @return
[ "Creates", "a", "new", "resource", "using", "the", "same", "logon", "infomation", "as", "this", "resource" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java#L207-L217
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java
RepositoryResourceImpl.matches
public MatchResult matches(ProductDefinition def) { Collection<AppliesToFilterInfo> atfiList = _asset.getWlpInformation().getAppliesToFilterInfo(); if (atfiList == null || atfiList.isEmpty()) { return MatchResult.NOT_APPLICABLE; } MatchResult matchResult = MatchResult.MATCHED; for (AppliesToFilterInfo atfi : atfiList) { if (!!!atfi.getProductId().equals(def.getId())) { // This one isn't applicable, maybe the next one is matchResult = MatchResult.NOT_APPLICABLE; continue; } else { if (def.getVersion() != null && !def.getVersion().isEmpty()) { Version checkVersion = new Version(def.getVersion()); VersionRange vr = FilterVersion.getFilterRange(atfi.getMinVersion(), atfi.getMaxVersion()); if (!vr.includes(checkVersion)) { return MatchResult.INVALID_VERSION; } } if (atfi.getRawEditions() != null && !!!atfi.getRawEditions().isEmpty() && !!!atfi.getRawEditions().contains(def.getEdition())) { return MatchResult.INVALID_EDITION; } if (atfi.getInstallType() != null && !!!atfi.getInstallType().equals(def.getInstallType())) { return MatchResult.INVALID_INSTALL_TYPE; } // Got here so this must have been a match, only need one of the array to match, not all return MatchResult.MATCHED; } } return matchResult; }
java
public MatchResult matches(ProductDefinition def) { Collection<AppliesToFilterInfo> atfiList = _asset.getWlpInformation().getAppliesToFilterInfo(); if (atfiList == null || atfiList.isEmpty()) { return MatchResult.NOT_APPLICABLE; } MatchResult matchResult = MatchResult.MATCHED; for (AppliesToFilterInfo atfi : atfiList) { if (!!!atfi.getProductId().equals(def.getId())) { // This one isn't applicable, maybe the next one is matchResult = MatchResult.NOT_APPLICABLE; continue; } else { if (def.getVersion() != null && !def.getVersion().isEmpty()) { Version checkVersion = new Version(def.getVersion()); VersionRange vr = FilterVersion.getFilterRange(atfi.getMinVersion(), atfi.getMaxVersion()); if (!vr.includes(checkVersion)) { return MatchResult.INVALID_VERSION; } } if (atfi.getRawEditions() != null && !!!atfi.getRawEditions().isEmpty() && !!!atfi.getRawEditions().contains(def.getEdition())) { return MatchResult.INVALID_EDITION; } if (atfi.getInstallType() != null && !!!atfi.getInstallType().equals(def.getInstallType())) { return MatchResult.INVALID_INSTALL_TYPE; } // Got here so this must have been a match, only need one of the array to match, not all return MatchResult.MATCHED; } } return matchResult; }
[ "public", "MatchResult", "matches", "(", "ProductDefinition", "def", ")", "{", "Collection", "<", "AppliesToFilterInfo", ">", "atfiList", "=", "_asset", ".", "getWlpInformation", "(", ")", ".", "getAppliesToFilterInfo", "(", ")", ";", "if", "(", "atfiList", "==", "null", "||", "atfiList", ".", "isEmpty", "(", ")", ")", "{", "return", "MatchResult", ".", "NOT_APPLICABLE", ";", "}", "MatchResult", "matchResult", "=", "MatchResult", ".", "MATCHED", ";", "for", "(", "AppliesToFilterInfo", "atfi", ":", "atfiList", ")", "{", "if", "(", "!", "!", "!", "atfi", ".", "getProductId", "(", ")", ".", "equals", "(", "def", ".", "getId", "(", ")", ")", ")", "{", "// This one isn't applicable, maybe the next one is", "matchResult", "=", "MatchResult", ".", "NOT_APPLICABLE", ";", "continue", ";", "}", "else", "{", "if", "(", "def", ".", "getVersion", "(", ")", "!=", "null", "&&", "!", "def", ".", "getVersion", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "Version", "checkVersion", "=", "new", "Version", "(", "def", ".", "getVersion", "(", ")", ")", ";", "VersionRange", "vr", "=", "FilterVersion", ".", "getFilterRange", "(", "atfi", ".", "getMinVersion", "(", ")", ",", "atfi", ".", "getMaxVersion", "(", ")", ")", ";", "if", "(", "!", "vr", ".", "includes", "(", "checkVersion", ")", ")", "{", "return", "MatchResult", ".", "INVALID_VERSION", ";", "}", "}", "if", "(", "atfi", ".", "getRawEditions", "(", ")", "!=", "null", "&&", "!", "!", "!", "atfi", ".", "getRawEditions", "(", ")", ".", "isEmpty", "(", ")", "&&", "!", "!", "!", "atfi", ".", "getRawEditions", "(", ")", ".", "contains", "(", "def", ".", "getEdition", "(", ")", ")", ")", "{", "return", "MatchResult", ".", "INVALID_EDITION", ";", "}", "if", "(", "atfi", ".", "getInstallType", "(", ")", "!=", "null", "&&", "!", "!", "!", "atfi", ".", "getInstallType", "(", ")", ".", "equals", "(", "def", ".", "getInstallType", "(", ")", ")", ")", "{", "return", "MatchResult", ".", "INVALID_INSTALL_TYPE", ";", "}", "// Got here so this must have been a match, only need one of the array to match, not all", "return", "MatchResult", ".", "MATCHED", ";", "}", "}", "return", "matchResult", ";", "}" ]
Check if this resources matches the supplied product definition @param def The product definition to check against @return A {@link MatchResult} that says whether the resource matches the product definition, and if not the reason why the match failed.
[ "Check", "if", "this", "resources", "matches", "the", "supplied", "product", "definition" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java#L245-L280
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java
RepositoryResourceImpl.readAttachmentsFromAsset
private synchronized void readAttachmentsFromAsset(Asset ass) { Collection<Attachment> attachments = ass.getAttachments(); _attachments = new HashMap<String, AttachmentResourceImpl>(); if (attachments != null) { for (Attachment at : attachments) { _attachments.put(at.getName(), new AttachmentResourceImpl(at)); if (at.getType() == AttachmentType.CONTENT) { _contentAttached = true; } } } }
java
private synchronized void readAttachmentsFromAsset(Asset ass) { Collection<Attachment> attachments = ass.getAttachments(); _attachments = new HashMap<String, AttachmentResourceImpl>(); if (attachments != null) { for (Attachment at : attachments) { _attachments.put(at.getName(), new AttachmentResourceImpl(at)); if (at.getType() == AttachmentType.CONTENT) { _contentAttached = true; } } } }
[ "private", "synchronized", "void", "readAttachmentsFromAsset", "(", "Asset", "ass", ")", "{", "Collection", "<", "Attachment", ">", "attachments", "=", "ass", ".", "getAttachments", "(", ")", ";", "_attachments", "=", "new", "HashMap", "<", "String", ",", "AttachmentResourceImpl", ">", "(", ")", ";", "if", "(", "attachments", "!=", "null", ")", "{", "for", "(", "Attachment", "at", ":", "attachments", ")", "{", "_attachments", ".", "put", "(", "at", ".", "getName", "(", ")", ",", "new", "AttachmentResourceImpl", "(", "at", ")", ")", ";", "if", "(", "at", ".", "getType", "(", ")", "==", "AttachmentType", ".", "CONTENT", ")", "{", "_contentAttached", "=", "true", ";", "}", "}", "}", "}" ]
Read the attachments from the supplied asset and create an AttachmentResource to represent them and then store them in our AttachmentResource list @param ass @throws RepositoryBackenAttachment
[ "Read", "the", "attachments", "from", "the", "supplied", "asset", "and", "create", "an", "AttachmentResource", "to", "represent", "them", "and", "then", "store", "them", "in", "our", "AttachmentResource", "list" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java#L298-L312
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java
RepositoryResourceImpl.updateRequired
public UpdateType updateRequired(RepositoryResourceImpl matching) { if (null == matching) { // No matching asset found return UpdateType.ADD; } if (equivalentWithoutAttachments(matching)) { return UpdateType.NOTHING; } else { // As we are doing an update set our id to be the one we found in massive // Not needed now, we are merging both assets _asset.set_id(matching.getId()); return UpdateType.UPDATE; } }
java
public UpdateType updateRequired(RepositoryResourceImpl matching) { if (null == matching) { // No matching asset found return UpdateType.ADD; } if (equivalentWithoutAttachments(matching)) { return UpdateType.NOTHING; } else { // As we are doing an update set our id to be the one we found in massive // Not needed now, we are merging both assets _asset.set_id(matching.getId()); return UpdateType.UPDATE; } }
[ "public", "UpdateType", "updateRequired", "(", "RepositoryResourceImpl", "matching", ")", "{", "if", "(", "null", "==", "matching", ")", "{", "// No matching asset found", "return", "UpdateType", ".", "ADD", ";", "}", "if", "(", "equivalentWithoutAttachments", "(", "matching", ")", ")", "{", "return", "UpdateType", ".", "NOTHING", ";", "}", "else", "{", "// As we are doing an update set our id to be the one we found in massive", "// Not needed now, we are merging both assets", "_asset", ".", "set_id", "(", "matching", ".", "getId", "(", ")", ")", ";", "return", "UpdateType", ".", "UPDATE", ";", "}", "}" ]
Decide whether an attachment needs updating. @return boolean - whether the attachment needs updating
[ "Decide", "whether", "an", "attachment", "needs", "updating", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java#L924-L939
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java
RepositoryResourceImpl.createMatchingData
public RepositoryResourceMatchingData createMatchingData() { RepositoryResourceMatchingData matchingData = new RepositoryResourceMatchingData(); matchingData.setName(getName()); matchingData.setProviderName(getProviderName()); matchingData.setType(getType()); return matchingData; }
java
public RepositoryResourceMatchingData createMatchingData() { RepositoryResourceMatchingData matchingData = new RepositoryResourceMatchingData(); matchingData.setName(getName()); matchingData.setProviderName(getProviderName()); matchingData.setType(getType()); return matchingData; }
[ "public", "RepositoryResourceMatchingData", "createMatchingData", "(", ")", "{", "RepositoryResourceMatchingData", "matchingData", "=", "new", "RepositoryResourceMatchingData", "(", ")", ";", "matchingData", ".", "setName", "(", "getName", "(", ")", ")", ";", "matchingData", ".", "setProviderName", "(", "getProviderName", "(", ")", ")", ";", "matchingData", ".", "setType", "(", "getType", "(", ")", ")", ";", "return", "matchingData", ";", "}" ]
Creates an object which can be used to compare with another resource's to determine if they represent the same asset. @return
[ "Creates", "an", "object", "which", "can", "be", "used", "to", "compare", "with", "another", "resource", "s", "to", "determine", "if", "they", "represent", "the", "same", "asset", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java#L947-L953
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java
RepositoryResourceImpl.findMatchingResource
public List<RepositoryResourceImpl> findMatchingResource() throws RepositoryResourceValidationException, RepositoryBackendException, RepositoryBadDataException, RepositoryResourceNoConnectionException { List<RepositoryResourceImpl> matchingRes; try { matchingRes = performMatching(); if (matchingRes != null && matchingRes.size() > 1) { StringBuilder warningMessage = new StringBuilder("More than one match found for " + getName() + ":"); for (RepositoryResourceImpl massiveResource : matchingRes) { warningMessage.append("\n\t" + massiveResource.getName() + " (" + massiveResource.getId() + ")"); } logger.warning(warningMessage.toString()); } } catch (BadVersionException bvx) { throw new RepositoryBadDataException("BadDataException accessing asset", getId(), bvx); } catch (RequestFailureException bfe) { throw new RepositoryBackendRequestFailureException(bfe, getRepositoryConnection()); } return matchingRes; }
java
public List<RepositoryResourceImpl> findMatchingResource() throws RepositoryResourceValidationException, RepositoryBackendException, RepositoryBadDataException, RepositoryResourceNoConnectionException { List<RepositoryResourceImpl> matchingRes; try { matchingRes = performMatching(); if (matchingRes != null && matchingRes.size() > 1) { StringBuilder warningMessage = new StringBuilder("More than one match found for " + getName() + ":"); for (RepositoryResourceImpl massiveResource : matchingRes) { warningMessage.append("\n\t" + massiveResource.getName() + " (" + massiveResource.getId() + ")"); } logger.warning(warningMessage.toString()); } } catch (BadVersionException bvx) { throw new RepositoryBadDataException("BadDataException accessing asset", getId(), bvx); } catch (RequestFailureException bfe) { throw new RepositoryBackendRequestFailureException(bfe, getRepositoryConnection()); } return matchingRes; }
[ "public", "List", "<", "RepositoryResourceImpl", ">", "findMatchingResource", "(", ")", "throws", "RepositoryResourceValidationException", ",", "RepositoryBackendException", ",", "RepositoryBadDataException", ",", "RepositoryResourceNoConnectionException", "{", "List", "<", "RepositoryResourceImpl", ">", "matchingRes", ";", "try", "{", "matchingRes", "=", "performMatching", "(", ")", ";", "if", "(", "matchingRes", "!=", "null", "&&", "matchingRes", ".", "size", "(", ")", ">", "1", ")", "{", "StringBuilder", "warningMessage", "=", "new", "StringBuilder", "(", "\"More than one match found for \"", "+", "getName", "(", ")", "+", "\":\"", ")", ";", "for", "(", "RepositoryResourceImpl", "massiveResource", ":", "matchingRes", ")", "{", "warningMessage", ".", "append", "(", "\"\\n\\t\"", "+", "massiveResource", ".", "getName", "(", ")", "+", "\" (\"", "+", "massiveResource", ".", "getId", "(", ")", "+", "\")\"", ")", ";", "}", "logger", ".", "warning", "(", "warningMessage", ".", "toString", "(", ")", ")", ";", "}", "}", "catch", "(", "BadVersionException", "bvx", ")", "{", "throw", "new", "RepositoryBadDataException", "(", "\"BadDataException accessing asset\"", ",", "getId", "(", ")", ",", "bvx", ")", ";", "}", "catch", "(", "RequestFailureException", "bfe", ")", "{", "throw", "new", "RepositoryBackendRequestFailureException", "(", "bfe", ",", "getRepositoryConnection", "(", ")", ")", ";", "}", "return", "matchingRes", ";", "}" ]
This method tries to find out if there is a match for "this" resource already in massive. @return A list of resources that were found in massive which has the same name, provider and type as this resource, an empty list otherwise. @throws RepositoryResourceValidationException If the resource fails a validation check @throws RepositoryBackendException If there was a problem talking to the backend @throws RepositoryResourceNoConnectionException If no connection has been specified
[ "This", "method", "tries", "to", "find", "out", "if", "there", "is", "a", "match", "for", "this", "resource", "already", "in", "massive", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java#L1028-L1045
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java
RepositoryResourceImpl.copyFieldsFrom
protected void copyFieldsFrom(RepositoryResourceImpl fromResource, boolean includeAttachmentInfo) { setName(fromResource.getName()); // part of the identification so locked setDescription(fromResource.getDescription()); setShortDescription(fromResource.getShortDescription()); setProviderName(fromResource.getProviderName()); // part of the identification so locked setProviderUrl(fromResource.getProviderUrl()); setVersion(fromResource.getVersion()); setDownloadPolicy(fromResource.getDownloadPolicy()); setLicenseId(fromResource.getLicenseId()); setLicenseType(fromResource.getLicenseType()); setMainAttachmentSize(fromResource.getMainAttachmentSize()); setMainAttachmentSHA256(fromResource.getMainAttachmentSHA256()); setFeaturedWeight(fromResource.getFeaturedWeight()); setDisplayPolicy(fromResource.getDisplayPolicy()); setVanityURL(fromResource.getVanityURL()); setWlpInformationVersion(fromResource.getWlpInformationVersion()); setMavenCoordinates(fromResource.getMavenCoordinates()); if (includeAttachmentInfo) { setMainAttachmentSize(fromResource.getMainAttachmentSize()); } _asset.getWlpInformation().setAppliesToFilterInfo(fromResource.getAsset().getWlpInformation().getAppliesToFilterInfo()); }
java
protected void copyFieldsFrom(RepositoryResourceImpl fromResource, boolean includeAttachmentInfo) { setName(fromResource.getName()); // part of the identification so locked setDescription(fromResource.getDescription()); setShortDescription(fromResource.getShortDescription()); setProviderName(fromResource.getProviderName()); // part of the identification so locked setProviderUrl(fromResource.getProviderUrl()); setVersion(fromResource.getVersion()); setDownloadPolicy(fromResource.getDownloadPolicy()); setLicenseId(fromResource.getLicenseId()); setLicenseType(fromResource.getLicenseType()); setMainAttachmentSize(fromResource.getMainAttachmentSize()); setMainAttachmentSHA256(fromResource.getMainAttachmentSHA256()); setFeaturedWeight(fromResource.getFeaturedWeight()); setDisplayPolicy(fromResource.getDisplayPolicy()); setVanityURL(fromResource.getVanityURL()); setWlpInformationVersion(fromResource.getWlpInformationVersion()); setMavenCoordinates(fromResource.getMavenCoordinates()); if (includeAttachmentInfo) { setMainAttachmentSize(fromResource.getMainAttachmentSize()); } _asset.getWlpInformation().setAppliesToFilterInfo(fromResource.getAsset().getWlpInformation().getAppliesToFilterInfo()); }
[ "protected", "void", "copyFieldsFrom", "(", "RepositoryResourceImpl", "fromResource", ",", "boolean", "includeAttachmentInfo", ")", "{", "setName", "(", "fromResource", ".", "getName", "(", ")", ")", ";", "// part of the identification so locked", "setDescription", "(", "fromResource", ".", "getDescription", "(", ")", ")", ";", "setShortDescription", "(", "fromResource", ".", "getShortDescription", "(", ")", ")", ";", "setProviderName", "(", "fromResource", ".", "getProviderName", "(", ")", ")", ";", "// part of the identification so locked", "setProviderUrl", "(", "fromResource", ".", "getProviderUrl", "(", ")", ")", ";", "setVersion", "(", "fromResource", ".", "getVersion", "(", ")", ")", ";", "setDownloadPolicy", "(", "fromResource", ".", "getDownloadPolicy", "(", ")", ")", ";", "setLicenseId", "(", "fromResource", ".", "getLicenseId", "(", ")", ")", ";", "setLicenseType", "(", "fromResource", ".", "getLicenseType", "(", ")", ")", ";", "setMainAttachmentSize", "(", "fromResource", ".", "getMainAttachmentSize", "(", ")", ")", ";", "setMainAttachmentSHA256", "(", "fromResource", ".", "getMainAttachmentSHA256", "(", ")", ")", ";", "setFeaturedWeight", "(", "fromResource", ".", "getFeaturedWeight", "(", ")", ")", ";", "setDisplayPolicy", "(", "fromResource", ".", "getDisplayPolicy", "(", ")", ")", ";", "setVanityURL", "(", "fromResource", ".", "getVanityURL", "(", ")", ")", ";", "setWlpInformationVersion", "(", "fromResource", ".", "getWlpInformationVersion", "(", ")", ")", ";", "setMavenCoordinates", "(", "fromResource", ".", "getMavenCoordinates", "(", ")", ")", ";", "if", "(", "includeAttachmentInfo", ")", "{", "setMainAttachmentSize", "(", "fromResource", ".", "getMainAttachmentSize", "(", ")", ")", ";", "}", "_asset", ".", "getWlpInformation", "(", ")", ".", "setAppliesToFilterInfo", "(", "fromResource", ".", "getAsset", "(", ")", ".", "getWlpInformation", "(", ")", ".", "getAppliesToFilterInfo", "(", ")", ")", ";", "}" ]
Resources should override this method to copy fields that should be used as part of an update @param fromResource
[ "Resources", "should", "override", "this", "method", "to", "copy", "fields", "that", "should", "be", "used", "as", "part", "of", "an", "update" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java#L1053-L1075
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java
RepositoryResourceImpl.overWriteAssetData
public void overWriteAssetData(RepositoryResourceImpl fromResource, boolean includeAttachmentInfo) throws RepositoryResourceValidationException { // Make sure we are dealing with the same type....this // should never happen if (!fromResource.getClass().getName().equals(getClass().getName())) { throw new RepositoryResourceValidationException("Expected class of type " + getClass().getName() + " but was " + fromResource.getClass().getName(), this.getId()); } // copy the stuff into target fromResource.copyFieldsFrom(this, includeAttachmentInfo); // Now use target _asset = fromResource._asset; }
java
public void overWriteAssetData(RepositoryResourceImpl fromResource, boolean includeAttachmentInfo) throws RepositoryResourceValidationException { // Make sure we are dealing with the same type....this // should never happen if (!fromResource.getClass().getName().equals(getClass().getName())) { throw new RepositoryResourceValidationException("Expected class of type " + getClass().getName() + " but was " + fromResource.getClass().getName(), this.getId()); } // copy the stuff into target fromResource.copyFieldsFrom(this, includeAttachmentInfo); // Now use target _asset = fromResource._asset; }
[ "public", "void", "overWriteAssetData", "(", "RepositoryResourceImpl", "fromResource", ",", "boolean", "includeAttachmentInfo", ")", "throws", "RepositoryResourceValidationException", "{", "// Make sure we are dealing with the same type....this", "// should never happen", "if", "(", "!", "fromResource", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "equals", "(", "getClass", "(", ")", ".", "getName", "(", ")", ")", ")", "{", "throw", "new", "RepositoryResourceValidationException", "(", "\"Expected class of type \"", "+", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" but was \"", "+", "fromResource", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "this", ".", "getId", "(", ")", ")", ";", "}", "// copy the stuff into target", "fromResource", ".", "copyFieldsFrom", "(", "this", ",", "includeAttachmentInfo", ")", ";", "// Now use target", "_asset", "=", "fromResource", ".", "_asset", ";", "}" ]
This method copies the fields from "this" that we care about to the "fromResource". Then we set our asset to point to the one in "fromResource". In effect this means we get all the details from the "fromResource" and override fields we care about and store the merged result in our asset. This is used when we have read an asset back from massive, the asset read back from massive will have more fields that in it (that massive has set) so this method is used to copy the asset containing those extra fields from the "from" resource to the our resource. Note that the from resource is modified during this process, so do not rely on it's contents not changing. This is only used to copy the contents from a matching resource into a new resource and then the matching resource object is discarded so this is currently safe. TODO: Find a better way of doing this @param fromResource @throws RepositoryResourceValidationException
[ "This", "method", "copies", "the", "fields", "from", "this", "that", "we", "care", "about", "to", "the", "fromResource", ".", "Then", "we", "set", "our", "asset", "to", "point", "to", "the", "one", "in", "fromResource", ".", "In", "effect", "this", "means", "we", "get", "all", "the", "details", "from", "the", "fromResource", "and", "override", "fields", "we", "care", "about", "and", "store", "the", "merged", "result", "in", "our", "asset", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java#L1092-L1105
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java
RepositoryResourceImpl.moveToState
public void moveToState(State state) throws RepositoryBackendException, RepositoryResourceException { if (getState() == null) { return; } int counter = 0; while (getState() != state) { counter++; StateAction nextAction = getState().getNextAction(state); performLifeCycle(nextAction); if (counter >= 10) { throw new RepositoryResourceLifecycleException("Unable to move to state " + state + " after 10 state transistion attempts. Resource left in state " + getState(), getId(), getState(), nextAction); } } }
java
public void moveToState(State state) throws RepositoryBackendException, RepositoryResourceException { if (getState() == null) { return; } int counter = 0; while (getState() != state) { counter++; StateAction nextAction = getState().getNextAction(state); performLifeCycle(nextAction); if (counter >= 10) { throw new RepositoryResourceLifecycleException("Unable to move to state " + state + " after 10 state transistion attempts. Resource left in state " + getState(), getId(), getState(), nextAction); } } }
[ "public", "void", "moveToState", "(", "State", "state", ")", "throws", "RepositoryBackendException", ",", "RepositoryResourceException", "{", "if", "(", "getState", "(", ")", "==", "null", ")", "{", "return", ";", "}", "int", "counter", "=", "0", ";", "while", "(", "getState", "(", ")", "!=", "state", ")", "{", "counter", "++", ";", "StateAction", "nextAction", "=", "getState", "(", ")", ".", "getNextAction", "(", "state", ")", ";", "performLifeCycle", "(", "nextAction", ")", ";", "if", "(", "counter", ">=", "10", ")", "{", "throw", "new", "RepositoryResourceLifecycleException", "(", "\"Unable to move to state \"", "+", "state", "+", "\" after 10 state transistion attempts. Resource left in state \"", "+", "getState", "(", ")", ",", "getId", "(", ")", ",", "getState", "(", ")", ",", "nextAction", ")", ";", "}", "}", "}" ]
Moves the resource to the desired state @param resource @param state @throws RepositoryBackendException @throws RepositoryResourceException
[ "Moves", "the", "resource", "to", "the", "desired", "state" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java#L1318-L1332
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java
RepositoryResourceImpl.equivalent
public boolean equivalent(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RepositoryResourceImpl other = (RepositoryResourceImpl) obj; if (_asset == null) { if (other._asset != null) return false; } else if (!_asset.equivalent(other._asset)) return false; return true; }
java
public boolean equivalent(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RepositoryResourceImpl other = (RepositoryResourceImpl) obj; if (_asset == null) { if (other._asset != null) return false; } else if (!_asset.equivalent(other._asset)) return false; return true; }
[ "public", "boolean", "equivalent", "(", "Object", "obj", ")", "{", "if", "(", "this", "==", "obj", ")", "return", "true", ";", "if", "(", "obj", "==", "null", ")", "return", "false", ";", "if", "(", "getClass", "(", ")", "!=", "obj", ".", "getClass", "(", ")", ")", "return", "false", ";", "RepositoryResourceImpl", "other", "=", "(", "RepositoryResourceImpl", ")", "obj", ";", "if", "(", "_asset", "==", "null", ")", "{", "if", "(", "other", ".", "_asset", "!=", "null", ")", "return", "false", ";", "}", "else", "if", "(", "!", "_asset", ".", "equivalent", "(", "other", ".", "_asset", ")", ")", "return", "false", ";", "return", "true", ";", "}" ]
Checks if the two resources are equivalent by checking if the assets are equivalent. @param obj @return
[ "Checks", "if", "the", "two", "resources", "are", "equivalent", "by", "checking", "if", "the", "assets", "are", "equivalent", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java#L1474-L1488
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java
RepositoryResourceImpl.getCRC
private static long getCRC(InputStream is) throws IOException { CheckedInputStream check = new CheckedInputStream(is, new CRC32()); BufferedInputStream in = new BufferedInputStream(check); while (in.read() != -1) { // Read file in completely } long crc = check.getChecksum().getValue(); return crc; }
java
private static long getCRC(InputStream is) throws IOException { CheckedInputStream check = new CheckedInputStream(is, new CRC32()); BufferedInputStream in = new BufferedInputStream(check); while (in.read() != -1) { // Read file in completely } long crc = check.getChecksum().getValue(); return crc; }
[ "private", "static", "long", "getCRC", "(", "InputStream", "is", ")", "throws", "IOException", "{", "CheckedInputStream", "check", "=", "new", "CheckedInputStream", "(", "is", ",", "new", "CRC32", "(", ")", ")", ";", "BufferedInputStream", "in", "=", "new", "BufferedInputStream", "(", "check", ")", ";", "while", "(", "in", ".", "read", "(", ")", "!=", "-", "1", ")", "{", "// Read file in completely", "}", "long", "crc", "=", "check", ".", "getChecksum", "(", ")", ".", "getValue", "(", ")", ";", "return", "crc", ";", "}" ]
Get the CRC of a file from an InputStream @param is The input stream to obtain the CRC from @return a long representing the CRC value of the data read from the supplied input stream @throws IOException
[ "Get", "the", "CRC", "of", "a", "file", "from", "an", "InputStream" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java#L1548-L1556
train
OpenLiberty/open-liberty
dev/com.ibm.ws.anno/src/com/ibm/ws/anno/util/internal/UtilImpl_BidirectionalMap.java
UtilImpl_BidirectionalMap.record
public boolean record(String holderName, String heldName) { return i_record(internHolder(holderName, Util_InternMap.DO_FORCE), internHeld(heldName, Util_InternMap.DO_FORCE)); }
java
public boolean record(String holderName, String heldName) { return i_record(internHolder(holderName, Util_InternMap.DO_FORCE), internHeld(heldName, Util_InternMap.DO_FORCE)); }
[ "public", "boolean", "record", "(", "String", "holderName", ",", "String", "heldName", ")", "{", "return", "i_record", "(", "internHolder", "(", "holderName", ",", "Util_InternMap", ".", "DO_FORCE", ")", ",", "internHeld", "(", "heldName", ",", "Util_InternMap", ".", "DO_FORCE", ")", ")", ";", "}" ]
Or rely on the caller to know to make no store calls?
[ "Or", "rely", "on", "the", "caller", "to", "know", "to", "make", "no", "store", "calls?" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.anno/src/com/ibm/ws/anno/util/internal/UtilImpl_BidirectionalMap.java#L257-L260
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/utils/FileLogHolder.java
FileLogHolder.getTc
private static TraceComponent getTc() { if (tc == null) { tc = Tr.register(FileLogHolder.class, null, "com.ibm.ws.logging.internal.resources.LoggingMessages"); } return tc; }
java
private static TraceComponent getTc() { if (tc == null) { tc = Tr.register(FileLogHolder.class, null, "com.ibm.ws.logging.internal.resources.LoggingMessages"); } return tc; }
[ "private", "static", "TraceComponent", "getTc", "(", ")", "{", "if", "(", "tc", "==", "null", ")", "{", "tc", "=", "Tr", ".", "register", "(", "FileLogHolder", ".", "class", ",", "null", ",", "\"com.ibm.ws.logging.internal.resources.LoggingMessages\"", ")", ";", "}", "return", "tc", ";", "}" ]
This method will get an instance of TraceComponent @return
[ "This", "method", "will", "get", "an", "instance", "of", "TraceComponent" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/utils/FileLogHolder.java#L107-L112
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/utils/FileLogHolder.java
FileLogHolder.getPrimaryStream
private PrintStream getPrimaryStream(boolean showError) { File primaryFile = getPrimaryFile(); setStreamFromFile(primaryFile, false, primaryFile.length(), showError); return currentPrintStream; }
java
private PrintStream getPrimaryStream(boolean showError) { File primaryFile = getPrimaryFile(); setStreamFromFile(primaryFile, false, primaryFile.length(), showError); return currentPrintStream; }
[ "private", "PrintStream", "getPrimaryStream", "(", "boolean", "showError", ")", "{", "File", "primaryFile", "=", "getPrimaryFile", "(", ")", ";", "setStreamFromFile", "(", "primaryFile", ",", "false", ",", "primaryFile", ".", "length", "(", ")", ",", "showError", ")", ";", "return", "currentPrintStream", ";", "}" ]
This assume that the primary file exists. @param showError @return
[ "This", "assume", "that", "the", "primary", "file", "exists", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/utils/FileLogHolder.java#L468-L472
train
OpenLiberty/open-liberty
dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ManagedServiceFactoryTracker.java
ManagedServiceFactoryTracker.addingService
@Override public ManagedServiceFactory addingService(ServiceReference<ManagedServiceFactory> reference) { String[] factoryPids = getServicePid(reference); if (factoryPids == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "handleRegistration(): Invalid service.pid type: " + reference); } return null; } ManagedServiceFactory msf = context.getService(reference); if (msf == null) return null; synchronized (caFactory.getConfigurationStore()) { for (String factoryPid : factoryPids) { add(reference, factoryPid, msf); } } return msf; }
java
@Override public ManagedServiceFactory addingService(ServiceReference<ManagedServiceFactory> reference) { String[] factoryPids = getServicePid(reference); if (factoryPids == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "handleRegistration(): Invalid service.pid type: " + reference); } return null; } ManagedServiceFactory msf = context.getService(reference); if (msf == null) return null; synchronized (caFactory.getConfigurationStore()) { for (String factoryPid : factoryPids) { add(reference, factoryPid, msf); } } return msf; }
[ "@", "Override", "public", "ManagedServiceFactory", "addingService", "(", "ServiceReference", "<", "ManagedServiceFactory", ">", "reference", ")", "{", "String", "[", "]", "factoryPids", "=", "getServicePid", "(", "reference", ")", ";", "if", "(", "factoryPids", "==", "null", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"handleRegistration(): Invalid service.pid type: \"", "+", "reference", ")", ";", "}", "return", "null", ";", "}", "ManagedServiceFactory", "msf", "=", "context", ".", "getService", "(", "reference", ")", ";", "if", "(", "msf", "==", "null", ")", "return", "null", ";", "synchronized", "(", "caFactory", ".", "getConfigurationStore", "(", ")", ")", "{", "for", "(", "String", "factoryPid", ":", "factoryPids", ")", "{", "add", "(", "reference", ",", "factoryPid", ",", "msf", ")", ";", "}", "}", "return", "msf", ";", "}" ]
Processes registered ManagedServiceFactory and updates each with their own configuration properties. @param reference - ServiceReference for MangedServiceFactory
[ "Processes", "registered", "ManagedServiceFactory", "and", "updates", "each", "with", "their", "own", "configuration", "properties", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ManagedServiceFactoryTracker.java#L66-L89
train
OpenLiberty/open-liberty
dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ManagedServiceFactoryTracker.java
ManagedServiceFactoryTracker.removedService
@Override public void removedService(ServiceReference<ManagedServiceFactory> reference, ManagedServiceFactory service) { String[] factoryPids = getServicePid(reference); if (factoryPids == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "removedService(): Invalid service.pid type: " + reference); } return; } synchronized (caFactory.getConfigurationStore()) { for (String pid : factoryPids) { remove(reference, pid); } } context.ungetService(reference); }
java
@Override public void removedService(ServiceReference<ManagedServiceFactory> reference, ManagedServiceFactory service) { String[] factoryPids = getServicePid(reference); if (factoryPids == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "removedService(): Invalid service.pid type: " + reference); } return; } synchronized (caFactory.getConfigurationStore()) { for (String pid : factoryPids) { remove(reference, pid); } } context.ungetService(reference); }
[ "@", "Override", "public", "void", "removedService", "(", "ServiceReference", "<", "ManagedServiceFactory", ">", "reference", ",", "ManagedServiceFactory", "service", ")", "{", "String", "[", "]", "factoryPids", "=", "getServicePid", "(", "reference", ")", ";", "if", "(", "factoryPids", "==", "null", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"removedService(): Invalid service.pid type: \"", "+", "reference", ")", ";", "}", "return", ";", "}", "synchronized", "(", "caFactory", ".", "getConfigurationStore", "(", ")", ")", "{", "for", "(", "String", "pid", ":", "factoryPids", ")", "{", "remove", "(", "reference", ",", "pid", ")", ";", "}", "}", "context", ".", "ungetService", "(", "reference", ")", ";", "}" ]
MangedServiceFactory service removed. Process removal and unget service from its context. @param reference @param service
[ "MangedServiceFactory", "service", "removed", ".", "Process", "removal", "and", "unget", "service", "from", "its", "context", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ManagedServiceFactoryTracker.java#L131-L149
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jpa.container/src/com/ibm/ws/jpa/container/osgi/internal/OSGiJPAPUnitInfo.java
OSGiJPAPUnitInfo.getContainerRootParent
private Container getContainerRootParent(Container base) { Container puBase = base.getEnclosingContainer(); while (puBase != null && !puBase.isRoot()) { puBase = puBase.getEnclosingContainer(); } if (puBase != null && puBase.isRoot()) { Container parent = puBase.getEnclosingContainer(); if (parent != null) { puBase = parent; } } return puBase; }
java
private Container getContainerRootParent(Container base) { Container puBase = base.getEnclosingContainer(); while (puBase != null && !puBase.isRoot()) { puBase = puBase.getEnclosingContainer(); } if (puBase != null && puBase.isRoot()) { Container parent = puBase.getEnclosingContainer(); if (parent != null) { puBase = parent; } } return puBase; }
[ "private", "Container", "getContainerRootParent", "(", "Container", "base", ")", "{", "Container", "puBase", "=", "base", ".", "getEnclosingContainer", "(", ")", ";", "while", "(", "puBase", "!=", "null", "&&", "!", "puBase", ".", "isRoot", "(", ")", ")", "{", "puBase", "=", "puBase", ".", "getEnclosingContainer", "(", ")", ";", "}", "if", "(", "puBase", "!=", "null", "&&", "puBase", ".", "isRoot", "(", ")", ")", "{", "Container", "parent", "=", "puBase", ".", "getEnclosingContainer", "(", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "puBase", "=", "parent", ";", "}", "}", "return", "puBase", ";", "}" ]
Navigates to the root of the base container and returns the parent container @param base @return
[ "Navigates", "to", "the", "root", "of", "the", "base", "container", "and", "returns", "the", "parent", "container" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container/src/com/ibm/ws/jpa/container/osgi/internal/OSGiJPAPUnitInfo.java#L225-L237
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTextRendererBase.java
HtmlTextRendererBase.isAutocompleteOff
protected boolean isAutocompleteOff(FacesContext facesContext, UIComponent component) { if (component instanceof HtmlInputText) { String autocomplete = ((HtmlInputText)component).getAutocomplete(); if (autocomplete != null) { return autocomplete.equals(AUTOCOMPLETE_VALUE_OFF); } } return false; }
java
protected boolean isAutocompleteOff(FacesContext facesContext, UIComponent component) { if (component instanceof HtmlInputText) { String autocomplete = ((HtmlInputText)component).getAutocomplete(); if (autocomplete != null) { return autocomplete.equals(AUTOCOMPLETE_VALUE_OFF); } } return false; }
[ "protected", "boolean", "isAutocompleteOff", "(", "FacesContext", "facesContext", ",", "UIComponent", "component", ")", "{", "if", "(", "component", "instanceof", "HtmlInputText", ")", "{", "String", "autocomplete", "=", "(", "(", "HtmlInputText", ")", "component", ")", ".", "getAutocomplete", "(", ")", ";", "if", "(", "autocomplete", "!=", "null", ")", "{", "return", "autocomplete", ".", "equals", "(", "AUTOCOMPLETE_VALUE_OFF", ")", ";", "}", "}", "return", "false", ";", "}" ]
If autocomplete is "on" or not set, do not render it
[ "If", "autocomplete", "is", "on", "or", "not", "set", "do", "not", "render", "it" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTextRendererBase.java#L313-L325
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsLocalizer.java
JsLocalizer.updateLpMaps
private MasterEntry updateLpMaps(LWMConfig lp) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "updateLpMaps", lp); } SIBLocalizationPoint lpConfig = ((SIBLocalizationPoint) lp); // Create a new LocalizationDefinition and update the lpMap with it String lpName = lpConfig.getIdentifier(); if (lpMap.containsKey(lpName)) { lpMap.remove(lpName); } LocalizationDefinition ld = ((JsAdminFactoryImpl) jsaf).createLocalizationDefinition(lpConfig); LocalizationEntry lEntry = new LocalizationEntry(ld); lpMap.put(lpName, lEntry); String destName = lpName.substring(0, lpName.indexOf("@")); MasterEntry masterEntry = masterMap.get(destName); if (masterEntry == null) { masterEntry = new MasterEntry(); } masterEntry.setDestinationLocalization(ld); masterMap.put(destName, masterEntry); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, "updateLpMaps", lpMap); } return masterEntry; }
java
private MasterEntry updateLpMaps(LWMConfig lp) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "updateLpMaps", lp); } SIBLocalizationPoint lpConfig = ((SIBLocalizationPoint) lp); // Create a new LocalizationDefinition and update the lpMap with it String lpName = lpConfig.getIdentifier(); if (lpMap.containsKey(lpName)) { lpMap.remove(lpName); } LocalizationDefinition ld = ((JsAdminFactoryImpl) jsaf).createLocalizationDefinition(lpConfig); LocalizationEntry lEntry = new LocalizationEntry(ld); lpMap.put(lpName, lEntry); String destName = lpName.substring(0, lpName.indexOf("@")); MasterEntry masterEntry = masterMap.get(destName); if (masterEntry == null) { masterEntry = new MasterEntry(); } masterEntry.setDestinationLocalization(ld); masterMap.put(destName, masterEntry); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, "updateLpMaps", lpMap); } return masterEntry; }
[ "private", "MasterEntry", "updateLpMaps", "(", "LWMConfig", "lp", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"updateLpMaps\"", ",", "lp", ")", ";", "}", "SIBLocalizationPoint", "lpConfig", "=", "(", "(", "SIBLocalizationPoint", ")", "lp", ")", ";", "// Create a new LocalizationDefinition and update the lpMap with it", "String", "lpName", "=", "lpConfig", ".", "getIdentifier", "(", ")", ";", "if", "(", "lpMap", ".", "containsKey", "(", "lpName", ")", ")", "{", "lpMap", ".", "remove", "(", "lpName", ")", ";", "}", "LocalizationDefinition", "ld", "=", "(", "(", "JsAdminFactoryImpl", ")", "jsaf", ")", ".", "createLocalizationDefinition", "(", "lpConfig", ")", ";", "LocalizationEntry", "lEntry", "=", "new", "LocalizationEntry", "(", "ld", ")", ";", "lpMap", ".", "put", "(", "lpName", ",", "lEntry", ")", ";", "String", "destName", "=", "lpName", ".", "substring", "(", "0", ",", "lpName", ".", "indexOf", "(", "\"@\"", ")", ")", ";", "MasterEntry", "masterEntry", "=", "masterMap", ".", "get", "(", "destName", ")", ";", "if", "(", "masterEntry", "==", "null", ")", "{", "masterEntry", "=", "new", "MasterEntry", "(", ")", ";", "}", "masterEntry", ".", "setDestinationLocalization", "(", "ld", ")", ";", "masterMap", ".", "put", "(", "destName", ",", "masterEntry", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "tc", ",", "\"updateLpMaps\"", ",", "lpMap", ")", ";", "}", "return", "masterEntry", ";", "}" ]
Update the given SIBLocalizationPoint in the internal data structures lpMap lpMap contains all types of SIBLocalizationPoints. @param lp Localization point to add. @return masterEntry the masterMap entry
[ "Update", "the", "given", "SIBLocalizationPoint", "in", "the", "internal", "data", "structures", "lpMap" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsLocalizer.java#L257-L284
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsLocalizer.java
JsLocalizer.addLocalizationPoint
public boolean addLocalizationPoint(LWMConfig lp, DestinationDefinition dd) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "addLocalizationPoint", lp); } boolean valid = false; LocalizationDefinition ld = ((JsAdminFactoryImpl) jsaf).createLocalizationDefinition(lp); if (!isInZOSServentRegion()) { _mpAdmin = ((SIMPAdmin) _me.getMessageProcessor()).getAdministrator(); } try { _mpAdmin.createDestinationLocalization(dd, ld); updatedDestDefList.add(dd); updatedLocDefList.add(ld); LocalizationEntry lEntry = new LocalizationEntry(ld); lpMap.put(ld.getName(), lEntry); MasterEntry newMasterEntry = new MasterEntry(); newMasterEntry.setDestinationLocalization(ld); masterMap.put(dd.getName(), newMasterEntry); valid = true; } catch (Exception e) { SibTr.error(tc, "LOCALIZATION_EXCEPTION_SIAS0113", e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, "addLocalizationPoint", Boolean.valueOf(valid)); } return valid; }
java
public boolean addLocalizationPoint(LWMConfig lp, DestinationDefinition dd) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "addLocalizationPoint", lp); } boolean valid = false; LocalizationDefinition ld = ((JsAdminFactoryImpl) jsaf).createLocalizationDefinition(lp); if (!isInZOSServentRegion()) { _mpAdmin = ((SIMPAdmin) _me.getMessageProcessor()).getAdministrator(); } try { _mpAdmin.createDestinationLocalization(dd, ld); updatedDestDefList.add(dd); updatedLocDefList.add(ld); LocalizationEntry lEntry = new LocalizationEntry(ld); lpMap.put(ld.getName(), lEntry); MasterEntry newMasterEntry = new MasterEntry(); newMasterEntry.setDestinationLocalization(ld); masterMap.put(dd.getName(), newMasterEntry); valid = true; } catch (Exception e) { SibTr.error(tc, "LOCALIZATION_EXCEPTION_SIAS0113", e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, "addLocalizationPoint", Boolean.valueOf(valid)); } return valid; }
[ "public", "boolean", "addLocalizationPoint", "(", "LWMConfig", "lp", ",", "DestinationDefinition", "dd", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"addLocalizationPoint\"", ",", "lp", ")", ";", "}", "boolean", "valid", "=", "false", ";", "LocalizationDefinition", "ld", "=", "(", "(", "JsAdminFactoryImpl", ")", "jsaf", ")", ".", "createLocalizationDefinition", "(", "lp", ")", ";", "if", "(", "!", "isInZOSServentRegion", "(", ")", ")", "{", "_mpAdmin", "=", "(", "(", "SIMPAdmin", ")", "_me", ".", "getMessageProcessor", "(", ")", ")", ".", "getAdministrator", "(", ")", ";", "}", "try", "{", "_mpAdmin", ".", "createDestinationLocalization", "(", "dd", ",", "ld", ")", ";", "updatedDestDefList", ".", "add", "(", "dd", ")", ";", "updatedLocDefList", ".", "add", "(", "ld", ")", ";", "LocalizationEntry", "lEntry", "=", "new", "LocalizationEntry", "(", "ld", ")", ";", "lpMap", ".", "put", "(", "ld", ".", "getName", "(", ")", ",", "lEntry", ")", ";", "MasterEntry", "newMasterEntry", "=", "new", "MasterEntry", "(", ")", ";", "newMasterEntry", ".", "setDestinationLocalization", "(", "ld", ")", ";", "masterMap", ".", "put", "(", "dd", ".", "getName", "(", ")", ",", "newMasterEntry", ")", ";", "valid", "=", "true", ";", "}", "catch", "(", "Exception", "e", ")", "{", "SibTr", ".", "error", "(", "tc", ",", "\"LOCALIZATION_EXCEPTION_SIAS0113\"", ",", "e", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "tc", ",", "\"addLocalizationPoint\"", ",", "Boolean", ".", "valueOf", "(", "valid", ")", ")", ";", "}", "return", "valid", ";", "}" ]
Add a single localization point to this JsLocalizer object and tell MP about it. This method is used by dynamic config in tWAS. @param lp @param dd @return boolean success Whether the LP was successfully added
[ "Add", "a", "single", "localization", "point", "to", "this", "JsLocalizer", "object", "and", "tell", "MP", "about", "it", ".", "This", "method", "is", "used", "by", "dynamic", "config", "in", "tWAS", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsLocalizer.java#L294-L324
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsLocalizer.java
JsLocalizer.isNewDestination
private boolean isNewDestination(String key) { Object dd = null; try { dd = _me.getSIBDestinationByUuid(_me.getBusName(), key, false); } catch (Exception e) { // No FFDC code needed } return (dd == null); }
java
private boolean isNewDestination(String key) { Object dd = null; try { dd = _me.getSIBDestinationByUuid(_me.getBusName(), key, false); } catch (Exception e) { // No FFDC code needed } return (dd == null); }
[ "private", "boolean", "isNewDestination", "(", "String", "key", ")", "{", "Object", "dd", "=", "null", ";", "try", "{", "dd", "=", "_me", ".", "getSIBDestinationByUuid", "(", "_me", ".", "getBusName", "(", ")", ",", "key", ",", "false", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// No FFDC code needed", "}", "return", "(", "dd", "==", "null", ")", ";", "}" ]
Check the old destination cache, if the destination is not found then it has just been created. This method assumes that the destination is in the new cache - this is not checked. @param key @return true if getSIBDestinationByUuid fails to return anything
[ "Check", "the", "old", "destination", "cache", "if", "the", "destination", "is", "not", "found", "then", "it", "has", "just", "been", "created", ".", "This", "method", "assumes", "that", "the", "destination", "is", "in", "the", "new", "cache", "-", "this", "is", "not", "checked", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsLocalizer.java#L334-L345
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsLocalizer.java
JsLocalizer.alterLocalizationPoint
public void alterLocalizationPoint(BaseDestination destination,LWMConfig lp) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "alterLocalizationPoint", lp); } boolean valid = true; DestinationDefinition dd = null; DestinationAliasDefinition dAliasDef=null; String key = getMasterMapKey(lp); // Update localization point in master map entry and lpMap MasterEntry m = updateLpMaps(lp); if (m == null) { String reason = CLASS_NAME + ".alterLocalizationPoint(): Entry for name " + key + " not found in cache"; SibTr.error(tc, "INTERNAL_ERROR_SIAS0003", reason); valid = false; } else { try { // We obtain the DD from the new cache in case it has changed. This is // lieu of a possible // design change to allow the independent signalling of a change to the // DD. BaseDestinationDefinition bdd = _me.getSIBDestination(_me.getBusName(), key); if(destination.isAlias()) { AliasDestination aliasDest=(AliasDestination)destination; dAliasDef=modifyAliasDestDefinition(aliasDest, (DestinationAliasDefinition) bdd); } else { dd=(DestinationDefinition)modifyDestDefinition(destination,bdd); } } catch (Exception e) { com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".alterLocalizationPoint", "1", this); SibTr.exception(tc, e); String reason = m.getDestinationLocalization().getName(); valid = false; } } if (valid == true && !isInZOSServentRegion() && _mpAdmin != null) { if(destination.isAlias()) { _mpAdmin.alterDestinationAlias(dAliasDef); }else { LocalizationDefinition ld=m.getDestinationLocalization(); ld.setAlterationTime(dd.getAlterationTime()); ld.setSendAllowed(dd.isSendAllowed()); _mpAdmin.alterDestinationLocalization(dd, ld); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "alterLocalizationPoint: LP altered on existing destination deferring alter until end, UUID=" + key + " Name=" + dd.getName()); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, "alterLocalizationPoint"); } }
java
public void alterLocalizationPoint(BaseDestination destination,LWMConfig lp) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "alterLocalizationPoint", lp); } boolean valid = true; DestinationDefinition dd = null; DestinationAliasDefinition dAliasDef=null; String key = getMasterMapKey(lp); // Update localization point in master map entry and lpMap MasterEntry m = updateLpMaps(lp); if (m == null) { String reason = CLASS_NAME + ".alterLocalizationPoint(): Entry for name " + key + " not found in cache"; SibTr.error(tc, "INTERNAL_ERROR_SIAS0003", reason); valid = false; } else { try { // We obtain the DD from the new cache in case it has changed. This is // lieu of a possible // design change to allow the independent signalling of a change to the // DD. BaseDestinationDefinition bdd = _me.getSIBDestination(_me.getBusName(), key); if(destination.isAlias()) { AliasDestination aliasDest=(AliasDestination)destination; dAliasDef=modifyAliasDestDefinition(aliasDest, (DestinationAliasDefinition) bdd); } else { dd=(DestinationDefinition)modifyDestDefinition(destination,bdd); } } catch (Exception e) { com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".alterLocalizationPoint", "1", this); SibTr.exception(tc, e); String reason = m.getDestinationLocalization().getName(); valid = false; } } if (valid == true && !isInZOSServentRegion() && _mpAdmin != null) { if(destination.isAlias()) { _mpAdmin.alterDestinationAlias(dAliasDef); }else { LocalizationDefinition ld=m.getDestinationLocalization(); ld.setAlterationTime(dd.getAlterationTime()); ld.setSendAllowed(dd.isSendAllowed()); _mpAdmin.alterDestinationLocalization(dd, ld); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "alterLocalizationPoint: LP altered on existing destination deferring alter until end, UUID=" + key + " Name=" + dd.getName()); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, "alterLocalizationPoint"); } }
[ "public", "void", "alterLocalizationPoint", "(", "BaseDestination", "destination", ",", "LWMConfig", "lp", ")", "throws", "Exception", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"alterLocalizationPoint\"", ",", "lp", ")", ";", "}", "boolean", "valid", "=", "true", ";", "DestinationDefinition", "dd", "=", "null", ";", "DestinationAliasDefinition", "dAliasDef", "=", "null", ";", "String", "key", "=", "getMasterMapKey", "(", "lp", ")", ";", "// Update localization point in master map entry and lpMap", "MasterEntry", "m", "=", "updateLpMaps", "(", "lp", ")", ";", "if", "(", "m", "==", "null", ")", "{", "String", "reason", "=", "CLASS_NAME", "+", "\".alterLocalizationPoint(): Entry for name \"", "+", "key", "+", "\" not found in cache\"", ";", "SibTr", ".", "error", "(", "tc", ",", "\"INTERNAL_ERROR_SIAS0003\"", ",", "reason", ")", ";", "valid", "=", "false", ";", "}", "else", "{", "try", "{", "// We obtain the DD from the new cache in case it has changed. This is", "// lieu of a possible", "// design change to allow the independent signalling of a change to the", "// DD.", "BaseDestinationDefinition", "bdd", "=", "_me", ".", "getSIBDestination", "(", "_me", ".", "getBusName", "(", ")", ",", "key", ")", ";", "if", "(", "destination", ".", "isAlias", "(", ")", ")", "{", "AliasDestination", "aliasDest", "=", "(", "AliasDestination", ")", "destination", ";", "dAliasDef", "=", "modifyAliasDestDefinition", "(", "aliasDest", ",", "(", "DestinationAliasDefinition", ")", "bdd", ")", ";", "}", "else", "{", "dd", "=", "(", "DestinationDefinition", ")", "modifyDestDefinition", "(", "destination", ",", "bdd", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "com", ".", "ibm", ".", "ws", ".", "ffdc", ".", "FFDCFilter", ".", "processException", "(", "e", ",", "CLASS_NAME", "+", "\".alterLocalizationPoint\"", ",", "\"1\"", ",", "this", ")", ";", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "String", "reason", "=", "m", ".", "getDestinationLocalization", "(", ")", ".", "getName", "(", ")", ";", "valid", "=", "false", ";", "}", "}", "if", "(", "valid", "==", "true", "&&", "!", "isInZOSServentRegion", "(", ")", "&&", "_mpAdmin", "!=", "null", ")", "{", "if", "(", "destination", ".", "isAlias", "(", ")", ")", "{", "_mpAdmin", ".", "alterDestinationAlias", "(", "dAliasDef", ")", ";", "}", "else", "{", "LocalizationDefinition", "ld", "=", "m", ".", "getDestinationLocalization", "(", ")", ";", "ld", ".", "setAlterationTime", "(", "dd", ".", "getAlterationTime", "(", ")", ")", ";", "ld", ".", "setSendAllowed", "(", "dd", ".", "isSendAllowed", "(", ")", ")", ";", "_mpAdmin", ".", "alterDestinationLocalization", "(", "dd", ",", "ld", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"alterLocalizationPoint: LP altered on existing destination deferring alter until end, UUID=\"", "+", "key", "+", "\" Name=\"", "+", "dd", ".", "getName", "(", ")", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "tc", ",", "\"alterLocalizationPoint\"", ")", ";", "}", "}" ]
Modify the given localization point and tell MP. The parameter is a new SIBLocalizationPoint which will replace the existing object inside of this. This method is used by dynamic config. @param lp New localizationPoint
[ "Modify", "the", "given", "localization", "point", "and", "tell", "MP", ".", "The", "parameter", "is", "a", "new", "SIBLocalizationPoint", "which", "will", "replace", "the", "existing", "object", "inside", "of", "this", ".", "This", "method", "is", "used", "by", "dynamic", "config", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsLocalizer.java#L355-L418
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsLocalizer.java
JsLocalizer.getMasterMapKey
private String getMasterMapKey(LWMConfig lp) { String key = null; String lpIdentifier = ((SIBLocalizationPoint) lp).getIdentifier(); key = lpIdentifier.substring(0, lpIdentifier.indexOf("@")); return key; }
java
private String getMasterMapKey(LWMConfig lp) { String key = null; String lpIdentifier = ((SIBLocalizationPoint) lp).getIdentifier(); key = lpIdentifier.substring(0, lpIdentifier.indexOf("@")); return key; }
[ "private", "String", "getMasterMapKey", "(", "LWMConfig", "lp", ")", "{", "String", "key", "=", "null", ";", "String", "lpIdentifier", "=", "(", "(", "SIBLocalizationPoint", ")", "lp", ")", ".", "getIdentifier", "(", ")", ";", "key", "=", "lpIdentifier", ".", "substring", "(", "0", ",", "lpIdentifier", ".", "indexOf", "(", "\"@\"", ")", ")", ";", "return", "key", ";", "}" ]
Returns the name of the destination associated with the supplied localization point. @param lp a localization point proxy. @return the identifier of the destination associated with the supplied localization point proxy.
[ "Returns", "the", "name", "of", "the", "destination", "associated", "with", "the", "supplied", "localization", "point", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsLocalizer.java#L498-L504
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsLocalizer.java
JsLocalizer.deleteDestLocalizations
private void deleteDestLocalizations(JsBus bus) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "deleteDestLocalizations", this); } Iterator i = alterDestinations.iterator(); while (i.hasNext()) { String key = (String) i.next(); try { // Get it from the old cache as it is no longer in the new cache. DestinationDefinition dd = (DestinationDefinition) _me.getSIBDestination(bus.getName(), key); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "deleteDestLocalizations: deleting DestinationLocalization, name =" + key + " Name="); } if (!isInZOSServentRegion() && _mpAdmin != null) { LocalizationEntry dldEntry = (LocalizationEntry) lpMap.get(dd.getName()+"@"+_me.getName()); LocalizationDefinition dld=(LocalizationDefinition) dldEntry.getLocalizationDefinition(); //Venu Liberty change: passing Destination UUID as String. //Destination Definition is passed as NULL as entire destination has to be deleted _mpAdmin.deleteDestinationLocalization(dd.getUUID().toString(), null); } } catch (Exception e) { com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".deleteDestLocalizations", "1", this); SibTr.exception(tc, e); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, "deleteDestLocalizations"); } }
java
private void deleteDestLocalizations(JsBus bus) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "deleteDestLocalizations", this); } Iterator i = alterDestinations.iterator(); while (i.hasNext()) { String key = (String) i.next(); try { // Get it from the old cache as it is no longer in the new cache. DestinationDefinition dd = (DestinationDefinition) _me.getSIBDestination(bus.getName(), key); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "deleteDestLocalizations: deleting DestinationLocalization, name =" + key + " Name="); } if (!isInZOSServentRegion() && _mpAdmin != null) { LocalizationEntry dldEntry = (LocalizationEntry) lpMap.get(dd.getName()+"@"+_me.getName()); LocalizationDefinition dld=(LocalizationDefinition) dldEntry.getLocalizationDefinition(); //Venu Liberty change: passing Destination UUID as String. //Destination Definition is passed as NULL as entire destination has to be deleted _mpAdmin.deleteDestinationLocalization(dd.getUUID().toString(), null); } } catch (Exception e) { com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".deleteDestLocalizations", "1", this); SibTr.exception(tc, e); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, "deleteDestLocalizations"); } }
[ "private", "void", "deleteDestLocalizations", "(", "JsBus", "bus", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"deleteDestLocalizations\"", ",", "this", ")", ";", "}", "Iterator", "i", "=", "alterDestinations", ".", "iterator", "(", ")", ";", "while", "(", "i", ".", "hasNext", "(", ")", ")", "{", "String", "key", "=", "(", "String", ")", "i", ".", "next", "(", ")", ";", "try", "{", "// Get it from the old cache as it is no longer in the new cache.", "DestinationDefinition", "dd", "=", "(", "DestinationDefinition", ")", "_me", ".", "getSIBDestination", "(", "bus", ".", "getName", "(", ")", ",", "key", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "SibTr", ".", "debug", "(", "tc", ",", "\"deleteDestLocalizations: deleting DestinationLocalization, name =\"", "+", "key", "+", "\" Name=\"", ")", ";", "}", "if", "(", "!", "isInZOSServentRegion", "(", ")", "&&", "_mpAdmin", "!=", "null", ")", "{", "LocalizationEntry", "dldEntry", "=", "(", "LocalizationEntry", ")", "lpMap", ".", "get", "(", "dd", ".", "getName", "(", ")", "+", "\"@\"", "+", "_me", ".", "getName", "(", ")", ")", ";", "LocalizationDefinition", "dld", "=", "(", "LocalizationDefinition", ")", "dldEntry", ".", "getLocalizationDefinition", "(", ")", ";", "//Venu Liberty change: passing Destination UUID as String.", "//Destination Definition is passed as NULL as entire destination has to be deleted", "_mpAdmin", ".", "deleteDestinationLocalization", "(", "dd", ".", "getUUID", "(", ")", ".", "toString", "(", ")", ",", "null", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "com", ".", "ibm", ".", "ws", ".", "ffdc", ".", "FFDCFilter", ".", "processException", "(", "e", ",", "CLASS_NAME", "+", "\".deleteDestLocalizations\"", ",", "\"1\"", ",", "this", ")", ";", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "tc", ",", "\"deleteDestLocalizations\"", ")", ";", "}", "}" ]
Tell MP about all deleted LPs that previously existed on locations which have also been deleted.
[ "Tell", "MP", "about", "all", "deleted", "LPs", "that", "previously", "existed", "on", "locations", "which", "have", "also", "been", "deleted", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsLocalizer.java#L642-L677
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java
LoggingConfigUtils.getLogDirectory
static File getLogDirectory(Object newValue, File defaultDirectory) { File newDirectory = defaultDirectory; // If a value was specified, try creating a file with it if (newValue != null && newValue instanceof String) { newDirectory = new File((String) newValue); } if (newDirectory == null) { String value = "."; try { value = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<String>() { @Override public String run() throws Exception { return System.getProperty("user.dir"); } }); } catch (Exception ex) { // do nothing } newDirectory = new File(value); } return LoggingFileUtils.validateDirectory(newDirectory); }
java
static File getLogDirectory(Object newValue, File defaultDirectory) { File newDirectory = defaultDirectory; // If a value was specified, try creating a file with it if (newValue != null && newValue instanceof String) { newDirectory = new File((String) newValue); } if (newDirectory == null) { String value = "."; try { value = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<String>() { @Override public String run() throws Exception { return System.getProperty("user.dir"); } }); } catch (Exception ex) { // do nothing } newDirectory = new File(value); } return LoggingFileUtils.validateDirectory(newDirectory); }
[ "static", "File", "getLogDirectory", "(", "Object", "newValue", ",", "File", "defaultDirectory", ")", "{", "File", "newDirectory", "=", "defaultDirectory", ";", "// If a value was specified, try creating a file with it", "if", "(", "newValue", "!=", "null", "&&", "newValue", "instanceof", "String", ")", "{", "newDirectory", "=", "new", "File", "(", "(", "String", ")", "newValue", ")", ";", "}", "if", "(", "newDirectory", "==", "null", ")", "{", "String", "value", "=", "\".\"", ";", "try", "{", "value", "=", "AccessController", ".", "doPrivileged", "(", "new", "java", ".", "security", ".", "PrivilegedExceptionAction", "<", "String", ">", "(", ")", "{", "@", "Override", "public", "String", "run", "(", ")", "throws", "Exception", "{", "return", "System", ".", "getProperty", "(", "\"user.dir\"", ")", ";", "}", "}", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "// do nothing", "}", "newDirectory", "=", "new", "File", "(", "value", ")", ";", "}", "return", "LoggingFileUtils", ".", "validateDirectory", "(", "newDirectory", ")", ";", "}" ]
Find, create, and validate the log directory. @param newValue New parameter value to parse/evaluate @param defaultValue Starting/Previous log directory-- this value might *also* be null. @return defaultValue if the newValue is null or is was badly formatted, or the converted new value
[ "Find", "create", "and", "validate", "the", "log", "directory", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java#L40-L65
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java
LoggingConfigUtils.getStringValue
public static String getStringValue(Object newValue, String defaultValue) { if (newValue == null) return defaultValue; return (String) newValue; }
java
public static String getStringValue(Object newValue, String defaultValue) { if (newValue == null) return defaultValue; return (String) newValue; }
[ "public", "static", "String", "getStringValue", "(", "Object", "newValue", ",", "String", "defaultValue", ")", "{", "if", "(", "newValue", "==", "null", ")", "return", "defaultValue", ";", "return", "(", "String", ")", "newValue", ";", "}" ]
If the value is null, return the defaultValue. Otherwise return the new value.
[ "If", "the", "value", "is", "null", "return", "the", "defaultValue", ".", "Otherwise", "return", "the", "new", "value", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java#L120-L125
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java
LoggingConfigUtils.getFormatValue
public static TraceFormat getFormatValue(Object newValue, TraceFormat defaultValue) { if (newValue != null && newValue instanceof String) { String strValue = ((String) newValue).toUpperCase(); try { return TraceFormat.valueOf(strValue); } catch (Exception e) { } } return defaultValue; }
java
public static TraceFormat getFormatValue(Object newValue, TraceFormat defaultValue) { if (newValue != null && newValue instanceof String) { String strValue = ((String) newValue).toUpperCase(); try { return TraceFormat.valueOf(strValue); } catch (Exception e) { } } return defaultValue; }
[ "public", "static", "TraceFormat", "getFormatValue", "(", "Object", "newValue", ",", "TraceFormat", "defaultValue", ")", "{", "if", "(", "newValue", "!=", "null", "&&", "newValue", "instanceof", "String", ")", "{", "String", "strValue", "=", "(", "(", "String", ")", "newValue", ")", ".", "toUpperCase", "(", ")", ";", "try", "{", "return", "TraceFormat", ".", "valueOf", "(", "strValue", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "return", "defaultValue", ";", "}" ]
Convert the property value to a TraceFormat type @param s String value @return TraceFormat, BASIC is the default.
[ "Convert", "the", "property", "value", "to", "a", "TraceFormat", "type" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java#L163-L173
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java
LoggingConfigUtils.getStringFromCollection
public static String getStringFromCollection(Collection<String> values) { StringBuilder builder = new StringBuilder(); if (values != null) { for (String value : values) { builder.append(value).append(','); } if (builder.charAt(builder.length() - 1) == ',') builder.deleteCharAt(builder.length() - 1); } return builder.toString(); }
java
public static String getStringFromCollection(Collection<String> values) { StringBuilder builder = new StringBuilder(); if (values != null) { for (String value : values) { builder.append(value).append(','); } if (builder.charAt(builder.length() - 1) == ',') builder.deleteCharAt(builder.length() - 1); } return builder.toString(); }
[ "public", "static", "String", "getStringFromCollection", "(", "Collection", "<", "String", ">", "values", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "values", "!=", "null", ")", "{", "for", "(", "String", "value", ":", "values", ")", "{", "builder", ".", "append", "(", "value", ")", ".", "append", "(", "'", "'", ")", ";", "}", "if", "(", "builder", ".", "charAt", "(", "builder", ".", "length", "(", ")", "-", "1", ")", "==", "'", "'", ")", "builder", ".", "deleteCharAt", "(", "builder", ".", "length", "(", ")", "-", "1", ")", ";", "}", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Convert a collection of String values back into a comma separated list @param values The collection of strings
[ "Convert", "a", "collection", "of", "String", "values", "back", "into", "a", "comma", "separated", "list" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java#L256-L266
train
OpenLiberty/open-liberty
dev/com.ibm.json4j/src/com/ibm/json/java/internal/Tokenizer.java
Tokenizer.readNumber
private Number readNumber() throws IOException { StringBuffer sb = new StringBuffer(); int l = lineNo; int c = colNo; while (isDigitChar(lastChar)) { sb.append((char)lastChar); readChar(); } // convert it! String string = sb.toString(); try { if (-1 != string.indexOf('.')) { return Double.valueOf(string); } String sign = ""; if (string.startsWith("-")) { sign = "-"; string = string.substring(1); } if (string.toUpperCase().startsWith("0X")) { return Long.valueOf(sign + string.substring(2),16); } if (string.equals("0")) { return new Long(0); } else if (string.startsWith("0") && string.length() > 1) { return Long.valueOf(sign + string.substring(1),8); } /** * We have to check for the exponential and treat appropriately * Exponentials should be treated as Doubles. */ if (string.indexOf("e") != -1 || string.indexOf("E") != -1) { return Double.valueOf(sign + string); } else { return Long.valueOf(sign + string,10); } } catch (NumberFormatException e) { IOException iox = new IOException("Invalid number literal " + onLineCol(l,c)); iox.initCause(e); throw iox; } }
java
private Number readNumber() throws IOException { StringBuffer sb = new StringBuffer(); int l = lineNo; int c = colNo; while (isDigitChar(lastChar)) { sb.append((char)lastChar); readChar(); } // convert it! String string = sb.toString(); try { if (-1 != string.indexOf('.')) { return Double.valueOf(string); } String sign = ""; if (string.startsWith("-")) { sign = "-"; string = string.substring(1); } if (string.toUpperCase().startsWith("0X")) { return Long.valueOf(sign + string.substring(2),16); } if (string.equals("0")) { return new Long(0); } else if (string.startsWith("0") && string.length() > 1) { return Long.valueOf(sign + string.substring(1),8); } /** * We have to check for the exponential and treat appropriately * Exponentials should be treated as Doubles. */ if (string.indexOf("e") != -1 || string.indexOf("E") != -1) { return Double.valueOf(sign + string); } else { return Long.valueOf(sign + string,10); } } catch (NumberFormatException e) { IOException iox = new IOException("Invalid number literal " + onLineCol(l,c)); iox.initCause(e); throw iox; } }
[ "private", "Number", "readNumber", "(", ")", "throws", "IOException", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "int", "l", "=", "lineNo", ";", "int", "c", "=", "colNo", ";", "while", "(", "isDigitChar", "(", "lastChar", ")", ")", "{", "sb", ".", "append", "(", "(", "char", ")", "lastChar", ")", ";", "readChar", "(", ")", ";", "}", "// convert it!", "String", "string", "=", "sb", ".", "toString", "(", ")", ";", "try", "{", "if", "(", "-", "1", "!=", "string", ".", "indexOf", "(", "'", "'", ")", ")", "{", "return", "Double", ".", "valueOf", "(", "string", ")", ";", "}", "String", "sign", "=", "\"\"", ";", "if", "(", "string", ".", "startsWith", "(", "\"-\"", ")", ")", "{", "sign", "=", "\"-\"", ";", "string", "=", "string", ".", "substring", "(", "1", ")", ";", "}", "if", "(", "string", ".", "toUpperCase", "(", ")", ".", "startsWith", "(", "\"0X\"", ")", ")", "{", "return", "Long", ".", "valueOf", "(", "sign", "+", "string", ".", "substring", "(", "2", ")", ",", "16", ")", ";", "}", "if", "(", "string", ".", "equals", "(", "\"0\"", ")", ")", "{", "return", "new", "Long", "(", "0", ")", ";", "}", "else", "if", "(", "string", ".", "startsWith", "(", "\"0\"", ")", "&&", "string", ".", "length", "(", ")", ">", "1", ")", "{", "return", "Long", ".", "valueOf", "(", "sign", "+", "string", ".", "substring", "(", "1", ")", ",", "8", ")", ";", "}", "/**\n * We have to check for the exponential and treat appropriately\n * Exponentials should be treated as Doubles.\n */", "if", "(", "string", ".", "indexOf", "(", "\"e\"", ")", "!=", "-", "1", "||", "string", ".", "indexOf", "(", "\"E\"", ")", "!=", "-", "1", ")", "{", "return", "Double", ".", "valueOf", "(", "sign", "+", "string", ")", ";", "}", "else", "{", "return", "Long", ".", "valueOf", "(", "sign", "+", "string", ",", "10", ")", ";", "}", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "IOException", "iox", "=", "new", "IOException", "(", "\"Invalid number literal \"", "+", "onLineCol", "(", "l", ",", "c", ")", ")", ";", "iox", ".", "initCause", "(", "e", ")", ";", "throw", "iox", ";", "}", "}" ]
Method to read a number from the JSON string. (-)(1-9)(0-9)* : decimal (-)0(0-7)* : octal (-)0(x|X)(0-9|a-f|A-F)* : hex [digits][.digits][(E|e)[(+|-)]digits] @returns The number as the wrapper Java Number type. @throws IOException Thrown in invalid numbers or unexpected end of JSON string
[ "Method", "to", "read", "a", "number", "from", "the", "JSON", "string", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.json4j/src/com/ibm/json/java/internal/Tokenizer.java#L253-L314
train
OpenLiberty/open-liberty
dev/com.ibm.json4j/src/com/ibm/json/java/internal/Tokenizer.java
Tokenizer.readIdentifier
private String readIdentifier() throws IOException { StringBuffer sb = new StringBuffer(); while ((-1 != lastChar) && Character.isLetter((char)lastChar)) { sb.append((char)lastChar); readChar(); } return sb.toString(); }
java
private String readIdentifier() throws IOException { StringBuffer sb = new StringBuffer(); while ((-1 != lastChar) && Character.isLetter((char)lastChar)) { sb.append((char)lastChar); readChar(); } return sb.toString(); }
[ "private", "String", "readIdentifier", "(", ")", "throws", "IOException", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "while", "(", "(", "-", "1", "!=", "lastChar", ")", "&&", "Character", ".", "isLetter", "(", "(", "char", ")", "lastChar", ")", ")", "{", "sb", ".", "append", "(", "(", "char", ")", "lastChar", ")", ";", "readChar", "(", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Method to read a partular character string. only really need to handle 'null', 'true', and 'false'
[ "Method", "to", "read", "a", "partular", "character", "string", ".", "only", "really", "need", "to", "handle", "null", "true", "and", "false" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.json4j/src/com/ibm/json/java/internal/Tokenizer.java#L409-L419
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java
MessagingSecurityUtility.createAuthenticationData
public static AuthenticationData createAuthenticationData(String userName, UserRegistry userRegistry) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "createAuthenticationData", userName); } AuthenticationData authData = new WSAuthenticationData(); if (userName == null) { userName = ""; } String realm = getDefaultRealm(userRegistry); authData.set(AuthenticationData.USERNAME, userName); authData.set(AuthenticationData.REALM, realm); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "createAuthenticationData", authData); } return authData; }
java
public static AuthenticationData createAuthenticationData(String userName, UserRegistry userRegistry) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "createAuthenticationData", userName); } AuthenticationData authData = new WSAuthenticationData(); if (userName == null) { userName = ""; } String realm = getDefaultRealm(userRegistry); authData.set(AuthenticationData.USERNAME, userName); authData.set(AuthenticationData.REALM, realm); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "createAuthenticationData", authData); } return authData; }
[ "public", "static", "AuthenticationData", "createAuthenticationData", "(", "String", "userName", ",", "UserRegistry", "userRegistry", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "CLASS_NAME", "+", "\"createAuthenticationData\"", ",", "userName", ")", ";", "}", "AuthenticationData", "authData", "=", "new", "WSAuthenticationData", "(", ")", ";", "if", "(", "userName", "==", "null", ")", "{", "userName", "=", "\"\"", ";", "}", "String", "realm", "=", "getDefaultRealm", "(", "userRegistry", ")", ";", "authData", ".", "set", "(", "AuthenticationData", ".", "USERNAME", ",", "userName", ")", ";", "authData", ".", "set", "(", "AuthenticationData", ".", "REALM", ",", "realm", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "tc", ",", "CLASS_NAME", "+", "\"createAuthenticationData\"", ",", "authData", ")", ";", "}", "return", "authData", ";", "}" ]
Create the AuthenticationData from the UserName @param userName @return
[ "Create", "the", "AuthenticationData", "from", "the", "UserName" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java#L64-L79
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java
MessagingSecurityUtility.createAuthenticationData
public static AuthenticationData createAuthenticationData(byte[] token) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "createAuthenticationData", token); } AuthenticationData authData = new WSAuthenticationData(); authData.set(AuthenticationData.TOKEN, token); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "createAuthenticationData", authData); } return authData; }
java
public static AuthenticationData createAuthenticationData(byte[] token) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "createAuthenticationData", token); } AuthenticationData authData = new WSAuthenticationData(); authData.set(AuthenticationData.TOKEN, token); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "createAuthenticationData", authData); } return authData; }
[ "public", "static", "AuthenticationData", "createAuthenticationData", "(", "byte", "[", "]", "token", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "CLASS_NAME", "+", "\"createAuthenticationData\"", ",", "token", ")", ";", "}", "AuthenticationData", "authData", "=", "new", "WSAuthenticationData", "(", ")", ";", "authData", ".", "set", "(", "AuthenticationData", ".", "TOKEN", ",", "token", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "tc", ",", "CLASS_NAME", "+", "\"createAuthenticationData\"", ",", "authData", ")", ";", "}", "return", "authData", ";", "}" ]
Create AuthenticationData object from the Token passed @param token @return
[ "Create", "AuthenticationData", "object", "from", "the", "Token", "passed" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java#L87-L97
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java
MessagingSecurityUtility.createAuthenticationData
public static AuthenticationData createAuthenticationData(String userName, String password) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "createAuthenticationData", new Object[] { userName, "Password Not Traced" }); } AuthenticationData authData = new WSAuthenticationData(); if (userName == null) userName = ""; if (password == null) password = ""; authData.set(AuthenticationData.USERNAME, userName); authData.set(AuthenticationData.PASSWORD, new ProtectedString(password.toCharArray())); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "createAuthenticationData", authData); } return authData; }
java
public static AuthenticationData createAuthenticationData(String userName, String password) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "createAuthenticationData", new Object[] { userName, "Password Not Traced" }); } AuthenticationData authData = new WSAuthenticationData(); if (userName == null) userName = ""; if (password == null) password = ""; authData.set(AuthenticationData.USERNAME, userName); authData.set(AuthenticationData.PASSWORD, new ProtectedString(password.toCharArray())); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "createAuthenticationData", authData); } return authData; }
[ "public", "static", "AuthenticationData", "createAuthenticationData", "(", "String", "userName", ",", "String", "password", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "CLASS_NAME", "+", "\"createAuthenticationData\"", ",", "new", "Object", "[", "]", "{", "userName", ",", "\"Password Not Traced\"", "}", ")", ";", "}", "AuthenticationData", "authData", "=", "new", "WSAuthenticationData", "(", ")", ";", "if", "(", "userName", "==", "null", ")", "userName", "=", "\"\"", ";", "if", "(", "password", "==", "null", ")", "password", "=", "\"\"", ";", "authData", ".", "set", "(", "AuthenticationData", ".", "USERNAME", ",", "userName", ")", ";", "authData", ".", "set", "(", "AuthenticationData", ".", "PASSWORD", ",", "new", "ProtectedString", "(", "password", ".", "toCharArray", "(", ")", ")", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "tc", ",", "CLASS_NAME", "+", "\"createAuthenticationData\"", ",", "authData", ")", ";", "}", "return", "authData", ";", "}" ]
Create AuthenticationData Object from the UserName and Password passed @param userName @param password @return
[ "Create", "AuthenticationData", "Object", "from", "the", "UserName", "and", "Password", "passed" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java#L106-L121
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java
MessagingSecurityUtility.createAuthenticationData
public static AuthenticationData createAuthenticationData(Certificate[] certs, UserRegistry userRegistry) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "createAuthenticationData", certs); } AuthenticationData authData = new WSAuthenticationData(); X509Certificate[] _certs; _certs = new X509Certificate[certs.length]; for (int i = 0; i < certs.length; i++) { if (certs[i] instanceof X509Certificate) { _certs[i] = (X509Certificate) certs[i]; } else { _certs = null; break; } } authData.set(AuthenticationData.CERTCHAIN, _certs); authData.set(AuthenticationData.REALM, getDefaultRealm(userRegistry)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "createAuthenticationData", authData); } return authData; }
java
public static AuthenticationData createAuthenticationData(Certificate[] certs, UserRegistry userRegistry) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "createAuthenticationData", certs); } AuthenticationData authData = new WSAuthenticationData(); X509Certificate[] _certs; _certs = new X509Certificate[certs.length]; for (int i = 0; i < certs.length; i++) { if (certs[i] instanceof X509Certificate) { _certs[i] = (X509Certificate) certs[i]; } else { _certs = null; break; } } authData.set(AuthenticationData.CERTCHAIN, _certs); authData.set(AuthenticationData.REALM, getDefaultRealm(userRegistry)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "createAuthenticationData", authData); } return authData; }
[ "public", "static", "AuthenticationData", "createAuthenticationData", "(", "Certificate", "[", "]", "certs", ",", "UserRegistry", "userRegistry", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "CLASS_NAME", "+", "\"createAuthenticationData\"", ",", "certs", ")", ";", "}", "AuthenticationData", "authData", "=", "new", "WSAuthenticationData", "(", ")", ";", "X509Certificate", "[", "]", "_certs", ";", "_certs", "=", "new", "X509Certificate", "[", "certs", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "certs", ".", "length", ";", "i", "++", ")", "{", "if", "(", "certs", "[", "i", "]", "instanceof", "X509Certificate", ")", "{", "_certs", "[", "i", "]", "=", "(", "X509Certificate", ")", "certs", "[", "i", "]", ";", "}", "else", "{", "_certs", "=", "null", ";", "break", ";", "}", "}", "authData", ".", "set", "(", "AuthenticationData", ".", "CERTCHAIN", ",", "_certs", ")", ";", "authData", ".", "set", "(", "AuthenticationData", ".", "REALM", ",", "getDefaultRealm", "(", "userRegistry", ")", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "tc", ",", "CLASS_NAME", "+", "\"createAuthenticationData\"", ",", "authData", ")", ";", "}", "return", "authData", ";", "}" ]
Create AuthenticationData object from the Certificate @param certs @param userRegistry @return
[ "Create", "AuthenticationData", "object", "from", "the", "Certificate" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java#L130-L151
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java
MessagingSecurityUtility.getDefaultRealm
private static String getDefaultRealm(UserRegistry _userRegistry) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "getDefaultRealm"); } String realm = DEFAULT_REALM; if (_userRegistry != null) { realm = _userRegistry.getRealm(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "getDefaultRealm", realm); } return realm; }
java
private static String getDefaultRealm(UserRegistry _userRegistry) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "getDefaultRealm"); } String realm = DEFAULT_REALM; if (_userRegistry != null) { realm = _userRegistry.getRealm(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "getDefaultRealm", realm); } return realm; }
[ "private", "static", "String", "getDefaultRealm", "(", "UserRegistry", "_userRegistry", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "CLASS_NAME", "+", "\"getDefaultRealm\"", ")", ";", "}", "String", "realm", "=", "DEFAULT_REALM", ";", "if", "(", "_userRegistry", "!=", "null", ")", "{", "realm", "=", "_userRegistry", ".", "getRealm", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "tc", ",", "CLASS_NAME", "+", "\"getDefaultRealm\"", ",", "realm", ")", ";", "}", "return", "realm", ";", "}" ]
Get the Default Realm @param _userRegistry @return
[ "Get", "the", "Default", "Realm" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java#L159-L171
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java
MessagingSecurityUtility.getUniqueUserName
public static String getUniqueUserName(Subject subject) throws MessagingSecurityException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "getUniqueUserName", subject); } if (subject == null) { return null; } WSCredential cred = subjectHelper.getWSCredential(subject); String userName = null; if (cred != null) { try { userName = cred.getSecurityName(); } catch (CredentialException ce) { throw new MessagingSecurityException(ce); } catch (CredentialDestroyedException e) { throw new MessagingSecurityException(e); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "getUniqueUserName", userName); } return userName; }
java
public static String getUniqueUserName(Subject subject) throws MessagingSecurityException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "getUniqueUserName", subject); } if (subject == null) { return null; } WSCredential cred = subjectHelper.getWSCredential(subject); String userName = null; if (cred != null) { try { userName = cred.getSecurityName(); } catch (CredentialException ce) { throw new MessagingSecurityException(ce); } catch (CredentialDestroyedException e) { throw new MessagingSecurityException(e); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "getUniqueUserName", userName); } return userName; }
[ "public", "static", "String", "getUniqueUserName", "(", "Subject", "subject", ")", "throws", "MessagingSecurityException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "CLASS_NAME", "+", "\"getUniqueUserName\"", ",", "subject", ")", ";", "}", "if", "(", "subject", "==", "null", ")", "{", "return", "null", ";", "}", "WSCredential", "cred", "=", "subjectHelper", ".", "getWSCredential", "(", "subject", ")", ";", "String", "userName", "=", "null", ";", "if", "(", "cred", "!=", "null", ")", "{", "try", "{", "userName", "=", "cred", ".", "getSecurityName", "(", ")", ";", "}", "catch", "(", "CredentialException", "ce", ")", "{", "throw", "new", "MessagingSecurityException", "(", "ce", ")", ";", "}", "catch", "(", "CredentialDestroyedException", "e", ")", "{", "throw", "new", "MessagingSecurityException", "(", "e", ")", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "tc", ",", "CLASS_NAME", "+", "\"getUniqueUserName\"", ",", "userName", ")", ";", "}", "return", "userName", ";", "}" ]
This method returns the unique name of the user that was being authenticated. This is a best can do process and a user name may not be available, in which case null should be returned. This method should not return an empty string. @param subject the WAS authenticated subject @return The name of the user being authenticated. @throws MessagingSecurityException
[ "This", "method", "returns", "the", "unique", "name", "of", "the", "user", "that", "was", "being", "authenticated", ".", "This", "is", "a", "best", "can", "do", "process", "and", "a", "user", "name", "may", "not", "be", "available", "in", "which", "case", "null", "should", "be", "returned", ".", "This", "method", "should", "not", "return", "an", "empty", "string", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java#L185-L208
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java
MessagingSecurityUtility.isUnauthenticated
public static boolean isUnauthenticated(Subject subject) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "isUnauthenticated", subject); } boolean result = subjectHelper.isUnauthenticated(subject); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "isUnauthenticated", result); } return result; }
java
public static boolean isUnauthenticated(Subject subject) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "isUnauthenticated", subject); } boolean result = subjectHelper.isUnauthenticated(subject); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "isUnauthenticated", result); } return result; }
[ "public", "static", "boolean", "isUnauthenticated", "(", "Subject", "subject", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "CLASS_NAME", "+", "\"isUnauthenticated\"", ",", "subject", ")", ";", "}", "boolean", "result", "=", "subjectHelper", ".", "isUnauthenticated", "(", "subject", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "tc", ",", "CLASS_NAME", "+", "\"isUnauthenticated\"", ",", "result", ")", ";", "}", "return", "result", ";", "}" ]
Check if the Subject is Authenticated @param subject @return true if Subject is not authenticated
[ "Check", "if", "the", "Subject", "is", "Authenticated" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java#L238-L247
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ThreadLocalStack.java
ThreadLocalStack.pop
public E pop() throws EmptyStackException { E answer = peek(); // Throws EmptyStackException if there's nothing there _elements.get().remove(_elements.get().size()-1); return answer; }
java
public E pop() throws EmptyStackException { E answer = peek(); // Throws EmptyStackException if there's nothing there _elements.get().remove(_elements.get().size()-1); return answer; }
[ "public", "E", "pop", "(", ")", "throws", "EmptyStackException", "{", "E", "answer", "=", "peek", "(", ")", ";", "// Throws EmptyStackException if there's nothing there", "_elements", ".", "get", "(", ")", ".", "remove", "(", "_elements", ".", "get", "(", ")", ".", "size", "(", ")", "-", "1", ")", ";", "return", "answer", ";", "}" ]
Pop and return the top element of the stack for this thread @return The previously top element of the stack for this thread @throws EmptyStackException is thrown if the stack for this thread is empty
[ "Pop", "and", "return", "the", "top", "element", "of", "the", "stack", "for", "this", "thread" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ThreadLocalStack.java#L88-L93
train
OpenLiberty/open-liberty
dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/TaskInfo.java
TaskInfo.deserializeThreadContext
public ThreadContextDescriptor deserializeThreadContext(Map<String, String> execProps) throws IOException, ClassNotFoundException { return threadContextBytes == null ? null : ThreadContextDeserializer.deserialize(threadContextBytes, execProps); }
java
public ThreadContextDescriptor deserializeThreadContext(Map<String, String> execProps) throws IOException, ClassNotFoundException { return threadContextBytes == null ? null : ThreadContextDeserializer.deserialize(threadContextBytes, execProps); }
[ "public", "ThreadContextDescriptor", "deserializeThreadContext", "(", "Map", "<", "String", ",", "String", ">", "execProps", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "return", "threadContextBytes", "==", "null", "?", "null", ":", "ThreadContextDeserializer", ".", "deserialize", "(", "threadContextBytes", ",", "execProps", ")", ";", "}" ]
Returns the thread context that was captured at the point when the task was submitted. @param execProps execution properties for the persistent task. @return the thread context that was captured at the point when the task was submitted. @throws IOException @throws ClassNotFoundException
[ "Returns", "the", "thread", "context", "that", "was", "captured", "at", "the", "point", "when", "the", "task", "was", "submitted", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/TaskInfo.java#L151-L153
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/metadata/builder/HandlerChainInfoBuilder.java
HandlerChainInfoBuilder.buildHandlerChainInfoFromXML
public static HandlerChainInfo buildHandlerChainInfoFromXML(HandlerChain hChain) { HandlerChainInfo hcInfo = new HandlerChainInfo(); // set Service QName if (hChain.getServiceNamePattern() != null) { hcInfo.setServiceNamePattern(new QName(hChain.getServiceNamePattern().getNamespaceURI(), hChain.getServiceNamePattern().getLocalPart())); } else { hcInfo.setServiceNamePattern(new QName("*")); } // set Port QName if (hChain.getPortNamePattern() != null) { hcInfo.setPortNamePattern(new QName(hChain.getPortNamePattern().getNamespaceURI(), hChain.getPortNamePattern().getLocalPart())); } else { hcInfo.setPortNamePattern(new QName("*")); } // add protocol bindings hcInfo.addProtocolBindings(hChain.getProtocolBindings()); for (com.ibm.ws.javaee.dd.common.wsclient.Handler handler : hChain.getHandlers()) { hcInfo.addHandlerInfo(buildHandlerInfoFromXML(handler)); } return hcInfo; }
java
public static HandlerChainInfo buildHandlerChainInfoFromXML(HandlerChain hChain) { HandlerChainInfo hcInfo = new HandlerChainInfo(); // set Service QName if (hChain.getServiceNamePattern() != null) { hcInfo.setServiceNamePattern(new QName(hChain.getServiceNamePattern().getNamespaceURI(), hChain.getServiceNamePattern().getLocalPart())); } else { hcInfo.setServiceNamePattern(new QName("*")); } // set Port QName if (hChain.getPortNamePattern() != null) { hcInfo.setPortNamePattern(new QName(hChain.getPortNamePattern().getNamespaceURI(), hChain.getPortNamePattern().getLocalPart())); } else { hcInfo.setPortNamePattern(new QName("*")); } // add protocol bindings hcInfo.addProtocolBindings(hChain.getProtocolBindings()); for (com.ibm.ws.javaee.dd.common.wsclient.Handler handler : hChain.getHandlers()) { hcInfo.addHandlerInfo(buildHandlerInfoFromXML(handler)); } return hcInfo; }
[ "public", "static", "HandlerChainInfo", "buildHandlerChainInfoFromXML", "(", "HandlerChain", "hChain", ")", "{", "HandlerChainInfo", "hcInfo", "=", "new", "HandlerChainInfo", "(", ")", ";", "// set Service QName", "if", "(", "hChain", ".", "getServiceNamePattern", "(", ")", "!=", "null", ")", "{", "hcInfo", ".", "setServiceNamePattern", "(", "new", "QName", "(", "hChain", ".", "getServiceNamePattern", "(", ")", ".", "getNamespaceURI", "(", ")", ",", "hChain", ".", "getServiceNamePattern", "(", ")", ".", "getLocalPart", "(", ")", ")", ")", ";", "}", "else", "{", "hcInfo", ".", "setServiceNamePattern", "(", "new", "QName", "(", "\"*\"", ")", ")", ";", "}", "// set Port QName", "if", "(", "hChain", ".", "getPortNamePattern", "(", ")", "!=", "null", ")", "{", "hcInfo", ".", "setPortNamePattern", "(", "new", "QName", "(", "hChain", ".", "getPortNamePattern", "(", ")", ".", "getNamespaceURI", "(", ")", ",", "hChain", ".", "getPortNamePattern", "(", ")", ".", "getLocalPart", "(", ")", ")", ")", ";", "}", "else", "{", "hcInfo", ".", "setPortNamePattern", "(", "new", "QName", "(", "\"*\"", ")", ")", ";", "}", "// add protocol bindings", "hcInfo", ".", "addProtocolBindings", "(", "hChain", ".", "getProtocolBindings", "(", ")", ")", ";", "for", "(", "com", ".", "ibm", ".", "ws", ".", "javaee", ".", "dd", ".", "common", ".", "wsclient", ".", "Handler", "handler", ":", "hChain", ".", "getHandlers", "(", ")", ")", "{", "hcInfo", ".", "addHandlerInfo", "(", "buildHandlerInfoFromXML", "(", "handler", ")", ")", ";", "}", "return", "hcInfo", ";", "}" ]
Build the handlerChain info from web.xml @param hChain @return
[ "Build", "the", "handlerChain", "info", "from", "web", ".", "xml" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/metadata/builder/HandlerChainInfoBuilder.java#L82-L106
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/metadata/builder/HandlerChainInfoBuilder.java
HandlerChainInfoBuilder.buildHandlerInfoFromXML
public static HandlerInfo buildHandlerInfoFromXML(com.ibm.ws.javaee.dd.common.wsclient.Handler handler) { HandlerInfo hInfo = new HandlerInfo(); hInfo.setHandlerClass(handler.getHandlerClassName()); hInfo.setHandlerName(handler.getHandlerName()); for (ParamValue pv : handler.getInitParams()) { hInfo.addInitParam(new ParamValueInfo(pv.getName(), pv.getValue())); } for (String soapRole : handler.getSoapRoles()) { hInfo.addSoapRole(soapRole); } for (com.ibm.ws.javaee.dd.common.QName header : handler.getSoapHeaders()) { hInfo.addSoapHeader(new XsdQNameInfo(new QName(header.getNamespaceURI(), header.getLocalPart()), "")); } return hInfo; }
java
public static HandlerInfo buildHandlerInfoFromXML(com.ibm.ws.javaee.dd.common.wsclient.Handler handler) { HandlerInfo hInfo = new HandlerInfo(); hInfo.setHandlerClass(handler.getHandlerClassName()); hInfo.setHandlerName(handler.getHandlerName()); for (ParamValue pv : handler.getInitParams()) { hInfo.addInitParam(new ParamValueInfo(pv.getName(), pv.getValue())); } for (String soapRole : handler.getSoapRoles()) { hInfo.addSoapRole(soapRole); } for (com.ibm.ws.javaee.dd.common.QName header : handler.getSoapHeaders()) { hInfo.addSoapHeader(new XsdQNameInfo(new QName(header.getNamespaceURI(), header.getLocalPart()), "")); } return hInfo; }
[ "public", "static", "HandlerInfo", "buildHandlerInfoFromXML", "(", "com", ".", "ibm", ".", "ws", ".", "javaee", ".", "dd", ".", "common", ".", "wsclient", ".", "Handler", "handler", ")", "{", "HandlerInfo", "hInfo", "=", "new", "HandlerInfo", "(", ")", ";", "hInfo", ".", "setHandlerClass", "(", "handler", ".", "getHandlerClassName", "(", ")", ")", ";", "hInfo", ".", "setHandlerName", "(", "handler", ".", "getHandlerName", "(", ")", ")", ";", "for", "(", "ParamValue", "pv", ":", "handler", ".", "getInitParams", "(", ")", ")", "{", "hInfo", ".", "addInitParam", "(", "new", "ParamValueInfo", "(", "pv", ".", "getName", "(", ")", ",", "pv", ".", "getValue", "(", ")", ")", ")", ";", "}", "for", "(", "String", "soapRole", ":", "handler", ".", "getSoapRoles", "(", ")", ")", "{", "hInfo", ".", "addSoapRole", "(", "soapRole", ")", ";", "}", "for", "(", "com", ".", "ibm", ".", "ws", ".", "javaee", ".", "dd", ".", "common", ".", "QName", "header", ":", "handler", ".", "getSoapHeaders", "(", ")", ")", "{", "hInfo", ".", "addSoapHeader", "(", "new", "XsdQNameInfo", "(", "new", "QName", "(", "header", ".", "getNamespaceURI", "(", ")", ",", "header", ".", "getLocalPart", "(", ")", ")", ",", "\"\"", ")", ")", ";", "}", "return", "hInfo", ";", "}" ]
Build the handler info from web.xml @param handler @return
[ "Build", "the", "handler", "info", "from", "web", ".", "xml" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/metadata/builder/HandlerChainInfoBuilder.java#L114-L131
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/metadata/builder/HandlerChainInfoBuilder.java
HandlerChainInfoBuilder.resolveHandlerChainFileName
protected URL resolveHandlerChainFileName(String clzName, String fileName) { URL handlerFile = null; InputStream in = null; String handlerChainFileName = fileName; URL baseUrl = classLoader.getResource(getClassResourceName(clzName)); try { //if the filename start with '/', then find and return the resource under the web application home directory directory. if (handlerChainFileName.charAt(0) == '/') { return classLoader.getResource(handlerChainFileName.substring(1)); } //otherwise, create a new url instance according to the baseurl and the fileName handlerFile = new URL(baseUrl, handlerChainFileName); in = handlerFile.openStream(); } catch (Exception e) { // log the error msg } finally { if (in != null) { try { in.close(); } catch (Exception e) { } } } return handlerFile; }
java
protected URL resolveHandlerChainFileName(String clzName, String fileName) { URL handlerFile = null; InputStream in = null; String handlerChainFileName = fileName; URL baseUrl = classLoader.getResource(getClassResourceName(clzName)); try { //if the filename start with '/', then find and return the resource under the web application home directory directory. if (handlerChainFileName.charAt(0) == '/') { return classLoader.getResource(handlerChainFileName.substring(1)); } //otherwise, create a new url instance according to the baseurl and the fileName handlerFile = new URL(baseUrl, handlerChainFileName); in = handlerFile.openStream(); } catch (Exception e) { // log the error msg } finally { if (in != null) { try { in.close(); } catch (Exception e) { } } } return handlerFile; }
[ "protected", "URL", "resolveHandlerChainFileName", "(", "String", "clzName", ",", "String", "fileName", ")", "{", "URL", "handlerFile", "=", "null", ";", "InputStream", "in", "=", "null", ";", "String", "handlerChainFileName", "=", "fileName", ";", "URL", "baseUrl", "=", "classLoader", ".", "getResource", "(", "getClassResourceName", "(", "clzName", ")", ")", ";", "try", "{", "//if the filename start with '/', then find and return the resource under the web application home directory directory.", "if", "(", "handlerChainFileName", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "return", "classLoader", ".", "getResource", "(", "handlerChainFileName", ".", "substring", "(", "1", ")", ")", ";", "}", "//otherwise, create a new url instance according to the baseurl and the fileName", "handlerFile", "=", "new", "URL", "(", "baseUrl", ",", "handlerChainFileName", ")", ";", "in", "=", "handlerFile", ".", "openStream", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// log the error msg", "}", "finally", "{", "if", "(", "in", "!=", "null", ")", "{", "try", "{", "in", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "}", "return", "handlerFile", ";", "}" ]
Resolve handler chain configuration file associated with the given class @param clzName @param fileName @return A URL object or null if no resource with this name is found
[ "Resolve", "handler", "chain", "configuration", "file", "associated", "with", "the", "given", "class" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/metadata/builder/HandlerChainInfoBuilder.java#L356-L383
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/metadata/builder/HandlerChainInfoBuilder.java
HandlerChainInfoBuilder.sortHandlers
@SuppressWarnings("rawtypes") public static List<Handler> sortHandlers(List<Handler> handlers) { List<LogicalHandler<?>> logicalHandlers = new ArrayList<LogicalHandler<?>>(); List<Handler<?>> protocolHandlers = new ArrayList<Handler<?>>(); for (Handler<?> handler : handlers) { if (handler instanceof LogicalHandler) { logicalHandlers.add((LogicalHandler<?>) handler); } else { protocolHandlers.add(handler); } } List<Handler> sortedHandlers = new ArrayList<Handler>(logicalHandlers.size() + protocolHandlers.size()); sortedHandlers.addAll(logicalHandlers); sortedHandlers.addAll(protocolHandlers); return sortedHandlers; }
java
@SuppressWarnings("rawtypes") public static List<Handler> sortHandlers(List<Handler> handlers) { List<LogicalHandler<?>> logicalHandlers = new ArrayList<LogicalHandler<?>>(); List<Handler<?>> protocolHandlers = new ArrayList<Handler<?>>(); for (Handler<?> handler : handlers) { if (handler instanceof LogicalHandler) { logicalHandlers.add((LogicalHandler<?>) handler); } else { protocolHandlers.add(handler); } } List<Handler> sortedHandlers = new ArrayList<Handler>(logicalHandlers.size() + protocolHandlers.size()); sortedHandlers.addAll(logicalHandlers); sortedHandlers.addAll(protocolHandlers); return sortedHandlers; }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "static", "List", "<", "Handler", ">", "sortHandlers", "(", "List", "<", "Handler", ">", "handlers", ")", "{", "List", "<", "LogicalHandler", "<", "?", ">", ">", "logicalHandlers", "=", "new", "ArrayList", "<", "LogicalHandler", "<", "?", ">", ">", "(", ")", ";", "List", "<", "Handler", "<", "?", ">", ">", "protocolHandlers", "=", "new", "ArrayList", "<", "Handler", "<", "?", ">", ">", "(", ")", ";", "for", "(", "Handler", "<", "?", ">", "handler", ":", "handlers", ")", "{", "if", "(", "handler", "instanceof", "LogicalHandler", ")", "{", "logicalHandlers", ".", "add", "(", "(", "LogicalHandler", "<", "?", ">", ")", "handler", ")", ";", "}", "else", "{", "protocolHandlers", ".", "add", "(", "handler", ")", ";", "}", "}", "List", "<", "Handler", ">", "sortedHandlers", "=", "new", "ArrayList", "<", "Handler", ">", "(", "logicalHandlers", ".", "size", "(", ")", "+", "protocolHandlers", ".", "size", "(", ")", ")", ";", "sortedHandlers", ".", "addAll", "(", "logicalHandlers", ")", ";", "sortedHandlers", ".", "addAll", "(", "protocolHandlers", ")", ";", "return", "sortedHandlers", ";", "}" ]
sorts the handlers into correct order. All of the logical handlers first followed by the protocol handlers @param handlers @return sorted list of handlers
[ "sorts", "the", "handlers", "into", "correct", "order", ".", "All", "of", "the", "logical", "handlers", "first", "followed", "by", "the", "protocol", "handlers" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/metadata/builder/HandlerChainInfoBuilder.java#L438-L456
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ApplicationClassloadingServiceFactory.java
ApplicationClassloadingServiceFactory.buildServicePropsAndFilterTargets
private Dictionary<String, Object> buildServicePropsAndFilterTargets(String pid, Dictionary<String, Object> config) throws IOException, InvalidSyntaxException { Dictionary<String, Object> result = new Hashtable<String, Object>(); // we will use this later to discover the properties configured in this classloader element in config result.put("classloader.config.pid", pid); // Add the application so other DS components can key from this new classloader sevice String appFilter = "(classloader=" + pid + ")"; Configuration[] appConfigs = configAdmin.listConfigurations(appFilter); if (appConfigs.length == 1) { Configuration appConfig = appConfigs[0]; Dictionary<String, Object> properties = appConfig.getProperties(); String appName = (String) properties.get("name"); if (appName != null) { result.put("application.name", appName); } String appConfigPid = (String) properties.get("service.pid"); try { result.put("application.pid", appConfigPid); } catch (NullPointerException swallowed) { /* this will be FFDC'd */ if (tc.isDebugEnabled()) Tr.debug(tc, "service.pid is null", swallowed); } if (tc.isDebugEnabled()) Tr.debug(tc, "Creating ApplicationClassloadingService for application" + appName); } List<String> allLibraries = new ArrayList<String>(); String[] privateLibraryRefs = (String[]) config.get(LIBRARY_REF_ATT); if (privateLibraryRefs != null) { allLibraries.addAll(Arrays.asList(privateLibraryRefs)); } String[] commonLibraryRefs = (String[]) config.get(COMMON_LIBRARY_REF_ATT); if (commonLibraryRefs != null) { allLibraries.addAll(Arrays.asList(commonLibraryRefs)); } if (allLibraries.size() > 0) { String filter = buildTargetString(allLibraries); result.put("libraryStatus.target", filter); if (tc.isDebugEnabled()) Tr.debug(tc, "This application will wait for the following libraries ", filter); } else { // we need to clear the blocking target and make sure we // do get activated by setting a target we know will happen result.put("libraryStatus.target", "(id=global)"); } return result; }
java
private Dictionary<String, Object> buildServicePropsAndFilterTargets(String pid, Dictionary<String, Object> config) throws IOException, InvalidSyntaxException { Dictionary<String, Object> result = new Hashtable<String, Object>(); // we will use this later to discover the properties configured in this classloader element in config result.put("classloader.config.pid", pid); // Add the application so other DS components can key from this new classloader sevice String appFilter = "(classloader=" + pid + ")"; Configuration[] appConfigs = configAdmin.listConfigurations(appFilter); if (appConfigs.length == 1) { Configuration appConfig = appConfigs[0]; Dictionary<String, Object> properties = appConfig.getProperties(); String appName = (String) properties.get("name"); if (appName != null) { result.put("application.name", appName); } String appConfigPid = (String) properties.get("service.pid"); try { result.put("application.pid", appConfigPid); } catch (NullPointerException swallowed) { /* this will be FFDC'd */ if (tc.isDebugEnabled()) Tr.debug(tc, "service.pid is null", swallowed); } if (tc.isDebugEnabled()) Tr.debug(tc, "Creating ApplicationClassloadingService for application" + appName); } List<String> allLibraries = new ArrayList<String>(); String[] privateLibraryRefs = (String[]) config.get(LIBRARY_REF_ATT); if (privateLibraryRefs != null) { allLibraries.addAll(Arrays.asList(privateLibraryRefs)); } String[] commonLibraryRefs = (String[]) config.get(COMMON_LIBRARY_REF_ATT); if (commonLibraryRefs != null) { allLibraries.addAll(Arrays.asList(commonLibraryRefs)); } if (allLibraries.size() > 0) { String filter = buildTargetString(allLibraries); result.put("libraryStatus.target", filter); if (tc.isDebugEnabled()) Tr.debug(tc, "This application will wait for the following libraries ", filter); } else { // we need to clear the blocking target and make sure we // do get activated by setting a target we know will happen result.put("libraryStatus.target", "(id=global)"); } return result; }
[ "private", "Dictionary", "<", "String", ",", "Object", ">", "buildServicePropsAndFilterTargets", "(", "String", "pid", ",", "Dictionary", "<", "String", ",", "Object", ">", "config", ")", "throws", "IOException", ",", "InvalidSyntaxException", "{", "Dictionary", "<", "String", ",", "Object", ">", "result", "=", "new", "Hashtable", "<", "String", ",", "Object", ">", "(", ")", ";", "// we will use this later to discover the properties configured in this classloader element in config", "result", ".", "put", "(", "\"classloader.config.pid\"", ",", "pid", ")", ";", "// Add the application so other DS components can key from this new classloader sevice", "String", "appFilter", "=", "\"(classloader=\"", "+", "pid", "+", "\")\"", ";", "Configuration", "[", "]", "appConfigs", "=", "configAdmin", ".", "listConfigurations", "(", "appFilter", ")", ";", "if", "(", "appConfigs", ".", "length", "==", "1", ")", "{", "Configuration", "appConfig", "=", "appConfigs", "[", "0", "]", ";", "Dictionary", "<", "String", ",", "Object", ">", "properties", "=", "appConfig", ".", "getProperties", "(", ")", ";", "String", "appName", "=", "(", "String", ")", "properties", ".", "get", "(", "\"name\"", ")", ";", "if", "(", "appName", "!=", "null", ")", "{", "result", ".", "put", "(", "\"application.name\"", ",", "appName", ")", ";", "}", "String", "appConfigPid", "=", "(", "String", ")", "properties", ".", "get", "(", "\"service.pid\"", ")", ";", "try", "{", "result", ".", "put", "(", "\"application.pid\"", ",", "appConfigPid", ")", ";", "}", "catch", "(", "NullPointerException", "swallowed", ")", "{", "/* this will be FFDC'd */", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"service.pid is null\"", ",", "swallowed", ")", ";", "}", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Creating ApplicationClassloadingService for application\"", "+", "appName", ")", ";", "}", "List", "<", "String", ">", "allLibraries", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "String", "[", "]", "privateLibraryRefs", "=", "(", "String", "[", "]", ")", "config", ".", "get", "(", "LIBRARY_REF_ATT", ")", ";", "if", "(", "privateLibraryRefs", "!=", "null", ")", "{", "allLibraries", ".", "addAll", "(", "Arrays", ".", "asList", "(", "privateLibraryRefs", ")", ")", ";", "}", "String", "[", "]", "commonLibraryRefs", "=", "(", "String", "[", "]", ")", "config", ".", "get", "(", "COMMON_LIBRARY_REF_ATT", ")", ";", "if", "(", "commonLibraryRefs", "!=", "null", ")", "{", "allLibraries", ".", "addAll", "(", "Arrays", ".", "asList", "(", "commonLibraryRefs", ")", ")", ";", "}", "if", "(", "allLibraries", ".", "size", "(", ")", ">", "0", ")", "{", "String", "filter", "=", "buildTargetString", "(", "allLibraries", ")", ";", "result", ".", "put", "(", "\"libraryStatus.target\"", ",", "filter", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"This application will wait for the following libraries \"", ",", "filter", ")", ";", "}", "else", "{", "// we need to clear the blocking target and make sure we ", "// do get activated by setting a target we know will happen", "result", ".", "put", "(", "\"libraryStatus.target\"", ",", "\"(id=global)\"", ")", ";", "}", "return", "result", ";", "}" ]
Add the properties for this new service to allow other components locate this service @throws InvalidSyntaxException @throws IOException
[ "Add", "the", "properties", "for", "this", "new", "service", "to", "allow", "other", "components", "locate", "this", "service" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ApplicationClassloadingServiceFactory.java#L119-L172
train
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ApplicationClassloadingServiceFactory.java
ApplicationClassloadingServiceFactory.buildTargetString
private String buildTargetString(List<String> privateLibraries) { StringBuilder filter = new StringBuilder(); filter.append("(&"); for (String lib : privateLibraries) filter.append(String.format("(|(%s=%s)(%s=%s))", LibraryStatusService.LIBRARY_IDS, lib, LibraryStatusService.LIBRARY_PIDS, lib)); filter.append(")"); return filter.toString(); } @Override public String getName() { return "ApplicationClassloaderConfigurationHelper"; }
java
private String buildTargetString(List<String> privateLibraries) { StringBuilder filter = new StringBuilder(); filter.append("(&"); for (String lib : privateLibraries) filter.append(String.format("(|(%s=%s)(%s=%s))", LibraryStatusService.LIBRARY_IDS, lib, LibraryStatusService.LIBRARY_PIDS, lib)); filter.append(")"); return filter.toString(); } @Override public String getName() { return "ApplicationClassloaderConfigurationHelper"; }
[ "private", "String", "buildTargetString", "(", "List", "<", "String", ">", "privateLibraries", ")", "{", "StringBuilder", "filter", "=", "new", "StringBuilder", "(", ")", ";", "filter", ".", "append", "(", "\"(&\"", ")", ";", "for", "(", "String", "lib", ":", "privateLibraries", ")", "filter", ".", "append", "(", "String", ".", "format", "(", "\"(|(%s=%s)(%s=%s))\"", ",", "LibraryStatusService", ".", "LIBRARY_IDS", ",", "lib", ",", "LibraryStatusService", ".", "LIBRARY_PIDS", ",", "lib", ")", ")", ";", "filter", ".", "append", "(", "\")\"", ")", ";", "return", "filter", ".", "toString", "(", ")", ";", "}", "@", "Override", "public", "String", "getName", "(", ")", "{", "return", "\"ApplicationClassloaderConfigurationHelper\"", ";", "}" ]
This filter will cause the new application classloading service to block until these libraries are active Each library is added twice as it may be an automatic librari in which case its pid will not yet be known so we use the id.
[ "This", "filter", "will", "cause", "the", "new", "application", "classloading", "service", "to", "block", "until", "these", "libraries", "are", "active", "Each", "library", "is", "added", "twice", "as", "it", "may", "be", "an", "automatic", "librari", "in", "which", "case", "its", "pid", "will", "not", "yet", "be", "known", "so", "we", "use", "the", "id", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ApplicationClassloadingServiceFactory.java#L179-L191
train
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/StackFinder.java
StackFinder.matchCaller
@SuppressWarnings("unchecked") public Class<Object> matchCaller(String className) { // Walk the stack backwards to find the calling class: don't // want to use Class.forName, because we want the class as loaded // by it's original classloader Class<Object> stack[] = (Class<Object>[]) this.getClassContext(); for (Class<Object> bClass : stack) { // See if any class in the stack contains the following string if (bClass.getName().equals(className)) return bClass; } return null; }
java
@SuppressWarnings("unchecked") public Class<Object> matchCaller(String className) { // Walk the stack backwards to find the calling class: don't // want to use Class.forName, because we want the class as loaded // by it's original classloader Class<Object> stack[] = (Class<Object>[]) this.getClassContext(); for (Class<Object> bClass : stack) { // See if any class in the stack contains the following string if (bClass.getName().equals(className)) return bClass; } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "Class", "<", "Object", ">", "matchCaller", "(", "String", "className", ")", "{", "// Walk the stack backwards to find the calling class: don't", "// want to use Class.forName, because we want the class as loaded", "// by it's original classloader", "Class", "<", "Object", ">", "stack", "[", "]", "=", "(", "Class", "<", "Object", ">", "[", "]", ")", "this", ".", "getClassContext", "(", ")", ";", "for", "(", "Class", "<", "Object", ">", "bClass", ":", "stack", ")", "{", "// See if any class in the stack contains the following string", "if", "(", "bClass", ".", "getName", "(", ")", ".", "equals", "(", "className", ")", ")", "return", "bClass", ";", "}", "return", "null", ";", "}" ]
Return the class if the given classname is found on the stack. @param fragment @return boolean
[ "Return", "the", "class", "if", "the", "given", "classname", "is", "found", "on", "the", "stack", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/StackFinder.java#L101-L114
train