/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* ident "%Z%%M% %I% %E% SMI"
*/
/**
* A DTrace probe description consists of provider, module, function,
* and name. A single probe description may identify a single DTrace
* probe or match multiple probes. Any field may be wildcarded by
* omission (set to null) or set to a glob-style pattern:
* <pre>
* * Matches any string, including the null string
* ? Matches any single character
* [ ... ] Matches any one of the enclosed characters. A pair of
* characters separated by - matches any character
* between the pair, inclusive. If the first
* character after the [ is !, any character not
* enclosed in the set is matched.
* \ Interpret the next character as itself, without any
* special meaning
* </pre>
* Immutable. Supports persistence using {@link java.beans.XMLEncoder}.
*
* @see Consumer#listProbes(ProbeDescription filter)
*
* @author Tom Erickson
*/
{
/**
* Instance with empty provider, module, function, and name fields
* matches all DTrace probes on a system.
*/
/**
* Enumerates the provider, module, function, and name fields of a
* probe description.
*/
public enum Spec {
/** Probe provider */
/** Probe module */
/** Probe function */
/** Probe name (unqualified) */
};
static {
try {
"function", "name"});
} catch (IntrospectionException e) {
}
}
/** @serial */
/** @serial */
/** @serial */
/** @serial */
/** @serial */
/**
* Creates a fully qualified probe description from the name given
* in the format <i>{@code provider:module:function:name}</i> or
* else a probe description that specifies only the unqualified
* probe name.
*
* @param probeName either the fully qualified name in the format
* <i>{@code provider:module:function:name}</i> or else (if no colon
* is present) the unqualified name interpreted as {@code
* :::probeName}
* @see ProbeDescription#ProbeDescription(String probeProvider,
* String probeModule, String probeFunction, String probeName)
* @see ProbeDescription#parse(String s)
*/
public
{
try {
} catch (ParseException e) {
p = null;
}
if (p == null) {
provider = "";
module = "";
function = "";
} else {
}
} else {
provider = "";
module = "";
function = "";
}
}
/**
* Creates a probe description that specifies the probe name
* qualified only by the function name.
*
* @see ProbeDescription#ProbeDescription(String probeProvider,
* String probeModule, String probeFunction, String probeName)
*/
public
{
}
/**
* Creates a probe description that specifies the probe name
* qualified by the function name and module name.
*
* @see ProbeDescription#ProbeDescription(String probeProvider,
* String probeModule, String probeFunction, String probeName)
*/
public
{
}
/**
* Creates a fully qualified probe description. If no pattern
* syntax is used and no field is omitted, the resulting description
* matches at most one DTrace probe.
*
* @param probeProvider provider name, may be null or empty to match
* all providers or use pattern syntax to match multiple providers
* @param probeModule module name, may be null or empty to match all
* modules or use pattern syntax to match multiple modules
* @param probeFunction function name, may be null or empty to match
* all functions or use pattern syntax to match multiple functions
* @param probeName unqualified probe name, may be null or empty to
* match all names or use pattern syntax to match multiple names
*/
public
{
}
/**
* Supports XML persistence.
*/
public
{
}
/**
* Generates a probe description from a string in the same format
* returned by {@link #toString()}. Parses the string from right to
* left.
* <pre><code>
* <i>provider:module:function:name</i>
* </code></pre>
*
* @return non-null probe description
* @throws ParseException if {@code s} does not have the expected
* format. The error offset is the index of the first unexpected
* character encountered starting from the last character and
* reading backwards.
* @throws NullPointerException if the given string is {@code null}
*/
public static ProbeDescription
{
// StringTokenizer and String.split() do not correctly handle
// the case of consecutive delimiters
char ch;
if (ch == ':') {
npos = i;
}
}
case 0:
p = EMPTY;
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
default:
// get error offset (parsing right-to-left)
}
throw new ParseException("Overspecified probe " +
}
return p;
}
/**
* Gets the probe ID.
*
* @return ID generated from a sequence by the native DTrace
* library, identifies the probe among all probes on the system
*/
public int
getID()
{
return id;
}
/**
* Gets the provider name.
*
* @return non-null provider name, may be an empty string to
* indicate omission
*/
public String
{
return provider;
}
/**
* Gets the module name.
*
* @return non-null module name, may be an empty string to indicate
* omission
*/
public String
{
return module;
}
/**
* Gets the function name.
*
* @return non-null function name, may be an empty string to
* indicate omission
*/
public String
{
return function;
}
/**
* Gets the unqualified probe name.
*
* @return non-null probe name, may be an empty string to indicate
* omission
*/
public String
getName()
{
return name;
}
/**
* Returns {@code true} if provider, module, function, and name are
* all omitted. An empty probe description matches all DTrace
* probes on a system.
*
* @return {@code true} if all probe fields are omitted, {@code
* false} otherwise
*/
public boolean
isEmpty()
{
return false;
}
return false;
}
return false;
}
return false;
}
return true;
}
/**
* Compares the specified object with this probe description for
* equality. Defines equality as having the same fields. Omitted
* fields must be omitted in both instances in order for them to be
* equal, but it makes no difference whether {@code null} or empty
* string was used to indicate omission.
*
* @return {@code true} if and only if all corresponding fields of
* both probe descriptions are either both omitted (null or empty)
* or else equal as defined by {@link String#equals(Object o)
* String.equals()}
*/
public boolean
{
if (o instanceof ProbeDescription) {
ProbeDescription p = (ProbeDescription)o;
return (compareTo(p) == 0);
} else {
}
}
return false;
}
/**
* Defines the natural ordering of probe descriptions. Returns the
* natural ordering of the first unequal pair of corresponding
* fields (starting with the provider and continuing to the
* unqualified name only if all other fields are equal).
* Corresponding fields are equal if they are both omitted or both
* equal as defined by {@link String#equals(Object o)
* String.equals()}. It makes no difference if {@code null} or
* empty string is used to indicate omission. The behavior is
* consistent with the {@link #equals(Object o) equals()} method.
*
* @return -1, 0, or 1 as this probe description is less than, equal
* to, or greater than the given probe description
*/
public int
{
int cmp = 0;
if (cmp == 0) {
if (cmp == 0) {
if (cmp == 0) {
}
}
}
return (cmp);
}
/**
* Overridden to ensure that equal probe descriptions have equal
* hashcodes.
*/
public int
hashCode()
{
return hash;
}
hash = 17;
return hash;
}
private void
throws IOException, ClassNotFoundException
{
s.defaultReadObject();
// check invariants
throw new InvalidObjectException("provider is null");
}
throw new InvalidObjectException("module is null");
}
throw new InvalidObjectException("function is null");
}
throw new InvalidObjectException("name is null");
}
}
/**
* Gets the string representation of this probe description. The
* format is as follows:
* <pre><code>
* <i>provider:module:function:name</i>
* </code></pre>
* Individual fields may be empty, but none of the three delimiting
* colons is ever omitted. If this instance uses pattern matching
* syntax to match multiple probes, that syntax is preserved in the
* string representation.
*/
public String
toString()
{
}
}