DPML Metro - Component Management Made Simple

Loading and deployment of a Metro component is handled by the underlying URL machinery within the Java runtime environment. The following code demonstrates the code required to load a runtime service into an application using the Metro system.

URL url = URI.create( "link:part:org/acme/widget" ).toURL();
Widget widget = (Widget) url.getContent( new Class[]{ Widget.class } );

In the above scenario the following general sequence is executed:

  1. The Java runtime locates the link protocol handler.
  2. The link protocol handler resolves the symbolic uri to a concrete uri artifact:part:org/acme/widget#1.0.3.
  3. The Java runtime locates the artifact protocol handler.
  4. The artifact protocol handler ensures that the resource is added to the local Transit cache (this step may involve the downloading of the part artifact from a host declared in the Transit configuration profile - using the group identifier org/acme, the resource name widget, the version identifier 1.0.3, with the part type classifier).
  5. The artifact protocol handler loads a content handler for the part datatype and delegates control to the content handler.
  6. The part content handler reads the part definition, builds a classloader chain based on the information in the part description, loads a strategy handler based on the declared strategy type, and delagates control to the strategy handler (classloader chain creation may involve downloading of multiple supporting jar files and related configuration data from registered resource hosts).
  7. The strategy handler builds a runtime model of the component, resolves service dependencies, and builds a deployment solutions.
  8. The content request for the Widget class is delegated to the strategy handler which in-turn delegates the request to the established component model.
  9. The component model handles the establishment of a managed service provider taking into account component lifecycle and lifestyle policies, resulting in the instantiation and return of a Widget instance.