...
Code Block |
---|
// set an attribute in the IngestContext for item public void setAttribute(int itemId, String name, String value); // get an attribute from the IngestContext for item public void getAttribute(int itemId, String name); // remove Ingest context public void clear(int itemId); // obtain the resource we need public <T> T findResource(int itemId, Class<T> resClass); |
Finding Resources
The observant reader will notice that the IngestService findResource method returns a resource (of a given type) for an item without any additional parameters or information. How is this possible? On what basis is the selection made? CGI assumes that, in general, each resource type bears a similar relationship with each of its items, and thus that it can be expressed in a rule or formula. For reasons that will become apparent, these rules are known as expressions in a grammar called RCL (Resource Composition Language). In most cases, RCL just amounts to a very simple template. For example, suppose we wanted to express the rule that DSpace currently uses in selecting an input form for configurable submission. We would write the property containing the expression as:
Code Block |
---|
org.dspace.app.util.DCInputSet=collection:?,collection:default
|
That is, the resource class name is the property key, and the value is the RCL expression. The expression means: select the resource mapped to the key formed by the current ingest context attribute 'collection' (if any), otherwise look for a mapping with the key 'collection:default'. More will be said about RCL when we discuss resource composition. These properties - one for each ingest resource we wish to define - can live in standard configuration locations, e.g.
Code Block |
---|
{dspace.dir}/config/modules/cgi.cfg |