Package org.jboss.dna.graph.connector.federation Description

JBoss DNA provides a federated connector that is able to access repository content from multiple external systems
and make that content look like it exists in a single unified repository. Like other connectors, a
RepositorySource implementation is provided, called FederatedRepositorySource,
that can be set up and configured to be used by a Graph or a JCR repository.

Projections

Each federated repository source provides a unified repository consisting of information that is dynamically federated
from multiple other RepositorySource instances. The connector is configured with a number of projections
that each describe where in the unified repository the federated connector should place the content from another source.
Projections consist of the name of the source containing the content and a number of rules that
define the path mappings, where each rule is defined as a string with this format:

pathInFederatedRepository => pathInSourceRepository

Here, the pathInFederatedRepository is the string representation of the path in the unified
(or federated) repository, and pathInSourceRepository is the string representation of the path of the
actual content in the underlying source. For example:

/ => /

is a trivial rule that states that all of the content in the underlying source should be mapped into the unified
repository such that the locations are the same. Therefore, a node at /a/b/c in the source would
appear in the unified repository at /a/b/c. This is called a mirror projection,
since the unified repository mirrors the underlying source repository.

Another example is an offset projection, which is similar to the mirror projection except that
the federated path includes an offset not found in the source:

/alpha/beta => /

Here, a node at /a/b/c in the source would actually appear in the unified repository at
/alpha/beta/a/b/c. The offset path (/alpha/beta in this example) can have 1 or more segments.
(If there are no segments, then it reduces to a mirror projection.)

Often a rule will map a path in one source into another path in the unified source:

/alpha/beta => /foo/bar

Here, the content at /foo/bar is projected in the unified repository under /alpha/beta,
meaning that the /foo/bar prefix never even appears in the unified repository. So the node at
/foo/bar/baz/raz would appear in the unified repository at /alpha/beta/baz/raz. Again,
the size of the two paths in the rule don't matter.

Multiple Projections

Federated repositories that use a single projection are useful, but they aren't as interesting or powerful as
those that use multiple projections. Consider a federated repository that is defined by two projections:

Note how the /foo/bum branch does not even appear in the unified repository, since it is outside of the
branch being projected. Also, the /alpha node doesn't exist in S1 or S2; it's what is called a
placeholder node that exists purely so that the nodes below it have a place to exist.
Placeholders are somewhat special: they allow any structure below them (including other placeholder nodes or real
projected nodes), but they cannot be modified.

Even more interesting are cases that involve more projections. Consider a federated repository that contains
information about different kinds of automobiles, aircraft, and spacecraft, except that the information
about each kind of vehicle exists in a different source (and possibly a different kind of source, such as
a database, or file, or web service).

First, the sources. The "Cars" source contains the following structure: