All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.osgi.service.log.LogReaderService Maven / Gradle / Ivy

/*
 * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.osgi.service.log;

import java.util.Enumeration;

/**
 * Provides methods to retrieve LogEntry objects from the log.
 * 

* There are two ways to retrieve LogEntry objects: *

    *
  • The primary way to retrieve LogEntry objects is to register a * LogListener object whose LogListener.logged method will * be called for each entry added to the log. *
  • To retrieve past LogEntry objects, the getLog * method can be called which will return an Enumeration of all * LogEntry objects in the log. * * @ThreadSafe * @version $Revision: 5654 $ * @see LogEntry * @see LogListener * @see LogListener#logged(LogEntry) */ public interface LogReaderService { /** * Subscribes to LogEntry objects. * *

    * This method registers a LogListener object with the Log Reader * Service. The LogListener.logged(LogEntry) method will be * called for each LogEntry object placed into the log. * *

    * When a bundle which registers a LogListener object is stopped * or otherwise releases the Log Reader Service, the Log Reader Service must * remove all of the bundle's listeners. * *

    * If this Log Reader Service's list of listeners already contains a * listener l such that (l==listener), this method * does nothing. * * @param listener A LogListener object to register; the * LogListener object is used to receive LogEntry * objects. * @see LogListener * @see LogEntry * @see LogListener#logged(LogEntry) */ public void addLogListener(LogListener listener); /** * Unsubscribes to LogEntry objects. * *

    * This method unregisters a LogListener object from the Log * Reader Service. * *

    * If listener is not contained in this Log Reader Service's list * of listeners, this method does nothing. * * @param listener A LogListener object to unregister. * @see LogListener */ public void removeLogListener(LogListener listener); /** * Returns an Enumeration of all LogEntry objects in * the log. * *

    * Each element of the enumeration is a LogEntry object, ordered * with the most recent entry first. Whether the enumeration is of all * LogEntry objects since the Log Service was started or some * recent past is implementation-specific. Also implementation-specific is * whether informational and debug LogEntry objects are included * in the enumeration. * @return An Enumeration of all LogEntry objects in * the log. */ public Enumeration getLog(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy