(class)
A manifest of component information.
Description
Contains any number of
ComponentSelectors that describe the locations of components.
The selectors are maintained in sorted order by
component-type,
name, and order of insertion.
Also see
Manifests in the Curl Developer's Guide.
| default: | Construct a new manifest object. |
field public-get private-set ComponentManifest.all-delegates:{
ReadOnlyArray-of
ComponentManifest
}
accessor public final inline ComponentManifest.direct-delegates:{
ReadOnlyArray-of ComponentManifest}
setter public final ComponentManifest.direct-delegates:{
ReadOnlyArray-of ComponentManifest}
accessor public final inline ComponentManifest.for-loop-count:
int
| from-cache?: | Indicates whether manifest is in the shared cache. |
accessor public final ComponentManifest.from-cache?:
bool
field public constant ComponentManifest.imported?:
bool =false
| size: | The number of selectors in the manifest. |
accessor public final inline ComponentManifest.size:
int
| select: | Choose selector from selectors. |
| add: | Add selector to manifest. |
| freeze: | Freeze the manifest to changes. |
|
public final
| {ComponentManifest.freeze}:void |
| get: | Returns the nth selector in the manifest. |
| lookup: | Finds selectors in manifest matching meta-data |
| remove: | Remove the nth selector from the manifest. |
|
public final
| {ComponentManifest.remove n:int}:void |
| select-url: | Finds and chooses preferred location matching meta-data. |
|
public
| {ComponentManifest.SHA-1-digest-for-location location:Url }:#SHA-1-Digest |
(constructor)
Construct a new manifest object.
meta-data: specifies the manifest's meta-data.
...: is zero or more selectors to be added to the manifest. Each will be validated using
validate-for-add, which could result in an error.
Additional selectors may be added later using
add.
Notes
ComponentManifests may also be loaded from a source file using
import-manifest.
(field)
public-get private-set ComponentManifest.all-delegates:{
ReadOnlyArray-of
ComponentManifest
}
Ordered list of all delegates of this manifests.
Description
The list contains this manifest and all direct and indirect delegates of this manifest with any duplicates removed. The list is constructed by starting with
self, then for each member of the
direct-delegates, adding the members of its
all-delegates list removing any duplicate entry that appears earlier in the list.
This list is updated automatically when the
direct-delegates are set.
Example
Given the following manifests:
|| root.mcurl
{manifest ROOT}
{delegate-to A1, location = "a1.mcurl"}
{delegate-to A2, location = "a2.mcurl"}
...
|| a1.mcurl
{manifest A1}
{delegate-to B1, location = "b1.mcurl"}
{delegate-to B2, location = "b2.mcurl"}
...
|| a2.mcurl
{manifest A2}
{delegate-to B2, location = "b2.mcurl"}
{delegate-to B3, location = "b3.mcurl"}
...
|| b1.mcurl
{manifest B1}
...
|| b2.mcurl
{manifest B2}
...
|| b3.mcurl
{manifest B3}
...
Manifest
ROOT will have
direct-delegates A1 and
A2, and
all-delegates ROOT,
A1,
B1,
B2,
A2,
B3.
(accessor)
accessor public final inline ComponentManifest.direct-delegates:{
ReadOnlyArray-of ComponentManifest}
setter public final ComponentManifest.direct-delegates:{
ReadOnlyArray-of ComponentManifest}
Ordered list of direct delegates of this manifest.
Description
List of secondary manifests to be used by
lookup when it cannot find matches in this manifest.
Setting this attribute does the following:
- Throws an error if the manifest is frozen?.
- Throws an error if any of the delegates is not frozen?.
- Updates value of ComponentManifest.all-delegates field.
Empty
ComponentManifest objects may be used to represent manifests that cannot actually be imported under the current Curl API (e.g. a 1.2 manifest delegated to by a 1.1, 1.2 manifest running under the 1.1 API).
(accessor)
accessor public final inline ComponentManifest.for-loop-count:
int The number of selectors in the manifest.
Description
This allows these objects to be used in container for loops, but is not intended for direct use. Use
size instead.
(accessor)
accessor public final ComponentManifest.from-cache?:
bool Indicates whether manifest is in the shared cache.
Description
Will be true if manifest was loaded using
import-manifest with
use-cache? set to true.
(field)
public constant ComponentManifest.imported?:
bool =false
(accessor)
accessor public final inline ComponentManifest.size:
int The number of selectors in the manifest.
(class proc)
Choose selector from selectors.
Description
(method)
Add selector to manifest.
Description
The
selector will be validated by
validate-for-add, which will make sure that it contains a component-type, name, and at least one location.
This will throw an error if the manifest is frozen.
(method)
| public final
| {ComponentManifest.freeze}:void |
Freeze the manifest to changes.
Description
Sets
frozen? attribute to true and prevents use of mutating methods. Also freezes the manifest's
meta-data and all of the selectors in the manifest.
Does nothing if manifest is already frozen.
(method)
Returns the nth selector in the manifest.
Description
The selectors are maintained in sorted order by
component-type,
name, and order of insertion, so the position of a given selector in the manifest may change as selectors are
added or
removed. The order will not change once the manifest is
frozen?.
This will throw an error if
n is less than zero or greater than or equal to the manifest size.
(method)
Finds selectors in manifest matching meta-data
out: specifies an array to which the results will be appended.
look-in-delegates?: determines whether delegate manifests should be searched if not found in this manifest.
match-location?: if true and
meta-data isa
ComponentSelector, then at least one of the selector's
location-hints must be the same as that of the matching selector.
default-manifest: is the default manifest to return if no matches are found.
Returns
Returns results after appending any matching results, and the manifest from which the results were taken. If no results were appended, then the default-manifest will be returned.
Description
Finds and returns selectors matching the specified
meta-data in this manifest. If no matches are found in this manifest and
look-in-delegates? is true, the lookup is delegated to each delegate manifest in the list of
direct-delegates until a match is found.
Note that all results will always originate from a single manifest. If you wish to collect matches from the manifest and all of its delegates, you can simply do a direct lookup in each manifest in the
all-delegates list, writing the results into a common array:
let results:{Array-of ComponentSelector} =
{new {Array-of ComponentSelector}}
{for delegate in manifest.all-delegates do
{delegate.lookup
meta-data, out = results, look-in-delegates? = false
}
}
(method)
Finds and chooses preferred selector matching meta-data.
Description
Uses
ComponentManifest.select to choose from among the return values of
ComponentManifest.lookup with the specified
look-in-delegates? flag. Also returns manifest in which the selector was found. Will return null and this manifest if no matches are found.
(method)
| public final
| {ComponentManifest.remove n:int}:void |
Remove the nth selector from the manifest.
Description
This will throw an error if the manifest is frozen or if n is less than zero or greater than or equal to the manifest size.
(method)
Finds and chooses preferred location matching meta-data.
Description
(method)
| public
| {ComponentManifest.SHA-1-digest-for-location location:Url }:#SHA-1-Digest |
Find and returns SHA-1-digest value for location.
Description
Searches manifest and its delegate manifests for entries with the specified
location, and from those returns the value of the first
SHA-1-digest value it finds.
(method)
Ensure selector meets requirements to be passed to add.
Description
Throws an
Error if any of the following are not true:
This is invoked by the
add method.