X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=plugins%2Forg.argeo.slc.client.ui.dist%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fclient%2Fui%2Fdist%2Fcommands%2FNormalizeWorkspace.java;h=6591a56a72d1557e186066a7639a606f1835bb09;hb=39ceeb3083d5d9df0cf2f93bd26285e4c33234e3;hp=f6f9d06fea52412651de0080c99545ec112a8271;hpb=460cb0f2be7a8fa92ee6f22564b42a25aac5de4b;p=gpl%2Fargeo-slc.git diff --git a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/NormalizeWorkspace.java b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/NormalizeWorkspace.java index f6f9d06fe..6591a56a7 100644 --- a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/NormalizeWorkspace.java +++ b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/NormalizeWorkspace.java @@ -37,6 +37,7 @@ import org.argeo.slc.client.ui.dist.DistPlugin; import org.argeo.slc.jcr.SlcNames; import org.argeo.slc.repo.ArtifactIndexer; import org.argeo.slc.repo.JarFileIndexer; +import org.argeo.slc.repo.ModularDistributionIndexer; import org.argeo.slc.repo.PdeSourcesIndexer; import org.argeo.slc.repo.RepoConstants; import org.argeo.slc.repo.RepoUtils; @@ -73,10 +74,12 @@ public class NormalizeWorkspace extends AbstractHandler implements SlcNames { private Keyring keyring; private Repository repository; - private ArtifactIndexer artifactIndexer = new ArtifactIndexer(); + // Relevant default node indexers + private PdeSourcesIndexer pdeSourceIndexer = new PdeSourcesIndexer(); + // WARNING Order is important: must be called in the following order. + private ModularDistributionIndexer modularDistributionIndexer = new ModularDistributionIndexer(); private JarFileIndexer jarFileIndexer = new JarFileIndexer(); - private PdeSourcesIndexer pdeSourceIndexer = new PdeSourcesIndexer( - artifactIndexer, jarFileIndexer); + private ArtifactIndexer artifactIndexer = new ArtifactIndexer(); public Object execute(ExecutionEvent event) throws ExecutionException { String targetRepoPath = event.getParameter(PARAM_TARGET_REPO_PATH); @@ -85,7 +88,8 @@ public class NormalizeWorkspace extends AbstractHandler implements SlcNames { Session currSession = null; NormalizeJob job; try { - String msg = "Your are about to normalize workspace: " + wkspName + String msg = "Your are about to normalize workspace: " + + wkspName + ".\nThis will index OSGi bundles and Maven artifacts, " + "it will also convert Maven sources to PDE Sources if needed.\n" + "Note that no information will be overwritten: " @@ -139,8 +143,14 @@ public class NormalizeWorkspace extends AbstractHandler implements SlcNames { + session.getWorkspace().getName(), expectedCount.intValue()); NormalizingTraverser tiv = new NormalizingTraverser(monitor); - session.getNode(artifactBasePath).accept(tiv); + Node artifactBaseNode = session.getNode(artifactBasePath); + artifactBaseNode.accept(tiv); } catch (Exception e) { + log.error("Error normalizing workspace " + + session.getWorkspace().getName() + ": " + + e.getMessage()); + if (log.isErrorEnabled()) + e.printStackTrace(); return new Status(IStatus.ERROR, DistPlugin.ID, "Cannot normalize distribution " + session.getWorkspace().getName(), e); @@ -179,14 +189,30 @@ public class NormalizeWorkspace extends AbstractHandler implements SlcNames { if (jarFileIndexer.support(node.getPath())) if (artifactIndexer.support(node.getPath())) { monitor.subTask(node.getName()); - artifactIndexer.index(node); + modularDistributionIndexer.index(node); jarFileIndexer.index(node); - node.getSession().save(); + artifactIndexer.index(node); + if (node.getSession().hasPendingChanges()) { + node.getSession().save(); + if (log.isDebugEnabled()) + log.debug("Processed jar artifact " + + node.getPath()); + } monitor.worked(1); - if (log.isDebugEnabled()) - log.debug("Processed artifact " - + node.getPath()); } + } else if (node.getName().endsWith(".pom")) { + // Removed: we do not support binaries concept anymore. + // if (distBundleIndexer.support(node.getPath())) + // distBundleIndexer.index(node); + if (artifactIndexer.support(node.getPath())) + artifactIndexer.index(node); + if (node.getSession().hasPendingChanges()) { + node.getSession().save(); + if (log.isDebugEnabled()) + log.debug("Processed pom artifact " + + node.getPath()); + } + monitor.worked(1); } else { monitor.worked(1); }