net.dpml.transit.layout
Class ModernLayout

java.lang.Object
  extended by net.dpml.transit.Layout
      extended by net.dpml.transit.layout.ModernLayout

public class ModernLayout
extends Layout

The ModernLayout decodes artifacts into a layout scheme that follows the convention of group/name/version/expanded-name pattern. Specifically the layout maps artifacts according to the rule [group[/[subgroup[/...]]]/[name]/[version]/name[-[version]].type. Example: artifact:jar:metro/cache/dpml-cache-main#1.0.0 would return the path metro/cache/dpml-cache-main/1.0.0/dpml-cache-main-1.0.0.jar.

Version:
2.1.0
Author:
Digital Product Management Library

Constructor Summary
ModernLayout()
           
 
Method Summary
 String getID()
          Return the layout identifier.
 String resolveBase(Artifact artifact)
          Return the base path for an artifact.
 String resolveFilename(Artifact artifact)
          Return the expanded filename of the artifact.
 String resolvePath(Artifact artifact)
          Returns the full path of the artifact relative to a logical root directory.
 
Methods inherited from class net.dpml.transit.Layout
getLayout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModernLayout

public ModernLayout()
Method Detail

getID

public String getID()
Return the layout identifier. The id value is used to identify layout instances assigned to cache handlers and resource host handlers.

Specified by:
getID in class Layout
Returns:
the layout id

resolveBase

public final String resolveBase(Artifact artifact)
Return the base path for an artifact. The base path is derived from the artifact group and type. The base path value represents the directory path relative to a repository root of the directory containing this artifact.

Specified by:
resolveBase in class Layout
Parameters:
artifact - the resource artifact
Returns:
the base path

resolvePath

public final String resolvePath(Artifact artifact)
Returns the full path of the artifact relative to a logical root directory. The full path is equivalent to the base path and artifact filename using the pattern "[base]/[filename]". Path values may be used to resolve an artifact from a remote repository or local cache relative to the repository or cache root.

Specified by:
resolvePath in class Layout
Parameters:
artifact - the resource artifact
Returns:
the logical artifact path
See Also:
resolveBase(net.dpml.transit.Artifact), resolveFilename(net.dpml.transit.Artifact)

resolveFilename

public String resolveFilename(Artifact artifact)
Return the expanded filename of the artifact. The filename is expressed as [name]-[version].[type] or in case of a null version simply [name].[type].

Specified by:
resolveFilename in class Layout
Parameters:
artifact - the resource artifact
Returns:
the artifact expanded filename
See Also:
Layout.resolveBase(net.dpml.transit.Artifact), Layout.resolveFilename(net.dpml.transit.Artifact)