org.apache.maven.archetype
Class DefaultArchetypeManager

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.apache.maven.archetype.DefaultArchetypeManager
All Implemented Interfaces:
ArchetypeManager, org.codehaus.plexus.logging.LogEnabled

public class DefaultArchetypeManager
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements ArchetypeManager

Author:
Jason van Zyl
Plexus component

Field Summary
 
Fields inherited from interface org.apache.maven.archetype.ArchetypeManager
ROLE
 
Constructor Summary
DefaultArchetypeManager()
           
 
Method Summary
 File archiveArchetype(File archetypeDirectory, File outputDirectory, String finalName)
          Creates a jar file for an archetype.
 ArchetypeCreationResult createArchetypeFromProject(ArchetypeCreationRequest request)
          A command to create an archetype from an existing Maven project given the supplied creation request.
 ArchetypeGenerationResult generateProjectFromArchetype(ArchetypeGenerationRequest request)
          A command to generate a Maven project from an archetype given the supplied generation request.
 ArchetypeCatalog getDefaultLocalCatalog()
          Gives the catalog of archetypes located in ${user.home}/.m2/repository/archetype-catalog.xml.
 ArchetypeCatalog getInternalCatalog()
          Gives the catalog of archetypes internal to the plugin.
 ArchetypeCatalog getLocalCatalog(String path)
          Gives the catalog of archetypes located in the given path.
 ArchetypeCatalog getRemoteCatalog()
          Gives the catalog of archetypes located at http://repo1.maven.org/maven2/archetype-catalog.xml.
 ArchetypeCatalog getRemoteCatalog(String url)
          Gives the catalog of archetypes located at the given url.
 void updateLocalCatalog(Archetype archetype)
           
 void updateLocalCatalog(Archetype archetype, String path)
           
 void zip(File sourceDirectory, File archive)
           
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultArchetypeManager

public DefaultArchetypeManager()
Method Detail

createArchetypeFromProject

public ArchetypeCreationResult createArchetypeFromProject(ArchetypeCreationRequest request)
Description copied from interface: ArchetypeManager
A command to create an archetype from an existing Maven project given the supplied creation request.

Specified by:
createArchetypeFromProject in interface ArchetypeManager
Returns:
The result of creating the archetype from the existing project. It contains any errors that might have occurred.

generateProjectFromArchetype

public ArchetypeGenerationResult generateProjectFromArchetype(ArchetypeGenerationRequest request)
Description copied from interface: ArchetypeManager
A command to generate a Maven project from an archetype given the supplied generation request.

Specified by:
generateProjectFromArchetype in interface ArchetypeManager
Returns:
The result of creating the project from the existing archetype. It contains any errors that might have occurred.

archiveArchetype

public File archiveArchetype(File archetypeDirectory,
                             File outputDirectory,
                             String finalName)
                      throws org.apache.maven.artifact.DependencyResolutionRequiredException,
                             IOException
Description copied from interface: ArchetypeManager
Creates a jar file for an archetype.

Specified by:
archiveArchetype in interface ArchetypeManager
Returns:
The File to the generated jar
Throws:
org.apache.maven.artifact.DependencyResolutionRequiredException
IOException

zip

public void zip(File sourceDirectory,
                File archive)
         throws IOException
Throws:
IOException

getInternalCatalog

public ArchetypeCatalog getInternalCatalog()
Description copied from interface: ArchetypeManager
Gives the catalog of archetypes internal to the plugin.

Specified by:
getInternalCatalog in interface ArchetypeManager
Returns:
the catalog.

getDefaultLocalCatalog

public ArchetypeCatalog getDefaultLocalCatalog()
Description copied from interface: ArchetypeManager
Gives the catalog of archetypes located in ${user.home}/.m2/repository/archetype-catalog.xml.

Specified by:
getDefaultLocalCatalog in interface ArchetypeManager
Returns:
the catalog.

getLocalCatalog

public ArchetypeCatalog getLocalCatalog(String path)
Description copied from interface: ArchetypeManager
Gives the catalog of archetypes located in the given path. if path is a file, it used as is. if path is a directory, archetype-catalog.xml is appended to it.

Specified by:
getLocalCatalog in interface ArchetypeManager
Parameters:
path - the catalog file path or directory containing the catalog file.
Returns:
the catalog.

getRemoteCatalog

public ArchetypeCatalog getRemoteCatalog()
Description copied from interface: ArchetypeManager
Gives the catalog of archetypes located at http://repo1.maven.org/maven2/archetype-catalog.xml.

Specified by:
getRemoteCatalog in interface ArchetypeManager
Returns:
the catalog.

getRemoteCatalog

public ArchetypeCatalog getRemoteCatalog(String url)
Description copied from interface: ArchetypeManager
Gives the catalog of archetypes located at the given url. if the url doesn't define a catalog, then 'archetype-catalog.xml' is appended to it for search.

Specified by:
getRemoteCatalog in interface ArchetypeManager
Parameters:
url - the catalog url or base url containing the catalog file.
Returns:
the catalog.

updateLocalCatalog

public void updateLocalCatalog(Archetype archetype)
Specified by:
updateLocalCatalog in interface ArchetypeManager

updateLocalCatalog

public void updateLocalCatalog(Archetype archetype,
                               String path)
Specified by:
updateLocalCatalog in interface ArchetypeManager


Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.