X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.repo%2Fsrc%2Forg%2Fargeo%2Fslc%2Frepo%2FModularDistributionIndexer.java;h=7d854a1c5d23c3e7b0dbb744109b49c6d528c154;hb=d64292c93f4a3532576e98f651344d89e883e2aa;hp=d89077322a73af49d2ef074b9ac7306dea5e4203;hpb=0c444984b6249f5bce331a9b1c02ad55369dacfc;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.repo/src/org/argeo/slc/repo/ModularDistributionIndexer.java b/org.argeo.slc.repo/src/org/argeo/slc/repo/ModularDistributionIndexer.java index d89077322..7d854a1c5 100644 --- a/org.argeo.slc.repo/src/org/argeo/slc/repo/ModularDistributionIndexer.java +++ b/org.argeo.slc.repo/src/org/argeo/slc/repo/ModularDistributionIndexer.java @@ -18,11 +18,10 @@ import javax.jcr.nodetype.NodeType; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.argeo.api.cms.CmsLog; import org.argeo.jcr.JcrUtils; -import org.argeo.slc.CategorizedNameVersion; -import org.argeo.slc.DefaultNameVersion; +import org.argeo.slc.CategoryNameVersion; +import org.argeo.slc.DefaultCategoryNameVersion; import org.argeo.slc.NameVersion; import org.argeo.slc.SlcException; import org.argeo.slc.SlcNames; @@ -42,7 +41,7 @@ import org.osgi.framework.Constants; * file contains a tag "dependencyManagement" that list all modules */ public class ModularDistributionIndexer implements NodeIndexer, SlcNames { - private final static Log log = LogFactory.getLog(ModularDistributionIndexer.class); + private final static CmsLog log = CmsLog.getLog(ModularDistributionIndexer.class); // Constants for csv indexing private final static String INDEX_FILE_NAME = "modularDistribution.csv"; @@ -111,7 +110,7 @@ public class ModularDistributionIndexer implements NodeIndexer, SlcNames { // Helpers private Node addModule(Node modules, NameVersion nameVersion) throws RepositoryException { - CategorizedNameVersion cnv = (CategorizedNameVersion) nameVersion; + CategoryNameVersion cnv = (CategoryNameVersion) nameVersion; Node moduleCoord = null; moduleCoord = modules.addNode(cnv.getName(), SlcTypes.SLC_MODULE_COORDINATES); moduleCoord.setProperty(SlcNames.SLC_CATEGORY, cnv.getCategory()); @@ -126,7 +125,7 @@ public class ModularDistributionIndexer implements NodeIndexer, SlcNames { try { jarIn = new JarInputStream(fileBinary.getStream()); - List modules = new ArrayList(); + List modules = new ArrayList(); // meta data manifest = jarIn.getManifest(); @@ -169,7 +168,7 @@ public class ModularDistributionIndexer implements NodeIndexer, SlcNames { st.nextToken(); // moduleVersion String relativeUrl = st.nextToken(); Artifact currModule = AetherUtils.convertPathToArtifact(relativeUrl, null); - modules.add(new MyCategorizedNameVersion(currModule.getGroupId(), currModule.getArtifactId(), + modules.add(new DefaultCategoryNameVersion(currModule.getGroupId(), currModule.getArtifactId(), currModule.getVersion())); } return new MyModularDistribution(distribution, modules); @@ -181,33 +180,19 @@ public class ModularDistributionIndexer implements NodeIndexer, SlcNames { } } - /** The created modular distribution */ - private static class MyCategorizedNameVersion extends DefaultNameVersion implements CategorizedNameVersion { - private final String category; - - public MyCategorizedNameVersion(String category, String name, String version) { - super(name, version); - this.category = category; - } - - public String getCategory() { - return category; - } - } - /** * A consistent and versioned OSGi distribution, which can be built and tested. */ private class MyModularDistribution extends ArtifactDistribution implements ArgeoOsgiDistribution { - private List modules; + private List modules; - public MyModularDistribution(Artifact artifact, List modules) { + public MyModularDistribution(Artifact artifact, List modules) { super(artifact); this.modules = modules; } - public Iterator nameVersions() { + public Iterator nameVersions() { return modules.iterator(); }