X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.support.maven%2Fsrc%2Forg%2Fargeo%2Fslc%2Fmaven%2FMavenToUrl.java;fp=org.argeo.slc.support.maven%2Fsrc%2Forg%2Fargeo%2Fslc%2Fmaven%2FMavenToUrl.java;h=1103e3c002483d680ed00a7e70fb2d836c9a98da;hb=5ff5e6e4b4e0928b9bae0da27a502b6a1885079f;hp=0000000000000000000000000000000000000000;hpb=c8d217cba139da3ef06e7da3172e100c29e257c4;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.support.maven/src/org/argeo/slc/maven/MavenToUrl.java b/org.argeo.slc.support.maven/src/org/argeo/slc/maven/MavenToUrl.java new file mode 100644 index 000000000..1103e3c00 --- /dev/null +++ b/org.argeo.slc.support.maven/src/org/argeo/slc/maven/MavenToUrl.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.maven; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.beans.factory.FactoryBean; + +public class MavenToUrl implements FactoryBean { + private List mavenFiles; + private String baseUrl; + + public List asUrls() { + List urls = new ArrayList(); + for (MavenFile mf : mavenFiles) + urls.add(convertToUrl(mf)); + return urls; + } + + public String convertToUrl(MavenFile mf) { + return baseUrl + mf.getGroupId().replace('.', '/') + '/' + + mf.getArtifactId() + '/' + mf.getVersion() + '/' + + mf.getArtifactId() + '-' + mf.getVersion() + '.' + + mf.getType(); + } + + public void setMavenFiles(List mavenFiles) { + this.mavenFiles = mavenFiles; + } + + public void setBaseUrl(String baseUrl) { + this.baseUrl = baseUrl; + } + + public Object getObject() throws Exception { + return asUrls(); + } + + public Class getObjectType() { + return List.class; + } + + public boolean isSingleton() { + return false; + } + +}