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

net.sf.eBus.messages.ESystemMessage Maven / Gradle / Ivy

//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later
// version.
//
// This library is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the GNU Lesser General Public License for more
// details.
//
// You should have received a copy of the GNU Lesser General
// Public License along with this library; if not, write to the
//
// Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330,
// Boston, MA
// 02111-1307 USA
//
// The Initial Developer of the Original Code is Charles W. Rapp.
// Portions created by Charles W. Rapp are
// Copyright 2013, 2016. Charles W. Rapp
// All Rights Reserved.
//

package net.sf.eBus.messages;

import java.io.Serializable;

/**
 * Required base class for all system messages. Note that system
 * messages may not be used by applications. If an eBus
 * application extends this class, it will not be able to send
 * or received such a message. System messages are meant for
 * internal eBus use only.
 *
 * @author Charles Rapp
 */

@EFieldInfo (fields = {})
public abstract class ESystemMessage
    extends EMessage
    implements Serializable
{
//---------------------------------------------------------------
// Member data.
//

    //-----------------------------------------------------------
    // Constants.
    //

    /**
     * All system messages use the same subject: "/eBus".
     */
    public static final String SYSTEM_SUBJECT = "/eBus";

    /**
     * Serialization version identifier.
     */
    private static final long serialVersionUID = 0x060100L;

//---------------------------------------------------------------
// Member methods.
//

    //-----------------------------------------------------------
    // Constructors.
    //

    /**
     * Creates an eBus system message using the default values:
     * {@link #SYSTEM_SUBJECT /eBus subject}, and the current
     * time.
     *
     * @see #ESystemMessage(String, long)
     */
    protected ESystemMessage()
        throws IllegalArgumentException
    {
        super (SYSTEM_SUBJECT,
               System.currentTimeMillis(),
               MessageType.SYSTEM);
    } // end of ESystemMessage(String)

    /**
     * Creates a new system message instance with the given
     * subject and timestamp.
     * @param subject the required message subject.
     * @param timestamp the message timestamp in Java millisecond
     * epoch time.
     * @throws IllegalArgumentException
     * if {@code subject} is either of {@code null} or empty.
     */
    protected ESystemMessage(final String subject,
                             final long timestamp)
        throws IllegalArgumentException
    {
        super (subject, timestamp, MessageType.SYSTEM);
    } // end of ESystemMessage(String, long)

    //
    // end of Constructors.
    //-----------------------------------------------------------
} // end of class ESystemMessage




© 2015 - 2025 Weber Informatics LLC | Privacy Policy