Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff McAffer2007-11-07 02:08:23 +0000
committerJeff McAffer2007-11-07 02:08:23 +0000
commitbb68d990798b2fc2fe34ef901dc54c1b88e2733f (patch)
tree632be08daeea3966d8e7d11974c74f29ef263771
parent6625391e00ad1bf189ba5c14488ec9b4c42d9419 (diff)
downloadrt.equinox.p2-bb68d990798b2fc2fe34ef901dc54c1b88e2733f.tar.gz
rt.equinox.p2-bb68d990798b2fc2fe34ef901dc54c1b88e2733f.tar.xz
rt.equinox.p2-bb68d990798b2fc2fe34ef901dc54c1b88e2733f.zip
refactor the repository optimizers and processors and further adapt to API changes
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Application.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Pack200Step.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.processors/.settings/org.eclipse.jdt.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.processors/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processor/pack200/Unpack200Step.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF1
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/plugin.xml8
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror/Mirror.java59
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror/MirrorApplication.java91
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Unpack200Step.java109
-rw-r--r--bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.jarprocessor/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/optimizer/PackRepositoryTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java2
19 files changed, 179 insertions, 129 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF
index d4f384a96..cd2bd2233 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF
@@ -7,9 +7,9 @@ Bundle-Localization: plugin
Bundle-Version: 0.1.0.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.artifact.optimizers.pack200.Activator
Import-Package: org.eclipse.equinox.app;version="1.0.0",
+ org.eclipse.equinox.internal.p2.core.helpers,
org.eclipse.equinox.p2.artifact.repository,
org.eclipse.equinox.p2.artifact.repository.processing,
- org.eclipse.equinox.p2.core.helpers,
org.eclipse.equinox.p2.core.repository,
org.eclipse.equinox.p2.jarprocessor,
org.eclipse.equinox.p2.metadata,
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Application.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Application.java
index 7de271a8a..02944bf90 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Application.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Application.java
@@ -12,9 +12,9 @@ import java.net.URL;
import java.util.Map;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.p2.artifact.repository.IArtifactRepository;
import org.eclipse.equinox.p2.artifact.repository.IArtifactRepositoryManager;
-import org.eclipse.equinox.p2.core.helpers.ServiceHelper;
public class Application implements IApplication {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java
index a529ae6c1..ae0e7c37f 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java
@@ -12,9 +12,9 @@ import java.net.URL;
import java.util.Map;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.p2.artifact.repository.IArtifactRepository;
import org.eclipse.equinox.p2.artifact.repository.IArtifactRepositoryManager;
-import org.eclipse.equinox.p2.core.helpers.ServiceHelper;
public class Application implements IApplication {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Pack200Step.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Pack200Step.java
index bb8b1cba5..9800352bc 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Pack200Step.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Pack200Step.java
@@ -14,8 +14,8 @@ package org.eclipse.equinox.internal.p2.artifact.optimizers.pack200;
import java.io.*;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.p2.artifact.repository.processing.ProcessingStep;
-import org.eclipse.equinox.p2.core.helpers.FileUtils;
import org.eclipse.equinox.p2.jarprocessor.JarProcessorExecutor;
import org.eclipse.equinox.p2.jarprocessor.JarProcessorExecutor.Options;
diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.artifact.processors/.settings/org.eclipse.jdt.core.prefs
index 82d6d39cf..b503d85c9 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.processors/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.artifact.processors/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Mon Nov 05 21:23:42 EST 2007
+#Tue Nov 06 20:46:54 EST 2007
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
@@ -23,7 +23,7 @@ org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.artifact.processors/META-INF/MANIFEST.MF
index 0ba64b648..b668fe298 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.processors/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.artifact.processors/META-INF/MANIFEST.MF
@@ -8,10 +8,10 @@ Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
J2SE-1.4
Require-Bundle: org.eclipse.equinox.common,
org.eclipse.equinox.registry
-Import-Package: org.eclipse.equinox.internal.p2.jarprocessor,
+Import-Package: org.eclipse.equinox.internal.p2.core.helpers,
+ org.eclipse.equinox.internal.p2.jarprocessor,
org.eclipse.equinox.p2.artifact.repository,
org.eclipse.equinox.p2.artifact.repository.processing,
- org.eclipse.equinox.p2.core.helpers,
org.eclipse.equinox.p2.jarprocessor
Bundle-Vendor: %providerName
Export-Package: org.eclipse.equinox.internal.p2.artifact.processor.jardelta;x-internal:=true,
diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processor/pack200/Unpack200Step.java b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processor/pack200/Unpack200Step.java
index aa4385d31..c3bf77c9a 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processor/pack200/Unpack200Step.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processor/pack200/Unpack200Step.java
@@ -14,11 +14,11 @@ package org.eclipse.equinox.internal.p2.artifact.processor.pack200;
import java.io.*;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.p2.jarprocessor.UnpackStep;
import org.eclipse.equinox.p2.artifact.repository.IArtifactDescriptor;
import org.eclipse.equinox.p2.artifact.repository.processing.ProcessingStep;
import org.eclipse.equinox.p2.artifact.repository.processing.ProcessingStepDescriptor;
-import org.eclipse.equinox.p2.core.helpers.FileUtils;
import org.eclipse.equinox.p2.jarprocessor.JarProcessorExecutor;
import org.eclipse.equinox.p2.jarprocessor.JarProcessorExecutor.Options;
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs
index 3f53e5adb..a00525b0a 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Mon Sep 17 23:16:48 EDT 2007
+#Tue Nov 06 20:55:51 EST 2007
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
@@ -23,7 +23,7 @@ org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
@@ -72,6 +72,7 @@ org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
@@ -81,6 +82,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.3
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF
index 5ab7cef45..948e482a9 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF
@@ -11,6 +11,7 @@ Export-Package: org.eclipse.equinox.internal.p2.artifact.repository;x-friends:="
org.eclipse.equinox.spi.p2.artifact.repository
Import-Package: javax.xml.parsers,
org.eclipse.core.runtime.preferences;resolution:=optional,
+ org.eclipse.equinox.app;version="1.0.0",
org.eclipse.equinox.internal.p2.core.helpers,
org.eclipse.equinox.internal.p2.jarprocessor;resolution:=optional,
org.eclipse.equinox.internal.p2.metadata,
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/plugin.xml b/bundles/org.eclipse.equinox.p2.artifact.repository/plugin.xml
index ecf0c11f8..daca19045 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/plugin.xml
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/plugin.xml
@@ -3,6 +3,7 @@
<plugin>
<extension-point id="artifactRepositories" name="Artifact Repositories" schema="schema/artifactRepositories.exsd"/>
<extension-point id="processingSteps" name="Processing Steps" schema="schema/processingSteps.exsd"/>
+
<extension id="simpleRepository" point="org.eclipse.equinox.p2.artifact.repository.artifactRepositories">
<filter suffix="artifacts.xml"/>
<factory class="org.eclipse.equinox.internal.p2.artifact.repository.SimpleArtifactRepositoryFactory"/>
@@ -13,9 +14,16 @@
id="org.eclipse.equinox.p2.processing.Pack200Unpacker">
<step class="org.eclipse.equinox.internal.p2.artifact.repository.Unpack200Step"/>
</extension>
+
<extension
point="org.eclipse.equinox.p2.artifact.repository.processingSteps"
id="org.eclipse.equinox.p2.processing.SignatureVerifier">
<step class="org.eclipse.equinox.internal.p2.artifact.repository.SignatureVerifier"/>
</extension>
+
+ <extension id="mirrorApplication" point="org.eclipse.core.runtime.applications">
+ <application cardinality="1" thread="main" visible="true">
+ <run class="org.eclipse.equinox.internal.p2.artifact.mirror.MirrorApplication"/>
+ </application>
+ </extension>
</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror/Mirror.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror/Mirror.java
new file mode 100644
index 000000000..b954fb99a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror/Mirror.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.artifact.mirror;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.p2.artifact.repository.*;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
+
+public class Mirror {
+ private IArtifactRepository source;
+ private IArtifactRepository destination;
+ private boolean raw;
+
+ public Mirror(IArtifactRepository source, IArtifactRepository destination, boolean raw) {
+ this.source = source;
+ this.destination = destination;
+ this.raw = raw;
+ }
+
+ public void run() {
+ if (!destination.isModifiable())
+ throw new IllegalStateException("Destination repository must be modifiable: " + destination.getLocation());
+ IArtifactKey[] keys = source.getArtifactKeys();
+ for (int i = 0; i < keys.length; i++) {
+ IArtifactKey key = keys[i];
+ IArtifactDescriptor[] descriptors = source.getArtifactDescriptors(key);
+ for (int j = 0; j < descriptors.length; j++)
+ mirror(descriptors[j]);
+ }
+ }
+
+ private void mirror(IArtifactDescriptor descriptor) {
+ IArtifactDescriptor newDescriptor = raw ? descriptor : new ArtifactDescriptor(descriptor);
+ try {
+ OutputStream repositoryStream = null;
+ try {
+ System.out.println("Mirroring: " + descriptor.getArtifactKey()); //$NON-NLS-1$
+ repositoryStream = destination.getOutputStream(newDescriptor);
+ if (repositoryStream == null)
+ return;
+ source.getArtifact(descriptor, repositoryStream, new NullProgressMonitor());
+ } finally {
+ if (repositoryStream != null)
+ repositoryStream.close();
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror/MirrorApplication.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror/MirrorApplication.java
new file mode 100644
index 000000000..eced9e191
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror/MirrorApplication.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.artifact.mirror;
+
+import java.net.URL;
+import java.util.Map;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
+import org.eclipse.equinox.p2.artifact.repository.IArtifactRepository;
+import org.eclipse.equinox.p2.artifact.repository.IArtifactRepositoryManager;
+
+public class MirrorApplication implements IApplication {
+
+ private URL sourceLocation;
+ private URL destinationLocation;
+ private IArtifactRepository source;
+ private IArtifactRepository destination;
+ private boolean append;
+ private boolean raw = false;
+
+ public Object start(IApplicationContext context) throws Exception {
+ Map args = context.getArguments();
+ initializeFromArguments((String[]) args.get("application.args"));
+ setupRepositories();
+ new Mirror(source, destination, raw).run();
+ return null;
+ }
+
+ private void setupRepositories() {
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
+ if (manager == null)
+ // TODO log here
+ return;
+
+ source = manager.loadRepository(sourceLocation, null);
+ if (destinationLocation != null)
+ destination = initializeDestination();
+ else
+ destination = source;
+ }
+
+ private IArtifactRepository initializeDestination() {
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
+ IArtifactRepository repository = manager.loadRepository(destinationLocation, null);
+ if (repository != null) {
+ if (!repository.isModifiable())
+ throw new IllegalArgumentException("Artifact repository not modifiable: " + destinationLocation); //$NON-NLS-1$
+ if (!append)
+ repository.removeAll();
+ return repository;
+ }
+
+ // the given repo location is not an existing repo so we have to create something
+ // TODO for now create a Simple repo by default.
+ String repositoryName = destinationLocation + " - artifacts"; //$NON-NLS-1$
+ return manager.createRepository(destinationLocation, repositoryName, "org.eclipse.equinox.p2.artifact.repository.simpleRepository"); //$NON-NLS-1$
+ }
+
+ public void stop() {
+ }
+
+ public void initializeFromArguments(String[] args) throws Exception {
+ if (args == null)
+ return;
+ for (int i = 0; i < args.length; i++) {
+ // check for args without parameters (i.e., a flag arg)
+ if (args[i].equals("-raw"))
+ raw = true;
+
+ // check for args with parameters. If we are at the last argument or
+ // if the next one has a '-' as the first character, then we can't have
+ // an arg with a param so continue.
+ if (i == args.length - 1 || args[i + 1].startsWith("-")) //$NON-NLS-1$
+ continue;
+ String arg = args[++i];
+
+ if (args[i - 1].equalsIgnoreCase("-source"))
+ sourceLocation = new URL(arg);
+ if (args[i - 1].equalsIgnoreCase("-destination"))
+ destinationLocation = new URL(arg);
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Unpack200Step.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Unpack200Step.java
deleted file mode 100644
index cdca4a13e..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Unpack200Step.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2007 compeople AG and others.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* compeople AG (Stefan Liebig) - initial API and implementation
-* IBM - continuing development
-*******************************************************************************/
-package org.eclipse.equinox.internal.p2.artifact.repository;
-
-import java.io.*;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
-import org.eclipse.equinox.internal.p2.jarprocessor.UnpackStep;
-import org.eclipse.equinox.p2.artifact.repository.IArtifactDescriptor;
-import org.eclipse.equinox.p2.artifact.repository.processing.ProcessingStep;
-import org.eclipse.equinox.p2.artifact.repository.processing.ProcessingStepDescriptor;
-import org.eclipse.equinox.p2.jarprocessor.JarProcessorExecutor;
-import org.eclipse.equinox.p2.jarprocessor.JarProcessorExecutor.Options;
-
-/**
- * The Pack200Unpacker expects an input containing ".jar.pack.gz" data.
- */
-public class Unpack200Step extends ProcessingStep {
- public static final String JAR_SUFFIX = ".jar"; //$NON-NLS-1$
- public static final String PACKED_SUFFIX = ".pack.gz"; //$NON-NLS-1$
- private final static String PACKED_EXT = JAR_SUFFIX + PACKED_SUFFIX;
-
- private File packed;
- private OutputStream tempStream;
-
- public void close() throws IOException {
- // When we go to close we must have seen all the content we are going to see
- // So before closing, run unpack and write the unpacked result to the destination
- performUnpack();
- super.close();
- if (status == null)
- status = Status.OK_STATUS;
- }
-
- private OutputStream getOutputStream() throws IOException {
- if (tempStream != null)
- return tempStream;
- // store input stream in temporary file
- packed = File.createTempFile("p2.pack200", PACKED_EXT);
- tempStream = new BufferedOutputStream(new FileOutputStream(packed));
- return tempStream;
- }
-
- public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
- super.initialize(descriptor, context);
- if (!UnpackStep.canUnpack())
- status = new Status(IStatus.ERROR, Activator.ID, "Unpack facility not configured");
- }
-
- private void performUnpack() throws IOException {
- BufferedInputStream unpackedStream = null;
- File unpacked = null;
- File workDir = null;
- try {
- if (tempStream == null)
- // hmmm, no one wrote to this stream so there is nothing to pass on
- return;
- // Ok, so there is content, close the tempStream
- tempStream.close();
- // now create a temporary directory for the JarProcessor to work in
- // TODO How to create a unique, temporary directory atomically?
- workDir = File.createTempFile("p2.unpack.", "");
- if (!workDir.delete())
- throw new IOException("Could not delete file for creating temporary working dir.");
- if (!workDir.mkdirs())
- throw new IOException("Could not create temporary working dir.");
-
- // unpack
- Options options = new Options();
- options.unpack = true;
- options.processAll = true;
- options.input = packed;
- options.outputDir = workDir.getPath();
- new JarProcessorExecutor().runJarProcessor(options);
-
- // now write the unpacked content to our destination
- String packedFileName = packed.getName();
- unpacked = new File(workDir, packedFileName.substring(0, packedFileName.length() - PACKED_SUFFIX.length()));
- if (unpacked.length() == 0)
- System.out.println("Empty file unpacked: " + unpacked);
- unpackedStream = new BufferedInputStream(new FileInputStream(unpacked));
- FileUtils.copyStream(unpackedStream, true, destination, false);
- } finally {
- // note that unpackedStream will be closed by copyStream()
- if (packed != null)
- packed.delete();
- if (unpacked != null)
- unpacked.delete();
- if (workDir != null)
- FileUtils.deleteAll(workDir);
- }
- }
-
- public void write(int b) throws IOException {
- OutputStream stream = getOutputStream();
- stream.write(b);
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
index 7e028371d..dde027b2c 100644
--- a/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
@@ -16,7 +16,7 @@ Import-Package: org.eclipse.core.runtime.adaptor,
org.osgi.util.tracker;version="1.3.3",
org.xml.sax
Export-Package: org.eclipse.equinox.internal.p2.core;x-internal:=true,
- org.eclipse.equinox.internal.p2.core.helpers;x-friends:="org.eclipse.equinox.p2.director,
+ org.eclipse.equinox.internal.p2.core.helpers;x-friends:="org.eclipse.equinox.p2.director,org.eclipse.equinox.p2.artifact.processors,org.eclipse.equinox.p2.artifact.optimizers,org.eclipse.equinox.p2.artifact.repository,
org.eclipse.equinox.p2.director.app,org.eclipse.equinox.p2.directorywatcher,org.eclipse.equinox.p2.download,org.eclipse.equinox.p2.engine,org.eclipse.equinox.p2.installer,org.eclipse.equinox.p2.metadata,org.eclipse.equinox.p2.metadata.generator,
org.eclipse.equinox.p2.metadata.repository,org.eclipse.equinox.p2.repositoryoptimizer,org.eclipse.equinox.p2.touchpoint.eclipse,org.eclipse.equinox.p2.touchpoint.natives,org.eclipse.equinox.p2.ui,org.eclipse.equinox.p2.ui.sdk,org.eclipse.equinox.p2.updatechecker,org.eclipse.equinox.p2.updatechecker.app,org.eclipse.equinox.p2.console",
org.eclipse.equinox.internal.p2.persistence;x-friends:="org.eclipse.equinox.p2.artifact.repository,org.eclipse.equinox.p2.engine,org.eclipse.equinox.p2.metadata.repository",
diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.jarprocessor/META-INF/MANIFEST.MF
index c68de043e..006ef3548 100644
--- a/bundles/org.eclipse.equinox.p2.jarprocessor/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.jarprocessor/META-INF/MANIFEST.MF
@@ -7,6 +7,6 @@ Bundle-Localization: plugin
Bundle-Version: 0.1.0.qualifier
Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
J2SE-1.4
-Export-Package: org.eclipse.equinox.internal.p2.jarprocessor;x-internal:=true,
+Export-Package: org.eclipse.equinox.internal.p2.jarprocessor;x-friends:="org.eclipse.equinox.p2.artifact.processors",
org.eclipse.equinox.internal.p2.jarprocessor.verifier;x-internal:=true,
org.eclipse.equinox.p2.jarprocessor
diff --git a/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF
index 19594ad40..c4034b18c 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF
@@ -5,7 +5,7 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-Version: 0.1.0.qualifier
-Export-Package: org.eclipse.equinox.internal.p2.metadata;x-friends:="org.eclipse.equinox.p2.metadata.generator, org.eclipse.equinox.p2.metadata.repository, org.eclipse.equinox.p2.engine",
+Export-Package: org.eclipse.equinox.internal.p2.metadata;x-friends:="org.eclipse.equinox.p2.metadata.generator,org.eclipse.equinox.p2.metadata.repository,org.eclipse.equinox.p2.engine,org.eclipse.equinox.p2.artifact.repository",
org.eclipse.equinox.p2.metadata,
org.eclipse.equinox.p2.query,
org.eclipse.equinox.p2.resolution
diff --git a/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF
index abdeb8d75..fbc936b44 100644
--- a/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF
@@ -6,12 +6,12 @@ Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-Version: 0.1.0.qualifier
Import-Package: junit.framework;version="3.8.2",
+ org.eclipse.equinox.internal.p2.artifact.optimizers.pack200,
+ org.eclipse.equinox.internal.p2.artifact.processor.pack200,
org.eclipse.equinox.internal.p2.artifact.repository,
org.eclipse.equinox.internal.p2.core.helpers,
org.eclipse.equinox.internal.p2.director,
- org.eclipse.equinox.internal.p2.jarprocessor,
org.eclipse.equinox.internal.p2.metadata,
- org.eclipse.equinox.internal.p2.repositoryoptimizer,
org.eclipse.equinox.p2.artifact.repository,
org.eclipse.equinox.p2.artifact.repository.processing,
org.eclipse.equinox.p2.core.location,
@@ -19,7 +19,6 @@ Import-Package: junit.framework;version="3.8.2",
org.eclipse.equinox.p2.director,
org.eclipse.equinox.p2.engine,
org.eclipse.equinox.p2.installregistry,
- org.eclipse.equinox.p2.jarprocessor,
org.eclipse.equinox.p2.metadata,
org.eclipse.equinox.p2.metadata.repository,
org.eclipse.equinox.p2.query,
@@ -30,7 +29,6 @@ Import-Package: junit.framework;version="3.8.2",
org.eclipse.osgi.service.environment;version="1.0.0",
org.eclipse.osgi.service.resolver;version="1.1.0",
org.eclipse.osgi.service.urlconversion;version="1.0.0",
- org.eclipse.osgi.util;version="1.1.0",
org.osgi.framework;version="1.3.0",
org.osgi.service.packageadmin;version="1.2.0",
org.osgi.util.tracker;version="1.3.3"
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/optimizer/PackRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/optimizer/PackRepositoryTest.java
index 3004dac2a..e8f2337fc 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/optimizer/PackRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/optimizer/PackRepositoryTest.java
@@ -4,9 +4,9 @@ import java.io.*;
import java.net.URL;
import junit.framework.TestCase;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.p2.artifact.optimizers.pack200.Optimizer;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
-import org.eclipse.equinox.internal.p2.repositoryoptimizer.Optimizer;
import org.eclipse.equinox.p2.artifact.repository.*;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.tests.TestActivator;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java
index b1cd8ae50..37f05f06a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java
@@ -15,7 +15,7 @@ import java.io.*;
import java.util.Arrays;
import junit.framework.TestCase;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.artifact.repository.Unpack200Step;
+import org.eclipse.equinox.internal.p2.artifact.processor.pack200.Unpack200Step;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.p2.artifact.repository.processing.*;
import org.eclipse.equinox.p2.tests.TestActivator;

Back to the top