net.dpml.transit.layout
Class ClassicLayout

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

public class ClassicLayout
extends Layout

The ClassicLayout decodes artifacts into the Classic/Maven layout of artifacts on a file system or http server. This format says that for an artifact artifact:[type]:[group]/[name]#[version] the location of such artifact would be; [group]/[type]s/[name]-[version].[type]. Example; artifact:jar:metro/cache/dpml-cache-main#1.0.0 would return the path metro/cache/jars/dpml-cache-main-1.0.0.jar.

Version:
2.1.0
Author:
Digital Product Management Library

Constructor Summary
ClassicLayout()
           
 
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

ClassicLayout

public ClassicLayout()
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. For an artifact group of "metro/cache" and a type equal to "jar", the base value will be translated using the pattern "[group]/[type]s" to form "metro/cache/jars". 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. An artifact such as artifact:jar:metro/cache/dpml-cache-main#1.0.0 would return the path metro/cache/jars/dpml-cache-main-1.0.0.jar.

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)