DPML
Resource Management
HomeUtilitiesStationMetro
Resource Management Overview
Introduction to Transit Resource Managmeent

A typical Transit URL is show below:

artifact:jar:dpml/metro/dpml-metro-composition#3000

The above URL is referencing a 'jar' resource within the group 'dpml/metro', named 'dpml-metro-composition', and version '3000'. This information is sufficient for Transit to retrieve the resource from one of the resurce hosts it is associated with and locally cache the resource.

In effect ...

    |-----------------------------------|
    | artifact:thing:mygroup/myname#123 | is a URI
    |-----------------------------------|
            | 
            | is handled by 
            |
    |-----------------------------------| n    1 |-----------| 1   n |----------------|
    | dpml.transit.artifact.Handler     | <>---- | Transit   | <>----| ResourceHost   |
    |-----------------------------------|        |-----------|       |----------------|

Using URIs you can reference and work with resources in a more abstract manner as your dealing with a URI as opposed to a URL. A URI "identifies" a resource whereas a URL "locates" a resource. Transit maps URIs to URLs when interogating resource host that are declared within the Tranist configuration. As Transit supports multiple hosts and multiple protocols you in effect remove resource location concerns from you code.

Here is an example of URI and URL construction:

String path = "artifact:jar:org/acme/widget#1.2.3";
URI uri = new URI( path );
URL url = uri.toURL();

To use Transit in your application you will need to ensure that the following two conditions are met:

  1. the system property java.protocol.handler.pkgs is declared with a value including the package name dpml.transit. For example:

    System.setProperty( "java.protocol.handler.pkgs", "dpml.transit" );

  2. the dpml-transit-main.jar is included within the system classloader

If you plan on using Transit in a production scenario you will want to take a close look at the information concerning the setup and configuration of Transit.

Summary

This overview has presented Tranist in terms of its role as an abstract protocol handler and the mechanisms used to map transit uris to urls. The next tutorial goes into more detail concerning the usage of the artifact: protocol when handling simple resources such as property files, xml data files, etc.