|
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 | ||||||||||
java.lang.Objectorg.eclipse.tptp.platform.probekit.registry.ProbeRegistry
The Probe Registry manages probe resources for query, deployment, import, and export operations. There is a probe registry for each workspace.
Entries can be made to the registry in two forms: From a zip file previously created by exporting a .probe file, or from the component pieces. The miniumum pieces include the source file (.probe file) and all files required to deploy a probe at runtime, such as generated class files and the .probescript file.
Probe sets must be unique within the registry. Probe sets are primarily identified by their id (see org.eclipse.hyades.models.probekit). If there is an entry in the registry for a given id, it is always replaced by any new entry with the same id. Probe sets which do not have an id will be assigned one by the registry.
In addition, if there is a source file associated with the probe set, the source file is also used in determining probe set equivalence. Two probe sets are equivalent if either their id or their source file names match. When making a new entry, any existing equivalent entries are supplanted by the new entry.
To add a probe set to the registry through an import file, use addIfNoConflict(), along with commit() and discard() for conflict resolution. To add a probe set without worrying about conflicts (e.g. blindly overwrite conflicting entries), use one of the add() methods.
Probes sets added to the registry through import files have their files managed by the registry. They're stored in the plugin's state save area. Probe sets added to the registry by the builder have their files managed by the workbench.
Consumers who want to use the import thru zip file interface should also refer to org.eclipse.tptp.platform.probekit.registry.CandidateEntry.
| Nested Class Summary | |
|---|---|
protected class |
ProbeRegistry.Enumerator
This class encapsulates a read-only Enumeration/Iterator over the contents of the registry. |
| Field Summary | |
|---|---|
protected java.util.HashMap |
srcMap
Mapping from source name to registry entry. |
protected java.util.Hashtable |
store
This represents all the probe sets the registry knows about. |
protected static ProbeRegistry |
theRegistry
The registry singleton object. |
| Constructor Summary | |
|---|---|
protected |
ProbeRegistry()
|
| Method Summary | |
|---|---|
ProbeRegistryEntry |
add(ProbeResourceBundle bundle)
Add a probe set to the registry by supplying all the required pieces in a bundle. |
ProbeRegistryEntry |
add(java.lang.String importFileName)
Add a probe set to the registry from a file previously created by an export operation. |
CandidateEntry |
addIfNoConflict(java.lang.String importFileName)
Attempt to import a probe set into the registry. |
void |
commit(CandidateEntry candidate)
Commit a candidate entry to the registry. |
java.util.Enumeration |
contents()
Create an iterator over the registry contents. |
void |
discard(CandidateEntry candidate)
Throw away a candidate entry. |
static ProbeRegistry |
getRegistry()
Get a reference to the one and only registry. |
java.util.Iterator |
iterator()
Create an iterator over the registry contents. |
ProbeRegistryEntry |
lookupById(java.lang.String id)
Locate the entry corresponding to a particular id. |
ProbeRegistryEntry |
lookupBySource(org.eclipse.core.resources.IResource source)
Retrieve a probe set based on its source (.probe) file reference. |
protected void |
purgeFreeList()
Delete entries marked for deferred deletion. |
void |
remove(org.eclipse.core.resources.IResource source)
Remove the entry corresponding to a particular .probe source file. |
void |
remove(ProbeRegistryEntry entry)
Remove an entry from the probe registry. |
void |
remove(java.lang.String id)
Remove the entry corresponding to a particular id from the registry. |
void |
restore(java.io.File saveFile)
Restore previously saved registry state. |
void |
save(java.io.File saveFile)
Save the registry state to persistent storage. |
static void |
startup()
Perform registry startup tasks. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static ProbeRegistry theRegistry
protected java.util.Hashtable store
protected java.util.HashMap srcMap
| Constructor Detail |
protected ProbeRegistry()
| Method Detail |
public static ProbeRegistry getRegistry()
public static void startup()
throws ProbeRegistryException
ProbeRegistryException
public void save(java.io.File saveFile)
throws ProbeRegistryException
saveFile - The destination file for the registry state.
ProbeRegistryException
public void restore(java.io.File saveFile)
throws ProbeRegistryException
saveFile - A file created by the registry save() operation.
ProbeRegistryException
public ProbeRegistryEntry add(java.lang.String importFileName)
throws java.io.IOException,
InvalidProbeBundleException
Open the import file, extract the pieces to a probe registry managed location. Perform as much validation of the file contents as possible. Successful completion of this operation makes the probe set available for deployment.
importFileName - Reference to a file created by exporting a probe set.
java.io.IOException - Unable to read or extract the import file contents
InvalidProbeBundleException - The import file is mal-formed. That is,
it does not contain the expected files.
public ProbeRegistryEntry add(ProbeResourceBundle bundle)
throws ProbeRegistryException,
InvalidProbeBundleException
bundle - A complete probe resource bundle, including persisted model
file, probescript, and one or more supporting class files.
ProbeRegistryException - The probe bundle is incomplete or otherwise
badly formed.
InvalidProbeBundleExceptionpublic void remove(ProbeRegistryEntry entry)
entry - registry entry to removepublic void remove(java.lang.String id)
id - Probe set identifier of the entry to removepublic void remove(org.eclipse.core.resources.IResource source)
source - The probe source Resource of registry entry to be removed.public java.util.Enumeration contents()
public java.util.Iterator iterator()
public ProbeRegistryEntry lookupById(java.lang.String id)
id - Probe set identifier of the entry to locate
public ProbeRegistryEntry lookupBySource(org.eclipse.core.resources.IResource source)
source - The probe set source file, as an IPath.
public CandidateEntry addIfNoConflict(java.lang.String importFileName)
throws java.io.IOException,
InvalidProbeBundleException
A conflicting entry is any one with the same probe set id. It is up to the caller to decide whether or not to proceed with the import (and thereby overwrite the existing entry). See the commit() and discard() operations.
When there is a conflict, a lock is placed on the conflicting entry. The lock is released when the candidate is either committed or discarded. While the conflicting entry is locked, no other thread can successfully pre-flight a probe set with the same id or explicitly add() a conflicting entry. This ensures the state of the contentious probe set does not change between preflight() and commit()/discard().
importFileName - A previously exported probe set package
java.io.IOException - Unable to read/extract the import file
InvalidProbeBundleException - import file is badly formed. That is, it does
not contain the expected files.
public void commit(CandidateEntry candidate)
throws ProbeRegistryException,
InvalidProbeBundleException
Once this operation succeeded, candidate is invalid and should not be committed or discarded again.
candidate - A candidate registry entry, previously created by preflight()
ProbeRegistryException - candidate was previously committed or discarded.
InvalidProbeBundleException
public void discard(CandidateEntry candidate)
throws ProbeRegistryException
Once this operation has succeeded, the candidate entry is invalid and cannot committed or discarded again.
candidate - The candidate registry entry to discard.
ProbeRegistryException - candidatewas previously committed or discarded.protected void purgeFreeList()
|
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 | ||||||||||