Package org.eclipse.osgi.framework.log

Examples of org.eclipse.osgi.framework.log.FrameworkLogEntry


    try {
      Field frameworkLogField = NLS.class.getDeclaredField("frameworkLog"); //$NON-NLS-1$
      frameworkLogField.setAccessible(true);
      frameworkLogField.set(null, adaptor.getFrameworkLog());
    } catch (Exception e) {
      adaptor.getFrameworkLog().log(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, e.getMessage(), 0, e, null));
    }
  }
View Full Code Here


      }
      contextFinder = new ContextFinder(parent);
      current.setContextClassLoader(contextFinder);
      return;
    } catch (Exception e) {
      FrameworkLogEntry entry = new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.INFO, 0, NLS.bind(Msg.CANNOT_SET_CONTEXTFINDER, null), 0, e, null);
      adaptor.getFrameworkLog().log(entry);
    }

  }
View Full Code Here

      if (!(e instanceof StatusException) && (bundledata.getStatus() & Constants.BUNDLE_LAZY_START) != 0 && !testStateChanging(Thread.currentThread()))
        try {
          // only start the bundle if this is a simple CNFE
          loader.setLazyTrigger();
        } catch (BundleException be) {
          framework.adaptor.getFrameworkLog().log(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.WARNING, 0, be.getMessage(), 0, be, null));
        }
      throw e;
    }
  }
View Full Code Here

      }
    }

    FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null : childlist.toArray(new FrameworkLogEntry[childlist.size()]));

    return new FrameworkLogEntry(status, status.getPlugin(), status.getSeverity(), status.getCode(), status.getMessage(), stackCode, t, children);
  }
View Full Code Here

    if (logEntry instanceof ExtendedLogEntry)
      context = ((ExtendedLogEntry) logEntry).getContext();
    if (context instanceof IStatus)
      return (IStatus) context;
    if (context instanceof FrameworkLogEntry) {
      FrameworkLogEntry fLogEntry = (FrameworkLogEntry) context;
      context = fLogEntry.getContext();
      if (context instanceof IStatus)
        return (IStatus) context;
      return convertToStatus(fLogEntry);
    }
    return convertRawEntryToStatus(logEntry);
