jdk/src/share/classes/javax/sql/StatementEvent.java
author ohair
Wed, 26 May 2010 20:28:04 -0700
changeset 5551 327690766109
parent 5506 202f599c92aa
child 11129 f9ad1aadf3fa
permissions -rw-r--r--
6956202: Fix a few missed rebranding issues, please contact lines etc. Reviewed-by: jjg, darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * Created on Apr 28, 2005
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
package javax.sql;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.sql.PreparedStatement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.sql.SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.EventObject;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * A <code>StatementEvent</code> is sent to all <code>StatementEventListener</code>s which were
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * registered with a <code>PooledConnection</code>. This occurs when the driver determines that a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <code>PreparedStatement</code> that is associated with the <code>PooledConnection</code> has been closed or the driver determines
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * is invalid.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
public class StatementEvent extends EventObject {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
        private SQLException            exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
        private PreparedStatement       statement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
         * Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
         * <code>PreparedStatement</code>.  The <code>SQLException</code> contained in the event defaults to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
         * null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
         * @param con                   The <code>PooledConnection</code> that the closed or invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
         * <code>PreparedStatement</code>is associated with.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
         * @param statement             The <code>PreparedStatement</code> that is bieng closed or is invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
         * @throws IllegalArgumentException if <code>con</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        public StatementEvent(PooledConnection con,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
                                                  PreparedStatement statement) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
                super(con);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                this.statement = statement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
                this.exception = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
         * Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
         * <code>PreparedStatement</code> and <code>SQLException</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
         * @param con                   The <code>PooledConnection</code> that the closed or invalid <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
         * is associated with.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
         * @param statement             The <code>PreparedStatement</code> that is being closed or is invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
         * @param exception             The <code>SQLException </code>the driver is about to throw to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
         *                                              the application
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
         * @throws IllegalArgumentException if <code>con</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        public StatementEvent(PooledConnection con,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
                                                  PreparedStatement statement,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
                                                  SQLException exception) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
                super(con);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
                this.statement = statement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                this.exception = exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
         * Returns the <code>PreparedStatement</code> that is being closed or is invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
         * @return      The <code>PreparedStatement</code> that is being closed or is invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        public PreparedStatement getStatement() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                return this.statement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
         * Returns the <code>SQLException</code> the driver is about to throw
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
         * @return      The <code>SQLException</code> the driver is about to throw
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        public SQLException getSQLException() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                return this.exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
}