]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/maven/Migration_01_03.java
Improve distribution
[gpl/argeo-slc.git] / runtime / org.argeo.slc.repo / src / main / java / org / argeo / slc / repo / maven / Migration_01_03.java
index 56ffd7f67f5dd18cbba7863a8fc0448a33da1113..baf6ec723e0f852b4370e79c5921552de3391533 100644 (file)
@@ -1,8 +1,22 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.argeo.slc.repo.maven;
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -34,6 +48,7 @@ import org.argeo.slc.jcr.SlcTypes;
 import org.argeo.slc.repo.ArtifactIndexer;
 import org.argeo.slc.repo.JarFileIndexer;
 import org.argeo.slc.repo.RepoUtils;
+import org.argeo.slc.repo.osgi.OsgiProfile;
 import org.osgi.framework.Constants;
 import org.sonatype.aether.artifact.Artifact;
 import org.sonatype.aether.util.artifact.DefaultArtifact;
@@ -61,7 +76,8 @@ public class Migration_01_03 implements Runnable, SlcNames {
        private Session origSession;
        private Session targetSession;
 
-       private List<String> systemPackages;
+       private List<String> systemPackages = OsgiProfile.PROFILE_JAVA_SE_1_6
+                       .getSystemPackages();
 
        private String artifactBasePath = "/";
 
@@ -75,8 +91,8 @@ public class Migration_01_03 implements Runnable, SlcNames {
                                targetWorkspace);
 
                // works only in OSGi!!
-               systemPackages = Arrays.asList(System.getProperty(
-                               "org.osgi.framework.system.packages").split(","));
+               // systemPackages = Arrays.asList(System.getProperty(
+               // "org.osgi.framework.system.packages").split(","));
        }
 
        public void destroy() {
@@ -121,6 +137,24 @@ public class Migration_01_03 implements Runnable, SlcNames {
        protected void processOrigArtifactVersion(Node origArtifactNode)
                        throws RepositoryException, IOException {
                Artifact origArtifact = RepoUtils.asArtifact(origArtifactNode);
+
+               // skip eclipse artifacts
+               if ((origArtifact.getGroupId().startsWith("org.eclipse") && !(origArtifact
+                               .getArtifactId().equals("org.eclipse.osgi")
+                               || origArtifact.getArtifactId().equals(
+                                               "org.eclipse.osgi.source") || origArtifact
+                               .getArtifactId().startsWith("org.eclipse.rwt.widgets.upload")))
+                               || origArtifact.getArtifactId().startsWith("com.ibm.icu")) {
+                       if (log.isDebugEnabled())
+                               log.debug("Skip " + origArtifact);
+                       return;
+               }
+
+               // skip SpringSource ActiveMQ
+               if (origArtifact.getArtifactId().startsWith(
+                               "com.springsource.org.apache.activemq"))
+                       return;
+
                String origJarNodeName = MavenConventionsUtils
                                .artifactFileName(origArtifact);
                if (!origArtifactNode.hasNode(origJarNodeName))
@@ -176,6 +210,10 @@ public class Migration_01_03 implements Runnable, SlcNames {
                                        && !origFragmentHost.equals(SPRING_SOURCE_PREFIX + ".json")) {
                                targetFragmentHost = origFragmentHost
                                                .substring(SPRING_SOURCE_PREFIX.length() + 1);
+                       } else if (origFragmentHost
+                                       .equals("org.argeo.dep.jacob;bundle-version=\"[1.14.3,1.14.4)\"")) {
+                               // this one for those who think I cannot be pragmatic - mbaudier
+                               targetFragmentHost = "com.jacob;bundle-version=\"[1.14.3,1.14.4)\"";
                        } else {
                                targetFragmentHost = origFragmentHost;
                        }
@@ -243,8 +281,16 @@ public class Migration_01_03 implements Runnable, SlcNames {
 
                // target coordinates
                final String targetGroupId;
-               if (origArtifact.getGroupId().startsWith("org.eclipse"))
-                       targetGroupId = "org.argeo.tp.eclipse";
+               if (origArtifact.getArtifactId().startsWith(
+                               "org.eclipse.rwt.widgets.upload"))
+                       targetGroupId = "org.argeo.tp.rap";
+               else if (origArtifact.getArtifactId().startsWith("org.polymap"))
+                       targetGroupId = "org.argeo.tp.rap";
+               else if (origArtifact.getGroupId().startsWith("org.eclipse")
+                               && !origArtifact.getArtifactId().equals("org.eclipse.osgi"))
+                       throw new SlcException(origArtifact + " should have been excluded");// targetGroupId
+                                                                                                                                                               // =
+                                                                                                                                                               // "org.argeo.tp.eclipse";
                else
                        targetGroupId = "org.argeo.tp";