]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.repo/src/org/argeo/slc/repo/ModularDistributionIndexer.java
Merge remote-tracking branch 'origin/unstable' into testing
[gpl/argeo-slc.git] / org.argeo.slc.repo / src / org / argeo / slc / repo / ModularDistributionIndexer.java
index d89077322a73af49d2ef074b9ac7306dea5e4203..7d854a1c5d23c3e7b0dbb744109b49c6d528c154 100644 (file)
@@ -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</li> </list>
  */
 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<CategorizedNameVersion> modules = new ArrayList<CategorizedNameVersion>();
+                       List<CategoryNameVersion> modules = new ArrayList<CategoryNameVersion>();
 
                        // 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<CategorizedNameVersion> modules;
+               private List<CategoryNameVersion> modules;
 
-               public MyModularDistribution(Artifact artifact, List<CategorizedNameVersion> modules) {
+               public MyModularDistribution(Artifact artifact, List<CategoryNameVersion> modules) {
                        super(artifact);
                        this.modules = modules;
                }
 
-               public Iterator<CategorizedNameVersion> nameVersions() {
+               public Iterator<CategoryNameVersion> nameVersions() {
                        return modules.iterator();
                }