ProbeInfo.java revision fb3fb4f3d76d55b64440afd0af72775dfad3bd1d
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* ident "%Z%%M% %I% %E% SMI"
*/
/**
* Probe stability information. Does not identify a probe, but gives
* information about a single probe identified by a {@link
* ProbeDescription}. A {@code ProbeDescription} can match multiple
* probes using pattern syntax (globbing) and wildcarding (field
* omission), but it does not normally make sense to associate a {@code
* ProbeInfo} with a {@code ProbeDescription} unless that description
* matches exactly one probe on the system. A {@link Probe} pairs a
* {@code ProbeDescription} with information about the DTrace probe it
* identifies.
* <p>
* Immutable. Supports persistence using {@link java.beans.XMLEncoder}.
*
* @see Consumer#listProbeDetail(ProbeDescription filter)
* @see Consumer#listProgramProbeDetail(Program program)
*
* @author Tom Erickson
*/
public final class ProbeInfo implements Serializable {
static final long serialVersionUID = 1057402669978245904L;
static {
try {
new String[] {"probeAttributes",
"argumentAttributes"})
{
/*
* Need to prevent DefaultPersistenceDelegate from using
* overridden equals() method, resulting in a
* StackOverFlowError. Revert to PersistenceDelegate
* implementation. See
* 477019&tstart=135
*/
protected boolean
{
}
};
} catch (IntrospectionException e) {
}
}
/** @serial */
private final InterfaceAttributes probeAttributes;
/** @serial */
private final InterfaceAttributes argumentAttributes;
/**
* Creates a {@code ProbeInfo} instance from the given attributes.
* Supports XML persistence.
*
* @throws NullPointerException if any parameter is null
*/
public
{
validate();
}
private void
validate()
{
if (probeAttributes == null) {
throw new NullPointerException("probeAttributes is null");
}
if (argumentAttributes == null) {
throw new NullPointerException("argumentAttributes is null");
}
}
/**
* Gets the interface attributes of a probe.
*
* @return non-null attributes including stability levels and
* dependency class
*/
public InterfaceAttributes
{
return probeAttributes;
}
/**
* Gets the interface attributes of the arguments to a probe.
*
* @return non-null attributes including stability levels and
* dependency class of the arguments to a probe
*/
public InterfaceAttributes
{
return argumentAttributes;
}
/**
* Compares the specified object with this {@code ProbeInfo}
* instance for equality. Defines equality as having equal probe
* attributes and equal argument attributes.
*
* @return {@code true} if and only if the specified object is also
* a {@code ProbeInfo} and both instances have the same attributes
*/
public boolean
{
if (o instanceof ProbeInfo) {
}
return false;
}
/**
* Overridden to ensure that equal instances have equal hash codes.
*/
public int
hashCode()
{
int hash = 17;
return hash;
}
private void
throws IOException, ClassNotFoundException
{
s.defaultReadObject();
// Must copy before checking class invariants
try {
validate();
} catch (Exception e) {
throw new InvalidObjectException(e.getMessage());
}
}
/**
* Gets a string representation of this {@code ProbeInfo} useful for
* logging and not intended for display. The exact details of the
* representation are unspecified and subject to change, but the
* following format may be regarded as typical:
* <pre><code>
* class-name[property1 = value1, property2 = value2]
* </code></pre>
*/
public String
toString()
{
}
}