use of org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository in project maven-scm by apache.
the class CvsLoginCommand method executeLoginCommand.
/**
* {@inheritDoc}
*/
public LoginScmResult executeLoginCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
CvsScmProviderRepository repo = (CvsScmProviderRepository) repository;
if (!"pserver".equals(repo.getTransport())) {
return new LoginScmResult(null, "The cvs login ignored for " + repo.getTransport() + ".", "", true);
} else if (isCvsNT()) {
// We don't continue becauseCVSNT doesn't use .cvspass
return new LoginScmResult(null, "The cvs login ignored for CVSNT.", "", true);
}
CvsPass passGenerator = new CvsPass(getLogger());
passGenerator.setCvsroot(repo.getCvsRootForCvsPass());
passGenerator.setPassword(repo.getPassword());
try {
passGenerator.execute();
} catch (IOException e) {
throw new ScmException("Error while executing cvs login command.", e);
}
return new LoginScmResult(null, "The cvs command succeed.", "", true);
}
use of org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository in project maven-plugins by apache.
the class DoapMojo method writeSourceRepository.
/**
* Write a DOAP repository, for instance:
* <p/>
* <pre>
* <repository>
* <SVNRepository>
* <location rdf:resource="http://svn.apache.org/repos/asf/maven/components/trunk/"/>
* <browse rdf:resource="http://svn.apache.org/viewcvs.cgi/maven/components/trunk/"/>
* </SVNRepository>
* </repository>
* </pre>
*
* @param writer not null
* @param project the Maven project, not null
* @param connection not null
* @see <a href="http://usefulinc.com/ns/doap#Repository">http://usefulinc.com/ns/doap#Repository</a>
* @see <a href="http://usefulinc.com/ns/doap#CVSRepository">http://usefulinc.com/ns/doap#CVSRepository</a>
* @see <a href="http://usefulinc.com/ns/doap#SVNRepository">http://usefulinc.com/ns/doap#SVNRepository</a>
*/
private void writeSourceRepository(XMLWriter writer, MavenProject project, String connection) {
ScmRepository repository = getScmRepository(connection);
DoapUtil.writeStartElement(writer, doapOptions.getXmlnsPrefix(), "repository");
if (isScmSystem(repository, "cvs")) {
DoapUtil.writeStartElement(writer, doapOptions.getXmlnsPrefix(), "CVSRepository");
CvsScmProviderRepository cvsRepo = (CvsScmProviderRepository) repository.getProviderRepository();
DoapUtil.writeElement(writer, doapOptions.getXmlnsPrefix(), "anon-root", cvsRepo.getCvsRoot());
DoapUtil.writeElement(writer, doapOptions.getXmlnsPrefix(), "module", cvsRepo.getModule());
} else if (isScmSystem(repository, "svn")) {
DoapUtil.writeStartElement(writer, doapOptions.getXmlnsPrefix(), "SVNRepository");
SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) repository.getProviderRepository();
DoapUtil.writeRdfResourceElement(writer, doapOptions.getXmlnsPrefix(), "location", svnRepo.getUrl());
} else {
/*
* Supported DOAP repositories actually unsupported by SCM: BitKeeper
* (http://usefulinc.com/ns/doap#BKRepository) Arch (http://usefulinc.com/ns/doap#ArchRepository) Other SCM
* repos are unsupported by DOAP.
*/
DoapUtil.writeStartElement(writer, doapOptions.getXmlnsPrefix(), "Repository");
if (connection.length() < 4) {
throw new IllegalArgumentException("The source repository connection is too short.");
}
DoapUtil.writeRdfResourceElement(writer, doapOptions.getXmlnsPrefix(), "location", connection.substring(4));
}
DoapUtil.writeRdfResourceElement(writer, doapOptions.getXmlnsPrefix(), "browse", project.getScm().getUrl());
// CVSRepository || SVNRepository || Repository
writer.endElement();
// repository
writer.endElement();
}
Aggregations