CQ-4081: Initial import
diff --git a/bundles/org.eclipse.e4.core.deeplink.launchproxy/.classpath b/bundles/org.eclipse.e4.core.deeplink.launchproxy/.classpath
new file mode 100644
index 0000000..8a8f166
--- /dev/null
+++ b/bundles/org.eclipse.e4.core.deeplink.launchproxy/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.e4.core.deeplink.launchproxy/.project b/bundles/org.eclipse.e4.core.deeplink.launchproxy/.project
new file mode 100644
index 0000000..8298f90
--- /dev/null
+++ b/bundles/org.eclipse.e4.core.deeplink.launchproxy/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.e4.core.deeplink.launchproxy</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.e4.core.deeplink.launchproxy/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.core.deeplink.launchproxy/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..d0932ff
--- /dev/null
+++ b/bundles/org.eclipse.e4.core.deeplink.launchproxy/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Mon Jan 11 16:07:00 CST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/bundles/org.eclipse.e4.core.deeplink.launchproxy/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.core.deeplink.launchproxy/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..2d13029
--- /dev/null
+++ b/bundles/org.eclipse.e4.core.deeplink.launchproxy/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Launchproxy Plug-in
+Bundle-SymbolicName: org.eclipse.e4.core.deeplink.launchproxy;singleton:=true
+Bundle-Version: 4.6.0.qualifier
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.e4.core.deeplink;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Activator: org.eclipse.e4.core.deeplink.launchproxy.Activator
diff --git a/bundles/org.eclipse.e4.core.deeplink.launchproxy/about.html b/bundles/org.eclipse.e4.core.deeplink.launchproxy/about.html
new file mode 100644
index 0000000..f77f378
--- /dev/null
+++ b/bundles/org.eclipse.e4.core.deeplink.launchproxy/about.html
@@ -0,0 +1,22 @@
+<h1>About This Content</h1>
+
+23 June, 2010
+
+<h2>License</h2>
+
+<p>The Eclipse Foundation makes available all content in this plug-in
+("Content"). Unless otherwise indicated below, the Content is provided
+to you under the terms and conditions of the Eclipse Public License
+Version 1.0 ("EPL"). A copy of the EPL is available at
+http://www.eclipse.org/legal/epl-v10.html. For purposes of the EPL,
+"Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse
+Foundation, the Content is being redistributed by another party
+("Redistributor") and different terms and conditions may apply to your
+use of any object code in the Content. Check the Redistributor’s
+license that was provided with the Content. If no such license exists,
+contact the Redistributor. Unless otherwise indicated below, the terms
+and conditions of the EPL still apply to any source code in the
+Content and such source code may be obtained at
+http://www.eclipse.org.</p>
diff --git a/bundles/org.eclipse.e4.core.deeplink.launchproxy/build.properties b/bundles/org.eclipse.e4.core.deeplink.launchproxy/build.properties
new file mode 100644
index 0000000..78d73f7
--- /dev/null
+++ b/bundles/org.eclipse.e4.core.deeplink.launchproxy/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .
diff --git a/bundles/org.eclipse.e4.core.deeplink.launchproxy/plugin.xml b/bundles/org.eclipse.e4.core.deeplink.launchproxy/plugin.xml
new file mode 100644
index 0000000..25ab1e9
--- /dev/null
+++ b/bundles/org.eclipse.e4.core.deeplink.launchproxy/plugin.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ id="application"
+ point="org.eclipse.core.runtime.applications">
+ <application>
+ <run
+ class="org.eclipse.e4.core.deeplink.launchproxy.Application">
+ </run>
+ </application>
+ </extension>
+ <extension
+ id="product"
+ point="org.eclipse.core.runtime.products">
+ <product
+ application="org.eclipse.e4.core.deeplink.launchproxy.application"
+ description="DeepLink application launcher proxy and URL handler"
+ name="Launch Proxy">
+ <property
+ name="appName"
+ value="Launch Proxy">
+ </property>
+ </product>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.e4.core.deeplink.launchproxy/src/org/eclipse/e4/core/deeplink/launchproxy/Activator.java b/bundles/org.eclipse.e4.core.deeplink.launchproxy/src/org/eclipse/e4/core/deeplink/launchproxy/Activator.java
new file mode 100644
index 0000000..796f036
--- /dev/null
+++ b/bundles/org.eclipse.e4.core.deeplink.launchproxy/src/org/eclipse/e4/core/deeplink/launchproxy/Activator.java
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * Copyright (c) David Orme 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:
+ * David Orme - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.e4.core.deeplink.launchproxy;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends Plugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.e4.enterprise.deeplink.launchproxy";
+
+ private static Activator bundle = null;
+
+ public static Activator getDefault() {
+ return bundle;
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ bundle = this;
+ }
+
+}
diff --git a/bundles/org.eclipse.e4.core.deeplink.launchproxy/src/org/eclipse/e4/core/deeplink/launchproxy/Application.java b/bundles/org.eclipse.e4.core.deeplink.launchproxy/src/org/eclipse/e4/core/deeplink/launchproxy/Application.java
new file mode 100644
index 0000000..7daa5ff
--- /dev/null
+++ b/bundles/org.eclipse.e4.core.deeplink.launchproxy/src/org/eclipse/e4/core/deeplink/launchproxy/Application.java
@@ -0,0 +1,148 @@
+/******************************************************************************
+ * Copyright (c) David Orme 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:
+ * David Orme - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.e4.core.deeplink.launchproxy;
+
+import java.util.Date;
+
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.core.runtime.ILogListener;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.core.deeplink.DeepLinkManager;
+import org.eclipse.e4.core.deeplink.DeepLinkResult;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.osgi.framework.Bundle;
+
+
+/**
+ * This class controls all aspects of the application's execution
+ */
+public class Application implements IApplication {
+
+ private final String COMMANDLINE_KEY = "application.args";
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
+ */
+ public Object start(IApplicationContext context) throws Exception {
+ String[] args = (String[]) context.getArguments().get(COMMANDLINE_KEY);
+ ILog systemLog = Platform.getLog(Platform.getBundle(Activator.PLUGIN_ID));
+ DeepLinkManager installationManager = new DeepLinkManager(false, new TeeLogger(systemLog));
+ try {
+ DeepLinkResult result = installationManager.processDeepLink(getDeepLinkURL(args, stubLogger));
+ for (Object key : result.outputData.keySet()) {
+ Object value = result.outputData.get(key);
+ System.out.println(key + " ==> " + value);
+ }
+ } catch (Exception e) {
+ stubLogger.log(new Status(Status.ERROR, Activator.PLUGIN_ID, "Unhandled exception: " + e.getMessage(), e));
+ }
+ return IApplication.EXIT_OK;
+ }
+
+ private static String getDeepLinkURL(String[] args, ILog logger) {
+ if (args.length != 1) {
+ logger.log(new Status(Status.ERROR, Activator.PLUGIN_ID, "Wrong number of arguments: " + args.length));
+ throw new IllegalArgumentException("Wrong number of arguments: " + args.length);
+ }
+ return args[0];
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.app.IApplication#stop()
+ */
+ public void stop() {
+ // nothing to do
+ }
+
+ private class TeeLogger implements ILog {
+ private ILog delegate;
+
+ public TeeLogger(ILog delegate) {
+ this.delegate = delegate;
+ }
+
+ public void addLogListener(ILogListener listener) {
+ delegate.addLogListener(listener);
+ }
+
+ public Bundle getBundle() {
+ return delegate.getBundle();
+ }
+
+ public void log(IStatus status) {
+ /*
+ * 2010-02-25
+ *
+ * FIXME: Eclipse creates a separate 12345.log file in the configuration
+ * directory PER-INVOCATION. So we only delegate to the Eclipse logger
+ * if there is an error to log, and not otherwise.
+ *
+ * Ideally, we would figure out how to make Eclipse log to a single .log
+ * file like it does with the Workbench up and running.
+ */
+ if (Status.ERROR == status.getSeverity()) {
+ delegate.log(status);
+ System.err.println(new Date() + ": " + status.toString());
+ Throwable e = status.getException();
+ if (e != null) {
+ e.printStackTrace(System.err);
+ }
+ } else {
+ System.out.println(new Date() + ": " + status.toString());
+ }
+ System.err.flush();
+ System.out.flush();
+ }
+
+ public void removeLogListener(ILogListener listener) {
+ delegate.removeLogListener(listener);
+ }
+ }
+
+ // Command-line version ----------------------------------------------------
+
+ static ILog stubLogger = new ILog() {
+ public void addLogListener(ILogListener listener) {
+ }
+
+ public Bundle getBundle() {
+ // No bundle as we're not in an OSGI container
+ return null;
+ }
+
+ public void log(IStatus status) {
+ // TODO: If using command-line version, put your own custom (proper) logging here
+ if (Status.ERROR == status.getSeverity()) {
+ System.err.println(new Date() + ": " + status.toString());
+ Throwable e = status.getException();
+ if (e != null) {
+ e.printStackTrace(System.err);
+ }
+ } else {
+ System.out.println(new Date() + ": " + status.toString());
+ }
+ System.err.flush();
+ System.out.flush();
+ }
+
+ public void removeLogListener(ILogListener listener) {
+ }
+ };
+
+ public static void main(String[] args) {
+ DeepLinkManager installationManager = new DeepLinkManager(false, stubLogger);
+ installationManager.processDeepLink(getDeepLinkURL(args, stubLogger));
+ }
+
+}