Package org.osgi.service.log

Examples of org.osgi.service.log.LogService


    /**
     * @see org.osgi.service.log.LogService#log(int, java.lang.String, java.lang.Throwable)
     */
    public void log(int level, String message, Throwable exception) {
        LogService logService = (LogService) getService();
        if (logService != null) {
            logService.log(level, message, exception);
        }
    }
View Full Code Here


    /**
     * @see org.osgi.service.log.LogService#log(org.osgi.framework.ServiceReference, int, java.lang.String)
     */
    public void log(ServiceReference ref, int level, String message) {
        LogService logService = (LogService) getService();
        if (logService != null) {
            logService.log(ref, level, message);
        }
    }
View Full Code Here

    /**
     * @see org.osgi.service.log.LogService#log(org.osgi.framework.ServiceReference, int, java.lang.String,
     *      java.lang.Throwable)
     */
    public void log(ServiceReference ref, int level, String message, Throwable exception) {
        LogService logService = (LogService) getService();
        if (logService != null) {
            logService.log(ref, level, message, exception);
        }
    }
View Full Code Here

     *            <code>null</code>.
     * @param t The <code>Throwable</code> to log along with the message. This
     *            may be <code>null</code>.
     */
    protected void log(int level, String message, Throwable t) {
        LogService log = this.log;
        if (log != null) {
            log.log(level, message, t);
        } else {
            System.err.print(level + " - " + message);
            if (t != null) {
                t.printStackTrace(System.err);
            }
View Full Code Here

    protected void log(int level, String message) {
        this.log(level, message, null);
    }

    protected void log(int level, String message, Throwable t) {
        LogService log = this.log;
        if (log != null) {
            if (componentContext != null) {
                log.log(componentContext.getServiceReference(), level, message,
                    t);
            } else {
                log.log(level, message, t);
            }
        }
    }
View Full Code Here

    @Test
    public void testLogService() throws Exception {
        Runtime runtime = RuntimeLocator.getRequiredRuntime();
        Module module = runtime.getModule(getClass().getClassLoader());

        LogService log = getLogService(module.getModuleContext());
        String msg = "LogServiceTest LogService ";
        log.log(LogService.LOG_ERROR, msg + " ERROR");
        log.log(LogService.LOG_WARNING, msg + " WARNING");
        log.log(LogService.LOG_INFO, msg + " INFO");
        log.log(LogService.LOG_DEBUG, msg + " DEBUG");
    }
View Full Code Here

        super(context, LogService.class.getName(), null);
    }

    public void log(int level, String message)
    {
        LogService log = getLog();
        if (log != null)
        {
            log.log(level, message);
        }

    }
View Full Code Here

    }

    public void log(int level, String message, Throwable exception)
    {
        LogService log = getLog();
        if (log != null)
        {
            log.log(level, message, exception);
        }
    }
View Full Code Here

*/
public class DropAllBundlesCommand extends Command {

    protected void doExecute(DeploymentSessionImpl session) throws Exception {
        AbstractDeploymentPackage target = session.getTargetAbstractDeploymentPackage();
        LogService log = session.getLog();

        BundleInfoImpl[] orderedTargetBundles = target.getOrderedBundleInfos();
        for (int i = orderedTargetBundles.length - 1; i >= 0; i--) {
            BundleInfoImpl bundleInfo = orderedTargetBundles[i];
            // stale bundle, save a copy for rolling back and uninstall it
            String symbolicName = bundleInfo.getSymbolicName();
            try {
                Bundle bundle = target.getBundle(symbolicName);
                if (bundle != null) {
                    bundle.uninstall();
                    addRollback(new InstallBundleRunnable(bundle, target, log));
                }
            }
            catch (Exception be) {
                log.log(LogService.LOG_WARNING, "Bundle '" + symbolicName + "' could not be uninstalled", be);
            }
        }
    }
View Full Code Here

public class DropBundleCommand extends Command {

    protected void doExecute(DeploymentSessionImpl session) throws Exception {
        AbstractDeploymentPackage target = session.getTargetAbstractDeploymentPackage();
        AbstractDeploymentPackage source = session.getSourceAbstractDeploymentPackage();
        LogService log = session.getLog();

        BundleInfoImpl[] orderedTargetBundles = target.getOrderedBundleInfos();
        for (int i = orderedTargetBundles.length - 1; i >= 0; i--) {
            BundleInfoImpl bundleInfo = orderedTargetBundles[i];
            String symbolicName = bundleInfo.getSymbolicName();

            if (!bundleInfo.isCustomizer() && source.getBundleInfoByName(symbolicName) == null) {
                // stale bundle, save a copy for rolling back and uninstall it
                try {
                    Bundle bundle = target.getBundle(symbolicName);
                    bundle.uninstall();
                    addRollback(new InstallBundleRunnable(bundle, target, log));
                }
                catch (Exception be) {
                    log.log(LogService.LOG_WARNING, "Bundle '" + symbolicName + "' could not be uninstalled", be);
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.osgi.service.log.LogService

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.