From 4412d53a65487b529675e342258d644ee4903421 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Thu, 17 May 2012 16:48:15 +0000 Subject: [PATCH] Migration v1.3: first completely resolved distribution git-svn-id: https://svn.argeo.org/slc/trunk@5303 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- demo/slc_demo_rcp.properties | 4 +-- .../client/ui/dist/commands/RunInOsgi.java | 4 ++- .../argeo/slc/repo/maven/Migration_01_03.java | 29 ++++++++++++++----- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/demo/slc_demo_rcp.properties b/demo/slc_demo_rcp.properties index 421fc6bba..059a84ce9 100644 --- a/demo/slc_demo_rcp.properties +++ b/demo/slc_demo_rcp.properties @@ -17,8 +17,8 @@ org.argeo.slc.demo.minimal,\ spring.security.strategy=MODE_INHERITABLETHREADLOCAL eclipse.application=org.argeo.slc.client.rcp.application -#org.argeo.security.ui.initialPerspective=org.argeo.slc.client.ui.slcExecutionPerspective -org.argeo.security.ui.initialPerspective=org.argeo.slc.client.ui.dist.distributionPerspective +org.argeo.security.ui.initialPerspective=org.argeo.slc.client.ui.slcExecutionPerspective +#org.argeo.security.ui.initialPerspective=org.argeo.slc.client.ui.dist.distributionPerspective log4j.configuration=file:../../log4j.properties diff --git a/eclipse/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/RunInOsgi.java b/eclipse/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/RunInOsgi.java index 29299470b..78a1e92a1 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/RunInOsgi.java +++ b/eclipse/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/RunInOsgi.java @@ -56,7 +56,7 @@ public class RunInOsgi extends AbstractHandler implements SlcNames { public Object execute(ExecutionEvent event) throws ExecutionException { File targetDirectory = new File( - "/home/mbaudier/dev/work/120517-ArgeoTP/lib"); + "/home/mbaudier/dev/work/120517-ArgeoTP/" + workspace); InputStream jarStream = null; OutputStream out = null; @@ -81,6 +81,8 @@ public class RunInOsgi extends AbstractHandler implements SlcNames { if (symbolicName.startsWith("org.eclipse") && !symbolicName.equals("org.eclipse.osgi")) continue bundles; + if(symbolicName.equals("org.polymap.openlayers.rap.widget")) + continue bundles; File targetFile = new File(targetDirectory, bundleNode.getName()); diff --git a/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/maven/Migration_01_03.java b/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/maven/Migration_01_03.java index 9e37f7592..bd8c78838 100644 --- a/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/maven/Migration_01_03.java +++ b/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/maven/Migration_01_03.java @@ -1,6 +1,7 @@ package org.argeo.slc.repo.maven; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.jar.Attributes.Name; @@ -52,6 +53,8 @@ public class Migration_01_03 implements Runnable, SlcNames { private String sourceWorkspace; private String targetWorkspace; + private List excludedBundles = new ArrayList(); + private Session origSession; private Session targetSession; @@ -81,19 +84,21 @@ public class Migration_01_03 implements Runnable, SlcNames { public void run() { try { - NodeIterator origArtifacts = listArtifactVersions(origSession); - // clear target NodeIterator nit = targetSession.getNode(artifactBasePath) .getNodes(); while (nit.hasNext()) { Node node = nit.nextNode(); if (node.isNodeType(NodeType.NT_FOLDER) - || node.isNodeType(NodeType.NT_UNSTRUCTURED)) + || node.isNodeType(NodeType.NT_UNSTRUCTURED)) { node.remove(); + node.getSession().save(); + if (log.isDebugEnabled()) + log.debug("Cleared " + node); + } } - targetSession.save(); + NodeIterator origArtifacts = listArtifactVersions(origSession); // process while (origArtifacts.hasNext()) { Node origArtifactNode = origArtifacts.nextNode(); @@ -147,6 +152,10 @@ public class Migration_01_03 implements Runnable, SlcNames { targetSymbolicName = origSymbolicName; } + // skip excluded bundles + if (excludedBundles.contains(targetSymbolicName)) + return; + // check fragment host if (origManifest.getMainAttributes().containsKey( new Name(Constants.FRAGMENT_HOST))) { @@ -183,7 +192,7 @@ public class Migration_01_03 implements Runnable, SlcNames { if (systemPackages.contains(pkg)) { if (!(sourceVersion.trim().equals("0") || sourceVersion .trim().equals("0.0.0"))) { - targetVersion = "0"; + targetVersion = null; importPackagesModified = true; if (log.isDebugEnabled()) log.debug(origSymbolicName @@ -191,8 +200,9 @@ public class Migration_01_03 implements Runnable, SlcNames { + sourceVersion); } } - targetImportPackages.append(";version=\"") - .append(targetVersion).append("\""); + if (targetVersion != null) + targetImportPackages.append(";version=\"") + .append(targetVersion).append("\""); } if (importPackage.hasProperty(SLC_OPTIONAL)) { Boolean optional = importPackage.getProperty(SLC_OPTIONAL) @@ -340,4 +350,9 @@ public class Migration_01_03 implements Runnable, SlcNames { public void setTargetWorkspace(String targetWorkspace) { this.targetWorkspace = targetWorkspace; } + + public void setExcludedBundles(List excludedBundles) { + this.excludedBundles = excludedBundles; + } + } -- 2.39.5