org.apache.maven.shared.app.company
Class DefaultCompanyPomHandler

java.lang.Object
  extended by org.apache.maven.shared.app.company.DefaultCompanyPomHandler
All Implemented Interfaces:
CompanyPomHandler

public class DefaultCompanyPomHandler
extends java.lang.Object
implements CompanyPomHandler

Holds a company POM from the repository, and is able to find the latest one in a repository.


Field Summary
private  org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
           
private  org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
           
private  org.apache.maven.model.Model companyModel
          The company POM.
private  org.apache.maven.artifact.deployer.ArtifactDeployer deployer
           
private  org.apache.maven.artifact.installer.ArtifactInstaller installer
           
private  org.apache.maven.project.MavenProjectBuilder projectBuilder
           
 
Fields inherited from interface org.apache.maven.shared.app.company.CompanyPomHandler
ORGANIZATION_LOGO_PROPERTY, ROLE
 
Constructor Summary
DefaultCompanyPomHandler()
           
 
Method Summary
 org.apache.maven.model.Model getCompanyPomModel(org.apache.maven.shared.app.configuration.CompanyPom companyPom, org.apache.maven.artifact.repository.ArtifactRepository localRepository)
          Retrieve the company model (may be cached).
 org.apache.maven.model.Model getCompanyPomModel(org.apache.maven.shared.app.configuration.CompanyPom companyPom, org.apache.maven.artifact.repository.ArtifactRepository localRepository, java.util.List remoteRepositories)
          Retrieve the company model (may be cached).
private  org.apache.maven.artifact.Artifact getNewArtifact(org.apache.maven.model.Model companyModel)
           
 void save(org.apache.maven.model.Model companyModel, org.apache.maven.artifact.repository.ArtifactRepository localRepository)
          Save a company POM in the repository.
 void save(org.apache.maven.model.Model companyModel, org.apache.maven.artifact.repository.ArtifactRepository localRepository, org.apache.maven.artifact.repository.ArtifactRepository deploymentRepository)
          Save a company POM in the repository.
private static java.io.File writeTempFile(org.apache.maven.model.Model companyModel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

companyModel

private org.apache.maven.model.Model companyModel
The company POM.


projectBuilder

private org.apache.maven.project.MavenProjectBuilder projectBuilder

artifactFactory

private org.apache.maven.artifact.factory.ArtifactFactory artifactFactory

artifactMetadataSource

private org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource

installer

private org.apache.maven.artifact.installer.ArtifactInstaller installer

deployer

private org.apache.maven.artifact.deployer.ArtifactDeployer deployer
Constructor Detail

DefaultCompanyPomHandler

public DefaultCompanyPomHandler()
Method Detail

getCompanyPomModel

public org.apache.maven.model.Model getCompanyPomModel(org.apache.maven.shared.app.configuration.CompanyPom companyPom,
                                                       org.apache.maven.artifact.repository.ArtifactRepository localRepository)
                                                throws org.apache.maven.project.ProjectBuildingException,
                                                       org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException
Description copied from interface: CompanyPomHandler
Retrieve the company model (may be cached).

Specified by:
getCompanyPomModel in interface CompanyPomHandler
Parameters:
companyPom - the configuration holding the required group and artifact ID
localRepository - the local repository to use while resolving the POM
Returns:
the model
Throws:
org.apache.maven.project.ProjectBuildingException - if the existing POM in the repository is invalid
org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException - if there is a problem locating the existing POM from the repository

getCompanyPomModel

public org.apache.maven.model.Model getCompanyPomModel(org.apache.maven.shared.app.configuration.CompanyPom companyPom,
                                                       org.apache.maven.artifact.repository.ArtifactRepository localRepository,
                                                       java.util.List remoteRepositories)
                                                throws org.apache.maven.project.ProjectBuildingException,
                                                       org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException
Description copied from interface: CompanyPomHandler
Retrieve the company model (may be cached).

Specified by:
getCompanyPomModel in interface CompanyPomHandler
Parameters:
companyPom - the configuration holding the required group and artifact ID
localRepository - the local repository to use while resolving the POM
remoteRepositories - the repositories to search for the POM. The default repositories from the super POM will also be used if necessary.
Returns:
the model
Throws:
org.apache.maven.project.ProjectBuildingException - if the existing POM in the repository is invalid
org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException - if there is a problem locating the existing POM from the repository

save

public void save(org.apache.maven.model.Model companyModel,
                 org.apache.maven.artifact.repository.ArtifactRepository localRepository)
          throws java.io.IOException,
                 org.apache.maven.artifact.installer.ArtifactInstallationException
Description copied from interface: CompanyPomHandler
Save a company POM in the repository. At present, it does not deploy it to any remote repositories. The version in the model will be incremented to the next sequential single digit.

Specified by:
save in interface CompanyPomHandler
Parameters:
companyModel - the company model to save. This is likely to be the same instance already cached, but will replace the cached version regardless
localRepository - the local repository to use while deploying the POM.
Throws:
java.io.IOException - if there is a problem saving the model to the local repository
org.apache.maven.artifact.installer.ArtifactInstallationException - if there is a problem saving to the local repository

getNewArtifact

private org.apache.maven.artifact.Artifact getNewArtifact(org.apache.maven.model.Model companyModel)

writeTempFile

private static java.io.File writeTempFile(org.apache.maven.model.Model companyModel)
                                   throws java.io.IOException
Throws:
java.io.IOException

save

public void save(org.apache.maven.model.Model companyModel,
                 org.apache.maven.artifact.repository.ArtifactRepository localRepository,
                 org.apache.maven.artifact.repository.ArtifactRepository deploymentRepository)
          throws java.io.IOException,
                 org.apache.maven.artifact.installer.ArtifactInstallationException,
                 org.apache.maven.artifact.deployer.ArtifactDeploymentException
Description copied from interface: CompanyPomHandler
Save a company POM in the repository. At present, it does not deploy it to any remote repositories. The version in the model will be incremented to the next sequential single digit.

Specified by:
save in interface CompanyPomHandler
Parameters:
companyModel - the company model to save. This is likely to be the same instance already cached, but will replace the cached version regardless
localRepository - the local repository to use while deploying the POM.
deploymentRepository - the repository to deploy the final POM to. If null, the POM is not deployed.
Throws:
java.io.IOException - if there is a problem saving the model to the local repository
org.apache.maven.artifact.installer.ArtifactInstallationException - if there is a problem saving to the local repository
org.apache.maven.artifact.deployer.ArtifactDeploymentException - if there is a problem deploying to the remote repository