| | |
| | | |
| | | import static org.opends.server.loggers.ErrorLogger.logError; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import static org.opends.server.messages.AdminMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.getMessage; |
| | | import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString; |
| | |
| | | public final class ClassLoaderProvider { |
| | | |
| | | /** |
| | | * The tracer object for the debug logger. |
| | | */ |
| | | private static final DebugTracer TRACER = getTracer(); |
| | | |
| | | /** |
| | | * Private URLClassLoader implementation. This is only required so |
| | | * that we can provide access to the addURL method. |
| | | */ |
| | |
| | | loader.addJarFile(extension); |
| | | } catch (Exception e) { |
| | | if (debugEnabled()) { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_ADMIN_CANNOT_OPEN_JAR_FILE; |
| | |
| | | addExtension(extensionsPath.listFiles(filter)); |
| | | } catch (InitializationException e) { |
| | | if (debugEnabled()) { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | throw e; |
| | | } catch (Exception e) { |
| | | if (debugEnabled()) { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_ADMIN_EXTENSIONS_CANNOT_LIST_FILES; |
| | |
| | | loadDefinitionClasses(is); |
| | | } catch (IOException e) { |
| | | if (debugEnabled()) { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_ADMIN_CANNOT_READ_CORE_MANIFEST; |
| | |
| | | throw new InitializationException(msgID, message); |
| | | } catch (Exception e) { |
| | | if (debugEnabled()) { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_ADMIN_CANNOT_LOAD_CLASS_FROM_CORE_MANIFEST; |
| | |
| | | is = jarFile.getInputStream(entry); |
| | | } catch (Exception e) { |
| | | if (debugEnabled()) { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_ADMIN_CANNOT_READ_EXTENSION_MANIFEST; |
| | |
| | | loadDefinitionClasses(is); |
| | | } catch (IOException e) { |
| | | if (debugEnabled()) { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_ADMIN_CANNOT_READ_EXTENSION_MANIFEST; |
| | |
| | | throw new InitializationException(msgID, message); |
| | | } catch (Exception e) { |
| | | if (debugEnabled()) { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_ADMIN_CANNOT_LOAD_CLASS_FROM_EXTENSION_MANIFEST; |
| | |
| | | continue; |
| | | } |
| | | |
| | | debugMessage(DebugLogLevel.INFO, "Loading class " + className); |
| | | TRACER.debugMessage(DebugLogLevel.INFO, "Loading class " + className); |
| | | |
| | | // Use the underlying loader. |
| | | Class.forName(className, true, loader); |
| | |
| | | jarFile = new JarFile(jar); |
| | | } catch (Exception e) { |
| | | if (debugEnabled()) { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_ADMIN_CANNOT_OPEN_JAR_FILE; |