I want to support some custom Layout for remote repository but Connector only support "default" ContentType for RemoteRepository and use DefaultLayout/MavenDefaultLayout.
To support custom layout, I copied/modified connector (file currently) and create a RemoteRepositoryWithLayout, as an hack I remove reference to DefaultLayout and add the following methods. It would be simpler if RemoteRepository provide the Layout in default implementation, should I open a ticket for change ?
private String findPath() {
String path = null;
switch ( transfer.getType() )
{
case ARTIFACT:
Artifact artifact = transfer.getArtifact();
path = findLayout(repository).getPath( artifact ).getPath();
break;
case METADATA:
Metadata metadata = transfer.getMetadata();
path = findLayout(repository).getPath( metadata ).getPath();
break;
}
return path;
}
private RepositoryLayout findLayout(RemoteRepository repo) {
RepositoryLayout back = null;
if (repo instanceof RemoteRepositoryWithLayout) {
back = ((RemoteRepositoryWithLayout) repo).getLayout();
}
if (back == null && "default".equals(repo.getContentType())) {
return new MavenDefaultLayout();
}
if (back == null)
throw new IllegalArgumentException("RepositoryLayout not found for :" + repo);
return back;
}
----