@Override
public void engineStarted(WebSocketEngine aEngine) {
// TODO: move JWebSocketJarClassLoader into ServerAPI module ?
JWebSocketJarClassLoader lClassLoader = new JWebSocketJarClassLoader();
Class lClass = null;
// load map of RPC libraries first
// also load map of granted procs
Map<String, String> lSettings = getSettings();
String lKey;
String lValue;
for (Entry<String, String> lSetting : lSettings.entrySet()) {
lKey = lSetting.getKey();
lValue = lSetting.getValue();
if (lKey.startsWith("class:")) {
String lClassName = lKey.substring(6);
try {
if (mLog.isDebugEnabled()) {
mLog.debug("Trying to load class '" + lClassName + "' from classpath...");
}
lClass = Class.forName(lClassName);
} catch (Exception ex) {
mLog.error(ex.getClass().getSimpleName()
+ " loading class from classpath: "
+ ex.getMessage()
+ ", hence trying to load from jar.");
}
// if class could not be loaded from classpath...
if (lClass == null) {
String lJarFilePath = null;
try {
lJarFilePath = JWebSocketConfig.getLibraryFolderPath(lValue);
if (mLog.isDebugEnabled()) {
mLog.debug("Trying to load class '" + lClassName + "' from jar '" + lJarFilePath + "'...");
}
lClassLoader.addFile(lJarFilePath);
lClass = lClassLoader.loadClass(lClassName);
if (mLog.isDebugEnabled()) {
mLog.debug("Class '" + lClassName + "' successfully loaded from '" + lJarFilePath + "'.");
}
} catch (Exception ex) {
mLog.error(ex.getClass().getSimpleName() + " loading jar '" + lJarFilePath + "': " + ex.getMessage());