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=1e1265a1d3a1b2a962527f71a62db83689c48afe;hb=c23b50e8d6286e38e9adfecfc828869a838c5a6f;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..1e1265a1d 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 @@ -36,6 +36,7 @@ import org.argeo.slc.SlcException; 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.DistributionBundleIndexer; import org.argeo.slc.repo.JarFileIndexer; import org.argeo.slc.repo.PdeSourcesIndexer; import org.argeo.slc.repo.RepoConstants; @@ -75,6 +76,8 @@ public class NormalizeWorkspace extends AbstractHandler implements SlcNames { private ArtifactIndexer artifactIndexer = new ArtifactIndexer(); private JarFileIndexer jarFileIndexer = new JarFileIndexer(); + private DistributionBundleIndexer distBundleIndexer = new DistributionBundleIndexer(); + private PdeSourcesIndexer pdeSourceIndexer = new PdeSourcesIndexer( artifactIndexer, jarFileIndexer); @@ -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); @@ -181,12 +191,23 @@ public class NormalizeWorkspace extends AbstractHandler implements SlcNames { monitor.subTask(node.getName()); artifactIndexer.index(node); jarFileIndexer.index(node); - node.getSession().save(); + distBundleIndexer.index(node); + if (node.getSession().hasPendingChanges()) { + node.getSession().save(); + if (log.isDebugEnabled()) + log.debug("Processed artifact " + + node.getPath()); + } monitor.worked(1); - if (log.isDebugEnabled()) - log.debug("Processed artifact " - + node.getPath()); } + } else if (node.getName().endsWith(".pom")) { + distBundleIndexer.index(node); + if (node.getSession().hasPendingChanges()) { + node.getSession().save(); + if (log.isDebugEnabled()) + log.debug("Processed artifact " + node.getPath()); + } + monitor.worked(1); } else { monitor.worked(1); }