org.apache.avalon.repository
Class Artifact

java.lang.Object
  extended byorg.apache.avalon.repository.Artifact
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ClassicArtifact

public class Artifact
extends Object
implements Serializable

Defintion of a artifact that maintains a relative url to some nominally remote file together with a set of assigned properties.

Version:
$Revision: 1.1 $
Author:
Stephen McConnell
See Also:
Serialized Form

Field Summary
static String SEP
           
 
Constructor Summary
Artifact(String base, String filename)
          Creation of a new artifact reference.
Artifact(String base, String filename, Properties properties)
          Creation of a new artifact reference.
 
Method Summary
static Artifact createArtifact(String base, String filename)
          Creation of a new Artifact relative to a supplied base directory and filename.
static Artifact createArtifact(String base, String filename, Properties properties)
          Creation of a new Artifact relative to a supplied base directory and filename.
 String getBase()
          Return the base path to the artifact.
 String getFilename()
          Return the filename of the artifact.
 String getPath()
          Gets the artifact path.
 String getProperty(String key)
          Return a domain specific property associated with an artifact.
 Enumeration getPropertyNames()
          Returns an enumeration of the property names associated to this appliance by the factory that created it.
 String getURL(String repository)
          Gets the URL to the artifact given a base URL for a remote repository.
 String toString()
          Returns the artifact specification String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SEP

public static final String SEP
See Also:
Constant Field Values
Constructor Detail

Artifact

public Artifact(String base,
                String filename)
Creation of a new artifact reference.

Parameters:
base - the base path to the artifact
filename - the artifact filename

Artifact

public Artifact(String base,
                String filename,
                Properties properties)
Creation of a new artifact reference.

Parameters:
base - the base path to the artifact
filename - the artifact filename
Method Detail

createArtifact

public static Artifact createArtifact(String base,
                                      String filename)
Creation of a new Artifact relative to a supplied base directory and filename. The argument supplied to the path is a nominal relative reference anchored relative to a repository root. The filename when appended to the base path forms a logical relative root path.

Parameters:
base - the base directory path
filename - the artifact filename
Returns:
the artifact reference

createArtifact

public static Artifact createArtifact(String base,
                                      String filename,
                                      Properties properties)
Creation of a new Artifact relative to a supplied base directory and filename. The argument supplied to the path is a nominal relative reference anchored relative to a repository root. The filename when appended to the base path forms a logical relative root path. The supplied properties argument may be used to attribute domain specific information to the artifact.

Parameters:
base - the base directory path
filename - the artifact filename
properties - a properties set to attribute to the artifact
Returns:
the artifact reference

getProperty

public String getProperty(String key)
Return a domain specific property associated with an artifact. Domain specific properties keys are defined defined and associated with an artifact by the factory creating the artifact.

Parameters:
key - the property key
Returns:
the property value or null if the value is unknown

getPropertyNames

public Enumeration getPropertyNames()
Returns an enumeration of the property names associated to this appliance by the factory that created it.

Returns:
the enumeration of property names

getBase

public String getBase()
Return the base path to the artifact. This is equivelent to the a logic directory path without a leading or trailing seperator.

Returns:
the base path.

getFilename

public String getFilename()
Return the filename of the artifact.

Returns:
the name.

getPath

public String getPath()
Gets the artifact path. The value returned is equal to the base path, seperator and filename.

Returns:
the artifact path

getURL

public String getURL(String repository)
Gets the URL to the artifact given a base URL for a remote repository.

Parameters:
repository - the base repository URL
Returns:
the full URL to the artifact

toString

public String toString()
Returns the artifact specification String.

See Also:
Object.toString()


Copyright © Apache Software Foundation. All Rights Reserved.