|
TPTP 4.4.0 Platform Project Public API Specification |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
This is the interface that probe compilers must implement. The Probe Compiler Factory will return one of these when asked. The decision of which one it returns depends on who extends the org.eclipse.hyades.probekit.compilerFactory extension point, and how. HOW TO USE PROBE COMPILERS: You instantiate one from the factory, and you feed it one or more resources of type org.eclipse.hyades.models.probekit.Probekit. Then you extract the artifacts necessary to use the probes: a string representing the Java source for the class containing the probe fragments, and a string representing the engine script that will instrument class files based on those probes. The class ProbekitException is used for all exceptions. It wraps all exceptions that can occur inside the compiler, including internal errors like NullPointerException. The exception text string tells what really happened. Use the ProbeCompiler class this way: 1. Create an instance Use default constructor or convenience constructors 2. Populate the instance by calling addIFile or the two-parameter addResource (all other adders are deprecated: they don't return the id of the added probe source, and they don't know where to hang markers to report errors) 3. Use getGeneratedSource() and getEngineScript() (in either order) to get the Java source and engine script text, respectively. You need to call setClassPrefix() to set the first part of the generated class name. Also, call setPackageName to put the generated classes in a package - otherwise they'll be in the default package. The class prefix normally comes from the file name, and the package name might come from anywhere. Of course file names might have characters in them that are not valid Java identifier characters. For consistency among users of Probekit, the utility function makeValidJavaIdentifier is provided in this.
| Field Summary | |
|---|---|
static java.lang.String |
PROBEKIT_PROBLEM_MARKER
This string is the marker type string for Probekit markers (see IMarker). |
| Method Summary | |
|---|---|
void |
addFile(java.lang.String file)
Deprecated. use addIFile |
java.lang.String |
addIFile(org.eclipse.core.resources.IFile f)
Add probekits that appear in the indicated IFile. |
void |
addProbekit(org.eclipse.hyades.models.internal.probekit.Probekit probekit)
Deprecated. use addIFile |
void |
addResource(org.eclipse.emf.ecore.resource.Resource res)
Deprecated. use addIFile |
java.lang.String |
addResource(org.eclipse.emf.ecore.resource.Resource res,
org.eclipse.core.resources.IResource ires)
Add probekits that appear in the indicated resource. |
java.lang.String |
getClassSuffix()
Returns the suffix string that is added to the string from setClassPrefix() to form the class name. |
java.lang.String |
getEngineScript()
Get the script that describes this probe set to the BCI engine. |
java.lang.String |
getGeneratedSource()
Get the generated source. |
java.lang.String |
makeValidJavaIdentifier(java.lang.String arg)
Method to turn any string into a valid Java class name prefix. |
void |
setClassPrefix(java.lang.String prefix)
Sets the class prefix to use for generated probe classes. |
void |
setPackageName(java.lang.String pkg)
Sets the package name to use for generated probe classes. |
void |
verify()
Tests a probe set for correctness and consistency. |
| Field Detail |
public static final java.lang.String PROBEKIT_PROBLEM_MARKER
| Method Detail |
public void setClassPrefix(java.lang.String prefix)
throws ProbekitException
ProbekitException
public void setPackageName(java.lang.String pkg)
throws ProbekitException
pkg - the package name to use, in dotted form.
ProbekitException - if the pkg argument is not a valid Java package name string.public java.lang.String getClassSuffix()
Don't change the value of this string ("_probe") because it's something users of the static instrumentation system are likely to write into their automation scripts.
public java.lang.String makeValidJavaIdentifier(java.lang.String arg)
Note that the output, while valid for Java class names, is not unique or reversible: The output string "_201" can come from a single-letter input string with char value 0x201, or from a two-letter input string " 1" (space-one).
arg - the string to convert
public void addProbekit(org.eclipse.hyades.models.internal.probekit.Probekit probekit)
throws ProbekitException
probekit - the Probekit to add
ProbekitException
public void addFile(java.lang.String file)
throws ProbekitException
file - the name of the file to load.
ProbekitException
public void addResource(org.eclipse.emf.ecore.resource.Resource res)
throws ProbekitException
res - the Resource to scan for probekits.
ProbekitException
public java.lang.String addIFile(org.eclipse.core.resources.IFile f)
throws ProbekitException
f - the IFile to add to the Compiler.
ProbekitException - for serious errors; uses markers for probe source errors etc.
public java.lang.String addResource(org.eclipse.emf.ecore.resource.Resource res,
org.eclipse.core.resources.IResource ires)
throws ProbekitException
res - the EMF Resource containing a probekitires - the Eclipse IResource that this probekit source comes from.
This is the resource that error markers will be attached to.
ProbekitException - for serious errors; uses markers for probe source errors etc.
public void verify()
throws ProbekitException
ProbekitException - if there is any inconsistency in the set. The exception string
describes one or more problems encountered, separated by the host-specific newline separator.
It's possible that not all problems will be reported - for instance, only one internal
integrity failure for a given probe might get reported, even if it has more than one problem.
This verification step permits the core implementation to have less internal
consistency checking logic.
public java.lang.String getGeneratedSource()
throws ProbekitException
ProbekitException
public java.lang.String getEngineScript()
throws ProbekitException
ProbekitException
|
TPTP 4.4.0 Platform Project Public API Specification |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||