001package net.sf.logdistiller;
002
003/*
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017import java.io.IOException;
018
019/**
020 * Base class of report publishers, for both global and group reports.
021 */
022public abstract class Publisher
023{
024    /**
025     * Get the publisher-id for this class.
026     *
027     * @return a unique publisher id
028     */
029    public abstract String getId();
030
031    /**
032     * Publish a global report.
033     *
034     * @param logdistillation the logdistillation containing the results to publish
035     * @param report the report configuration
036     * @throws IOException
037     * @throws PublishException
038     */
039    public abstract void publish( LogDistillation logdistillation, LogDistiller.Report report )
040        throws IOException, PublishException;
041
042    /**
043     * Publish a group report.
044     *
045     * @param group the logdstillation group containing the results to publish
046     * @param report the report configuration
047     * @throws IOException
048     * @throws PublishException
049     */
050    public abstract void publish( LogDistillation.Group group, LogDistiller.Report report )
051        throws IOException, PublishException;
052
053    public static class PublishException
054        extends Exception
055    {
056        private static final long serialVersionUID = 498326805296616769L;
057
058        public PublishException( String message, Throwable nested )
059        {
060            super( message, nested );
061        }
062    }
063}