ComponentManifest (class)
public final ComponentManifest {inherits Component, SharedProcessResource}
Package: CURL.LANGUAGE.COMPONENT

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.

Constructors
default:Construct a new manifest object.
constructor public {ComponentManifest.default
    meta-data:ComponentMetaData = {ComponentMetaData},
    frozen?:bool = false,
    ...:ComponentSelector
}
Properties
all-delegates:Ordered list of all delegates of this manifests.
field public-get private-set ComponentManifest.all-delegates:{ReadOnlyArray-of ComponentManifest }
direct-delegates:Ordered list of direct delegates of this manifest.
accessor public final inline ComponentManifest.direct-delegates:{ReadOnlyArray-of ComponentManifest}
setter public final ComponentManifest.direct-delegates:{ReadOnlyArray-of ComponentManifest}
for-loop-count:The number of selectors in the manifest.
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
imported?:Indicates if manifest was loaded by import-manifest.
field public constant ComponentManifest.imported?:bool =false
size:The number of selectors in the manifest.
accessor public final inline ComponentManifest.size:int
Properties inherited from Component: error-name, frozen?, id, meta-data, name, source-url, source-url-name, transitive-id
Class Procedures
select:Choose selector from selectors.
public {ComponentManifest.select
    selectors:{Array-of ComponentSelector},
    comparison-proc:{proc-type {s1:ComponentSelector, s2:ComponentSelector}:bool} = ComponentSelector.prefer-first?
}:#ComponentSelector
Methods
add:Add selector to manifest.
public final {ComponentManifest.add selector:ComponentSelector}:void
freeze:Freeze the manifest to changes.
public final {ComponentManifest.freeze}:void
get:Returns the nth selector in the manifest.
public final inline {ComponentManifest.get n:int}:ComponentSelector
lookup:Finds selectors in manifest matching meta-data
public final {ComponentManifest.lookup
    meta-data:ComponentMetaData,
    out:{Array-of ComponentSelector} = {new {Array-of ComponentSelector}},
    look-in-delegates?:bool = true,
    match-location?:bool = false,
    default-manifest:ComponentManifest = self
}:(results:{Array-of ComponentSelector}, manifest:ComponentManifest)
lookup-and-select:Finds and chooses preferred selector matching meta-data.
public final {ComponentManifest.lookup-and-select
    meta-data:ComponentMetaData,
    comparison-proc:{proc-type {s1:ComponentSelector, s2:ComponentSelector}:bool} = ComponentSelector.prefer-first?,
    look-in-delegates?:bool = true,
    match-location?:bool = false,
    default-manifest:ComponentManifest = self
}:(#ComponentSelector,ComponentManifest)
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.select-url
    meta-data:ComponentMetaData,
    comparison-proc:{proc-type {s1:ComponentSelector, s2:ComponentSelector}:bool} = ComponentSelector.prefer-first?
}:Url
SHA-1-digest-for-location:Find and returns SHA-1-digest value for location.
public {ComponentManifest.SHA-1-digest-for-location
    location:Url
}:#SHA-1-Digest
validate-for-add:Ensure selector meets requirements to be passed to add.
public final {ComponentManifest.validate-for-add
    selector:ComponentSelector
}:void
Methods inherited from Component: assert-not-frozen
Methods inherited from Object: object-describe, object-describe-for-debugging, object-serialize

Constructor Details
default (constructor)
public {ComponentManifest.default
    meta-data:ComponentMetaData = {ComponentMetaData},
    frozen?:bool = false,
    ...:ComponentSelector
}

Construct a new manifest object.

meta-data: specifies the manifest's meta-data.
frozen?: if true produces a frozen manifest.

See ComponentManifest.freeze.
...: 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.


Property Details
all-delegates (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.


direct-delegates (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:

  1. Throws an error if the manifest is frozen?.
  2. Throws an error if any of the delegates is not frozen?.
  3. 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).


for-loop-count (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.


from-cache? (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.


imported? (field)
public constant ComponentManifest.imported?:bool =false

Indicates if manifest was loaded by import-manifest.

Description

See import-manifest for what this implies.


size (accessor)
accessor public final inline ComponentManifest.size:int

The number of selectors in the manifest.



Class Procedure Details
select (class proc)
public {ComponentManifest.select
    selectors:{Array-of ComponentSelector},
    comparison-proc:{proc-type {s1:ComponentSelector, s2:ComponentSelector}:bool} = ComponentSelector.prefer-first?
}:#ComponentSelector

Choose selector from selectors.

Description

Choose preferred selector from selectors using comparison-proc, which defaults to ComponentSelector.prefer-first?.

Returns null if selectors is empty.


Method Details
add (method)
public final {ComponentManifest.add selector:ComponentSelector}:void

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.


freeze (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.


get (method)
public final inline {ComponentManifest.get n:int}:ComponentSelector

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.


lookup (method)
public final {ComponentManifest.lookup
    meta-data:ComponentMetaData,
    out:{Array-of ComponentSelector} = {new {Array-of ComponentSelector}},
    look-in-delegates?:bool = true,
    match-location?:bool = false,
    default-manifest:ComponentManifest = self
}:(results:{Array-of ComponentSelector}, manifest:ComponentManifest)

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
    }
}


lookup-and-select (method)
public final {ComponentManifest.lookup-and-select
    meta-data:ComponentMetaData,
    comparison-proc:{proc-type {s1:ComponentSelector, s2:ComponentSelector}:bool} = ComponentSelector.prefer-first?,
    look-in-delegates?:bool = true,
    match-location?:bool = false,
    default-manifest:ComponentManifest = self
}:(#ComponentSelector,ComponentManifest)

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.


remove (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.


select-url (method)
public {ComponentManifest.select-url
    meta-data:ComponentMetaData,
    comparison-proc:{proc-type {s1:ComponentSelector, s2:ComponentSelector}:bool} = ComponentSelector.prefer-first?
}:Url

Finds and chooses preferred location matching meta-data.

Description

Uses ComponentManifest.lookup-and-select to locate the preferred ComponentSelector in this manifest for the specified meta-data and returns the first of its location-hints.

If no matching selector was found, throws a ComponentLocationException.


SHA-1-digest-for-location (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.


validate-for-add (method)
public final {ComponentManifest.validate-for-add
    selector:ComponentSelector
}:void

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.