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

atom.app.AuditEvent Maven / Gradle / Ivy

/*
 * Copyright © 2014 Geeoz, and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * The Research Projects is dual-licensed under the GNU General Public
 * License, version 2.0 (GPLv2) and the Geeoz Commercial License.
 *
 * Solely for non-commercial purposes. A purpose is non-commercial only if
 * it is in no manner primarily intended for or directed toward commercial
 * advantage or private monetary compensation.
 *
 * This Geeoz Software is supplied to you by Geeoz in consideration of your
 * agreement to the following terms, and your use, installation, modification
 * or redistribution of this Geeoz Software constitutes acceptance of these
 * terms. If you do not agree with these terms, please do not use, install,
 * modify or redistribute this Geeoz Software.
 *
 * Neither the name, trademarks, service marks or logos of Geeoz may be used
 * to endorse or promote products derived from the Geeoz Software without
 * specific prior written permission from Geeoz.
 *
 * The Geeoz Software is provided by Geeoz on an "AS IS" basis. GEEOZ MAKES NO
 * WARRANTIES, EXPRESS  OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE, REGARDING THE GEEOZ SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
 * COMBINATION WITH YOUR PRODUCTS.
 *
 * IN NO EVENT SHALL GEEOZ BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION
 * AND/OR DISTRIBUTION OF THE GEEOZ SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER
 * THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
 * OTHERWISE, EVEN IF GEEOZ HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * A copy of the GNU General Public License is included in the distribution in
 * the file LICENSE and at
 *
 *     http://www.gnu.org/licenses/gpl-2.0.html
 *
 * If you are using the Research Projects for commercial purposes, we
 * encourage you to visit
 *
 *     http://products.geeoz.com/license
 *
 * for more details.
 *
 * This software or hardware and documentation may provide access to
 * or information on content, products, and services from third parties.
 * Geeoz and its affiliates are not responsible for and expressly disclaim
 * all warranties of any kind with respect to third-party content, products,
 * and services. Geeoz and its affiliates will not be responsible for any loss,
 * costs, or damages incurred due to your access to or use of third-party
 * content, products, or services. If a third-party content exists, the
 * additional copyright notices and license terms applicable to portions of the
 * software are set forth in the THIRD_PARTY_LICENSE_README file.
 *
 * Please contact Geeoz or visit www.geeoz.com if you need additional
 * information or have any questions.
 */

package atom.app;

import java.util.EventObject;

/**
 * Audit manager that provide storing and processing of the system audit events.
 *
 * @author Alex Voloshyn
 * @version 1.0 9/5/14
 */
public final class AuditEvent extends EventObject {
    /**
     * Use serialVersionUID from JDK 1.0.2 for interoperability.
     */
    private static final long serialVersionUID = 2264472250901974885L;
    /**
     * User name for system events.
     */
    public static final String SYSTEM = "SYSTEM";
    /**
     * SEVERE is a severity level indicating a serious failure.
     * 

* In general SEVERE messages should describe events that are * of considerable importance and which will prevent normal * program execution. They should be reasonably intelligible * to end users and to system administrators. * This level is initialized to 1000. */ public static final short SEVERE = 1000; /** * WARNING is a severity level indicating a potential problem. *

* In general WARNING messages should describe events that will * be of interest to end users or system managers, or which * indicate potential problems. * This level is initialized to 900. */ public static final short WARNING = 900; /** * INFO is a severity level for informational messages. *

* Typically INFO messages will be written to the console * or its equivalent. So the INFO level should only be * used for reasonably significant messages that will * make sense to end users and system administrators. * This level is initialized to 800. */ public static final short INFO = 800; /** * CONFIG is a severity level for static configuration messages. *

* CONFIG messages are intended to provide a variety of static * configuration information, to assist in debugging problems * that may be associated with particular configurations. * For example, CONFIG message might include the CPU type, * the graphics depth, the GUI look-and-feel, etc. * This level is initialized to 700. */ public static final short CONFIG = 700; /** * FINE is a severity level providing tracing information. *

* FINE is intended for relatively detailed tracing. *

* In general the FINE severity level should be used for information * that will be broadly interesting to developers who do not have * a specialized interest in the specific subsystem. *

* This level is initialized to 500. */ public static final short FINE = 500; /** * Empty object array. */ private static final Object[] EMPTY_ARRAY = new Object[]{}; /** * Type of the audit event. */ private final String type; /** * Severity of the audit event. */ private final short severity; /** * Action that has happened. */ private final String action; /** * User ID at time of audit event. */ private final String userId; /** * User name at time of audit event. */ private final String userName; /** * An array of the additional parameters of the event. */ private final Object[] additionalInfo; /** * Create an audit event with all set of base parameters. * * @param source the object on which the Event initially occurred * @param eventType a type of the audit event * @param level a severity of the audit event * @param eventAction an action that had happened * @param identity user ID at time of audit event * @param name user name at time of audit event * @param params an array of the additional parameters of the event */ private AuditEvent(final Object source, final String eventType, final short level, final String eventAction, final String identity, final String name, final Object... params) { super(source); type = eventType; severity = level; action = eventAction; userId = identity; userName = name; additionalInfo = params; } /** * Create an audit event with all set of base parameters. * * @param source the object on which the Event initially occurred * @param category a type of the audit event * @param level a severity of the audit event * @param eventAction an action that had happened * @param params an array of the additional parameters of the event * @return an new audit event */ public static AuditEvent create(final Object source, final String category, final short level, final String eventAction, final Object... params) { return new AuditEvent( source, category, level, eventAction, null, null, params); } /** * Create an audit event with all set of base parameters. * * @param source the object on which the Event initially occurred * @param identity user ID at time of audit event * @param name user name at time of audit event * @param category a type of the audit event * @param level a severity of the audit event * @param eventAction an action that had happened * @param params an array of the additional parameters of the event * @return an new audit event */ public static AuditEvent create(final Object source, final String identity, final String name, final String category, final short level, final String eventAction, final Object... params) { return new AuditEvent( source, category, level, eventAction, identity, name, params); } /** * Retrieve a type of the audit event. * * @return a type of the audit event */ public String getType() { return type; } /** * Retrieve a severity of the audit event. * * @return a severity of the audit event */ public short getSeverity() { return severity; } /** * Retrieve an action that had happened. * * @return an action that had happened */ public String getAction() { return action; } /** * Retrieve user ID at time of audit event. * * @return user ID at time of audit event */ public String getUserId() { return userId; } /** * Retrieve ser name at time of audit event. * * @return ser name at time of audit event */ public String getUserName() { return userName; } /** * Retrieve an array of the additional parameters of the event. * * @return an array of the additional parameters of the event */ public Object[] getAdditionalInfo() { if (additionalInfo != null) { return additionalInfo.clone(); } return EMPTY_ARRAY; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy