Update comments
authorBruno Sinou <bsinou@argeo.org>
Tue, 6 Jan 2015 13:49:36 +0000 (13:49 +0000)
committerBruno Sinou <bsinou@argeo.org>
Tue, 6 Jan 2015 13:49:36 +0000 (13:49 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@7628 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/ModularDistributionFactory.java
runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/ProcessDistribution.java

index a2c075e981ab16411021accbd99844ac4094aa08..79d3b5175ef8870e810f286b3c191d1d08e962a5 100644 (file)
@@ -47,6 +47,7 @@ public class ModularDistributionFactory implements Runnable {
 
        // Constants
        private final static String CSV_FILE_NAME = "modularDistribution.csv";
+
        // private final static String FEATURE_FILE_NAME = "feature.xml";
        // private static int BUFFER_SIZE = 10240;
 
@@ -85,9 +86,8 @@ public class ModularDistributionFactory implements Runnable {
                        // index
                        osgiFactory.indexNode(distNode);
 
-                       // Really ?
+                       // We use a specific session. Save before closing
                        javaSession.save();
-
                } catch (RepositoryException e) {
                        throw new SlcException(
                                        "JCR error while persisting modular distribution in JCR "
@@ -466,23 +466,6 @@ public class ModularDistributionFactory implements Runnable {
        }
 
        // Helpers
-       // private Node addModule(Node modules, NameVersion nameVersion)
-       // throws RepositoryException {
-       // CategorizedNameVersion cnv = (CategorizedNameVersion) nameVersion;
-       // Node moduleCoord = null;
-       // // TODO solve the same name issue
-       // // if (modules.hasNode(cnv.getName()))
-       // // moduleCoord = modules.getNode(cnv.getName());
-       // // else {
-       // moduleCoord = modules.addNode(cnv.getName(),
-       // SlcTypes.SLC_MODULE_COORDINATES);
-       // moduleCoord.setProperty(SlcNames.SLC_CATEGORY, cnv.getCategory());
-       // moduleCoord.setProperty(SlcNames.SLC_NAME, cnv.getName());
-       // moduleCoord.setProperty(SlcNames.SLC_VERSION, cnv.getVersion());
-       // // }
-       // return moduleCoord;
-       // }
-
        private void addToJar(byte[] content, String name, JarOutputStream target)
                        throws IOException {
                ByteArrayInputStream in = null;
@@ -531,8 +514,9 @@ public class ModularDistributionFactory implements Runnable {
                return builder.toString();
        }
 
-       public void setJavaSession(Session javaSession) {
-               this.javaSession = javaSession;
+       /** Enable dependency injection */
+       public void setOsgiFactory(OsgiFactory osgiFactory) {
+               this.osgiFactory = osgiFactory;
        }
 
        public void setOsgiDistribution(ArgeoOsgiDistribution osgiDistribution) {
index bdb81ae0b57454ae1ceac883f14ac36ddb4a87c2..9ea467d773d9d5a507ad6e60b835d9cc6c49b7fa 100644 (file)
@@ -33,17 +33,12 @@ public class ProcessDistribution implements Runnable {
                                        .nameVersions(); it.hasNext();)
                                processNameVersion(javaSession, it.next());
 
+                       // explicitly create the corresponding modular distribution as we
+                       // have here all necessary info.
                        ModularDistributionFactory mdf = new ModularDistributionFactory(
                                        osgiFactory, osgiDistribution);
                        mdf.run();
 
-                       // TODO why is the created distribution not automatically indexed?
-                       // osgiFactory.indexNode(node);
-                       // javaSession.save();
-
-                       // Node artifact = createDistributionArtifact(javaSession,
-                       // osgiDistribution);
-
                } catch (RepositoryException e) {
                        throw new SlcException("Cannot process distribution "
                                        + osgiDistribution, e);