001 // SECTION-START[License Header]
002 /*
003 * Copyright (c) 2009 The JOMC Project
004 * Copyright (c) 2005 Christian Schulte <cs@jomc.org>
005 * All rights reserved.
006 *
007 * Redistribution and use in source and binary forms, with or without
008 * modification, are permitted provided that the following conditions
009 * are met:
010 *
011 * o Redistributions of source code must retain the above copyright
012 * notice, this list of conditions and the following disclaimer.
013 *
014 * o Redistributions in binary form must reproduce the above copyright
015 * notice, this list of conditions and the following disclaimer in
016 * the documentation and/or other materials provided with the
017 * distribution.
018 *
019 * THIS SOFTWARE IS PROVIDED BY THE JOMC PROJECT AND CONTRIBUTORS "AS IS"
020 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
021 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
022 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JOMC PROJECT OR
023 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
024 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
025 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
026 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
027 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
028 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
029 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
030 *
031 * $Id: Listener.java 540 2009-09-21 18:50:19Z schulte2005 $
032 *
033 */
034 // SECTION-END
035 package org.jomc.spi;
036
037 import java.util.logging.Level;
038
039 // SECTION-START[Documentation]
040 /**
041 * Object management and configuration listener interface.
042 * <p>This specification declares a multiplicity of {@code Many}.
043 * An application assembler may provide multiple implementations of this specification (including none).
044 * Use of class {@link org.jomc.ObjectManager ObjectManager} is supported for getting these implementations or for
045 * selecting a single implementation.<pre>
046 * Listener[] objects = (Listener[]) ObjectManagerFactory.getObjectManager().getObject( Listener.class );
047 * Listener object = ObjectManagerFactory.getObjectManager().getObject( Listener.class, "<i>implementation name</i>" );
048 * </pre>
049 * </p>
050 *
051 * <p>This specification does not apply to any scope. A new object is returned whenever requested.</p>
052 *
053 * @author <a href="mailto:cs@jomc.org">Christian Schulte</a> 1.0
054 * @version $Id: Listener.java 540 2009-09-21 18:50:19Z schulte2005 $
055 */
056 // SECTION-END
057 // SECTION-START[Annotations]
058 @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
059 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-1/jomc-tools" )
060 // SECTION-END
061 public interface Listener
062 {
063 // SECTION-START[ObjectManagementListener]
064
065 /**
066 * Get called on logging.
067 *
068 * @param level The level of the event.
069 * @param message The message of the event or {@code null}.
070 * @param throwable The throwable of the event or {@code null}.
071 *
072 * @throws NullPointerException if {@code level} is {@code null}.
073 */
074 void onLog( Level level, String message, Throwable throwable ) throws NullPointerException;
075
076 // SECTION-END
077 }