fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * CDDL HEADER START
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * The contents of this file are subject to the terms of the
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Common Development and Distribution License (the "License").
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * You may not use this file except in compliance with the License.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * See the License for the specific language governing permissions
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * and limitations under the License.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * When distributing Covered Code, include this CDDL HEADER in each
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * If applicable, add the following below this CDDL HEADER, with the
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * fields enclosed by brackets "[]" replaced with your own identifying
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * information: Portions Copyright [yyyy] [name of copyright owner]
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * CDDL HEADER END
91cfa10a8e55050a5103c4b2e83b0bf8d783a7cbtomee * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Use is subject to license terms.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * ident "%Z%%M% %I% %E% SMI"
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Information about a {@link Program} including stability and matching
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * probe count.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Immutable. Supports persistence using {@link java.beans.XMLEncoder}.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @see Consumer#getProgramInfo(Program program)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @see Consumer#enable(Program program)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @author Tom Erickson
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomeepublic final class ProgramInfo implements Serializable {
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee static final long serialVersionUID = 663862981171935056L;
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee BeanInfo info = Introspector.getBeanInfo(ProgramInfo.class);
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee "minimumStatementAttributes",
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee "matchingProbeCount" })
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Need to prevent DefaultPersistenceDelegate from using
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * overridden equals() method, resulting in a
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * StackOverFlowError. Revert to PersistenceDelegate
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * implementation. See
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * 477019&tstart=135
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee protected boolean
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee d.setValue("persistenceDelegate", persistenceDelegate);
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee /** @serial */
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee private final InterfaceAttributes minimumProbeAttributes;
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee /** @serial */
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee private final InterfaceAttributes minimumStatementAttributes;
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee /** @serial */
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Creates a {@code ProgamInfo} instance with the given properties.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Supports XML persistence.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @param minProbeAttr minimum stability levels of the
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * program probe descriptions
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @param minStatementAttr minimum stability levels of the
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * program action statements (including D variables)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @param matchingProbes non-negative count of probes matching the
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * program probe description
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @throws NullPointerException if {@code minProbeAttr} or {@code
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * minStatementAttr} is {@code null}
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @throws IllegalArgumentException if {@code matchingProbes} is
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee // Called by native code. Any change to this constructor requires a
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee // similar change in the native invocation.
91cfa10a8e55050a5103c4b2e83b0bf8d783a7cbtomee private final void
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee throw new NullPointerException("minimumProbeAttributes is null");
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee "minimumStatementAttributes is null");
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee "matchingProbeCount is negative");
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Gets the minimum stability levels of the probe descriptions used
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * in a compiled {@link Program}.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @return non-null interface attributes describing the minimum
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * stability of the probe descriptions in a D program
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Gets the minimum stability levels of the action statements
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * including D variables used in a compiled {@link Program}.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @return non-null interface attributes describing the minimum
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * stability of the action statements (including D variables) in a D
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Gets the number of DTrace probes that match the probe
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * descriptions in a compiled {@link Program}. This count may be
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * very high for programs that use {@link ProbeDescription}
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * wildcarding (field omission) and globbing (pattern matching
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @return non-negative count of probes on the system matching the
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * program descriptions in a compiled D program
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Compares the specified object with this program information for
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * equality. Defines equality as having the same information,
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * including stability attributes and matching probe counts.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Different D programs may have equal program information.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @return {@code true} if and only if the specified object is also
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * a {@code ProgramInfo} instance and has all the same information
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * as this instance
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee public boolean
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee if (o == this) {
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee return true;
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee if (o instanceof ProgramInfo) {
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee return false;
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Overridden to ensure that equal {@code ProgramInfo} instances
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * have equal hashcodes.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee hash = (37 * hash) + minimumProbeAttributes.hashCode();
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee hash = (37 * hash) + minimumStatementAttributes.hashCode();
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee private void
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee // Check constructor invariants
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee } catch (Exception e) {
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee InvalidObjectException x = new InvalidObjectException(
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Gets a string representation of this {@code ProgramInfo} useful
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * for logging and not intended for display. The exact details of
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * the representation are unspecified and subject to change, but the
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * following format may be regarded as typical:
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * <pre><code>
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * class-name[property1 = value1, property2 = value2]
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * </code></pre>