View Full Code Here

    } catch (Throwable e) {
      // ensure the splash screen is down
      if (endSplashHandler != null)
        endSplashHandler.run();
      // may use startupFailed to understand where the error happened
      FrameworkLogEntry logEntry = new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, startupFailed ? EclipseAdaptorMsg.ECLIPSE_STARTUP_STARTUP_ERROR : EclipseAdaptorMsg.ECLIPSE_STARTUP_APP_ERROR, 1, e, null);
      if (log != null)
        log.log(logEntry);
      else
        // TODO desperate measure - ideally, we should write this to disk (a la Main.log)
        e.printStackTrace();
    } finally {
      try {
        // The application typically sets the exit code however the framework can request that
        // it be re-started. We need to check for this and potentially override the exit code.
        if (isForcedRestart())
          FrameworkProperties.setProperty(PROP_EXITCODE, "23"); //$NON-NLS-1$
        if (!Boolean.valueOf(FrameworkProperties.getProperty(PROP_NOSHUTDOWN)).booleanValue())
          shutdown();
      } catch (Throwable e) {
        FrameworkLogEntry logEntry = new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, EclipseAdaptorMsg.ECLIPSE_STARTUP_SHUTDOWN_ERROR, 1, e, null);
        if (log != null)
          log.log(logEntry);
        else
          // TODO desperate measure - ideally, we should write this to disk (a la Main.log)
          e.printStackTrace();
View Full Code Here

    try {
      for (int i = 0; i < bundles.length; i++) {
        if (bundles[i].getState() != Bundle.ACTIVE) {
          if (bundles[i].getState() == Bundle.INSTALLED) {
            // Log that the bundle is not resolved
            log.log(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, NLS.bind(EclipseAdaptorMsg.ECLIPSE_STARTUP_ERROR_BUNDLE_NOT_RESOLVED, bundles[i].getLocation()), 0, null, null));
            continue;
          }
          // check that the startlevel allows the bundle to be active (111550)
          if (tracker == null) {
            tracker = new ServiceTracker(context, StartLevel.class.getName(), null);
            tracker.open();
          }
          StartLevel sl = (StartLevel) tracker.getService();
          if (sl != null && (sl.getBundleStartLevel(bundles[i]) <= sl.getStartLevel())) {
            log.log(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, NLS.bind(EclipseAdaptorMsg.ECLIPSE_STARTUP_ERROR_BUNDLE_NOT_ACTIVE, bundles[i]), 0, null, null));
          }
        }
      }
    } finally {
      if (tracker != null)
View Full Code Here

        String symbolicName = description.getSymbolicName() == null ? FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME : description.getSymbolicName();
        String generalMessage = NLS.bind(EclipseAdaptorMsg.ECLIPSE_STARTUP_ERROR_BUNDLE_NOT_RESOLVED, description.getLocation());
        ArrayList constraints = (ArrayList) missing.get(description);
        FrameworkLogEntry[] logChildren = new FrameworkLogEntry[constraints.size()];
        for (int i = 0; i < logChildren.length; i++)
          logChildren[i] = new FrameworkLogEntry(symbolicName, FrameworkLogEntry.WARNING, 0, MessageHelper.getResolutionFailureMessage((VersionConstraint) constraints.get(i)), 0, null, null);
        rootChildren[rootIndex] = new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.WARNING, 0, generalMessage, 0, null, logChildren);
      }
      logService.log(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.WARNING, 0, EclipseAdaptorMsg.ECLIPSE_STARTUP_ROOTS_NOT_RESOLVED, 0, null, rootChildren));
    }

    // There may be some bundles unresolved for other reasons, causing the system to be unresolved
    // log all unresolved constraints now
    ArrayList allChildren = new ArrayList();
    for (int i = 0; i < bundles.length; i++)
      if (bundles[i].getState() == Bundle.INSTALLED) {
        String symbolicName = bundles[i].getSymbolicName() == null ? FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME : bundles[i].getSymbolicName();
        String generalMessage = NLS.bind(EclipseAdaptorMsg.ECLIPSE_STARTUP_ERROR_BUNDLE_NOT_RESOLVED, bundles[i]);
        BundleDescription description = state.getBundle(bundles[i].getBundleId());
        // for some reason, the state does not know about that bundle
        if (description == null)
          continue;
        FrameworkLogEntry[] logChildren = null;
        VersionConstraint[] unsatisfied = stateHelper.getUnsatisfiedConstraints(description);
        if (unsatisfied.length > 0) {
          // the bundle wasn't resolved due to some of its constraints were unsatisfiable
          logChildren = new FrameworkLogEntry[unsatisfied.length];
          for (int j = 0; j < unsatisfied.length; j++)
            logChildren[j] = new FrameworkLogEntry(symbolicName, FrameworkLogEntry.WARNING, 0, MessageHelper.getResolutionFailureMessage(unsatisfied[j]), 0, null, null);
        } else {
          ResolverError[] resolverErrors = state.getResolverErrors(description);
          if (resolverErrors.length > 0) {
            logChildren = new FrameworkLogEntry[resolverErrors.length];
            for (int j = 0; j < resolverErrors.length; j++)
              logChildren[j] = new FrameworkLogEntry(symbolicName, FrameworkLogEntry.WARNING, 0, resolverErrors[j].toString(), 0, null, null);
          }
        }

        allChildren.add(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.WARNING, 0, generalMessage, 0, null, logChildren));
      }
    if (allChildren.size() > 0)
      logService.log(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.WARNING, 0, EclipseAdaptorMsg.ECLIPSE_STARTUP_ALL_NOT_RESOLVED, 0, null, (FrameworkLogEntry[]) allChildren.toArray(new FrameworkLogEntry[allChildren.size()])));
  }
View Full Code Here

        name = name.substring(0, index);
      }
      try {
        URL location = searchForBundle(name, syspath);
        if (location == null) {
          FrameworkLogEntry entry = new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, NLS.bind(EclipseAdaptorMsg.ECLIPSE_STARTUP_BUNDLE_NOT_FOUND, installEntries[i]), 0, null, null);
          log.log(entry);
          // skip this entry
          continue;
        }
        location = makeRelative(LocationManager.getInstallLocation().getURL(), location);
        String locationString = INITIAL_LOCATION + location.toExternalForm();
        result.add(new InitialBundle(locationString, location, level, start));
      } catch (IOException e) {
        log.log(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, e.getMessage(), 0, e, null));
      }
    }
    return (InitialBundle[]) result.toArray(new InitialBundle[result.size()]);
  }
View Full Code Here

      if (!found)
        try {
          curInitBundles[i].uninstall();
          toRefresh.add(curInitBundles[i]);
        } catch (BundleException e) {
          FrameworkLogEntry entry = new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, NLS.bind(EclipseAdaptorMsg.ECLIPSE_STARTUP_FAILED_UNINSTALL, curInitBundles[i].getLocation()), 0, e, null);
          log.log(entry);
        }
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.osgi.framework.log.FrameworkLogEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.