Java Code Examples for org.osgi.framework.FrameworkEvent#ERROR
The following examples show how to use
org.osgi.framework.FrameworkEvent#ERROR .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NetbinoxHooks.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void log(FrameworkEvent fe) { Level l = Level.FINE; if ((fe.getType() & FrameworkEvent.ERROR) != 0) { l = Level.SEVERE; } else if ((fe.getType() & FrameworkEvent.WARNING) != 0) { l = Level.WARNING; } else if ((fe.getType() & FrameworkEvent.INFO) != 0) { l = Level.INFO; } LogRecord lr = new LogRecord(l, "framework event {0} type {1}"); lr.setParameters(new Object[]{fe.getBundle().getSymbolicName(), fe.getType()}); lr.setThrown(fe.getThrowable()); lr.setLoggerName(NetbinoxFactory.LOG.getName()); NetbinoxFactory.LOG.log(lr); }
Example 2
Source File: FrameworkLifecycleHandler.java From atlas with Apache License 2.0 | 5 votes |
@Override public void frameworkEvent(FrameworkEvent event) { switch (event.getType()) { case 0:/* STARTING */ starting(); break; case FrameworkEvent.STARTED: started(); break; case FrameworkEvent.STARTLEVEL_CHANGED: case FrameworkEvent.PACKAGES_REFRESHED: case FrameworkEvent.ERROR: } }
Example 3
Source File: LogFrameworkListener.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * The framework event callback method inserts all framework events into * the log. Events of type <code>error</code> are logged at the error * level other event types are logged on the info level. * <p/> * FrameworkListener callback. * * @param fe * the framework event that has occurred. */ public void frameworkEvent(FrameworkEvent fe) { int level = LogService.LOG_INFO; String msg = null; // We always include the Exception even though // the specification says differently Throwable thr = fe.getThrowable(); switch (fe.getType()) { case FrameworkEvent.ERROR: msg = "FrameworkEvent ERROR"; level = LogService.LOG_ERROR; break; case FrameworkEvent.STARTED: msg = "FrameworkEvent STARTED"; level = LogService.LOG_INFO; break; case FrameworkEvent.STARTLEVEL_CHANGED: msg = "FrameworkEvent STARTLEVEL_CHANGED"; level = LogService.LOG_INFO; break; case FrameworkEvent.PACKAGES_REFRESHED: msg = "FrameworkEvent PACKAGES_REFRESHED"; level = LogService.LOG_INFO; break; case FrameworkEvent.WARNING: msg = "FrameworkEvent WARNING"; level = LogService.LOG_INFO; // sic! According to spec. break; case FrameworkEvent.INFO: msg = "FrameworkEvent INFO"; level = LogService.LOG_INFO; break; default: msg = "FrameworkEvent <" + fe.getType() + ">"; level = LogService.LOG_WARNING; break; } lrsf.log(new LogEntryImpl(fe.getBundle(), level, msg, thr)); }
Example 4
Source File: Listeners.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * */ private void frameworkEvent(final ListenerEntry le, FrameworkEvent evt) { try { ((FrameworkListener)le.listener).frameworkEvent(evt); } catch (final Exception pe) { // Don't report Error events again, since probably would go into an infinite loop. if (evt.getType() != FrameworkEvent.ERROR) { fwCtx.frameworkError(le != null ? le.bc : null, pe); } } }
Example 5
Source File: KfApk.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Method that can be used to wait for a started framework to be * shut down. * * @param fw the framework to wait on. */ public static void waitForStop(Framework fw) { while (true) { // Ignore interrupted exception. try { FrameworkEvent stopEvent = fw.waitForStop(0L); switch (stopEvent.getType()) { case FrameworkEvent.STOPPED: // FW terminated, Main is done! Log.i(KfApk.class.getName(), "Framework terminated"); return; case FrameworkEvent.STOPPED_UPDATE: // Automatic FW restart, wait again. break; case FrameworkEvent.STOPPED_BOOTCLASSPATH_MODIFIED: // A manual FW restart with new boot class path is needed. return; // TODO case FrameworkEvent.ERROR: // Stop failed or other error, give up. Log.i(KfApk.class.getName(), "Fatal framework error, terminating.", stopEvent.getThrowable()); return; case FrameworkEvent.WAIT_TIMEDOUT: // Should not happen with timeout==0, give up. Log.i(KfApk.class.getName(), "Framework waitForStop(0) timed out!", stopEvent.getThrowable()); break; } } catch (final InterruptedException ie) { } } }
Example 6
Source File: NetbinoxHooks.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void frameworkEvent(FrameworkEvent ev) { if (ev.getType() == FrameworkEvent.ERROR) { log(ev); } }