[471625] New Server Wizard should show additional server adapters in
place instead of a secondary wizard
diff --git a/features/org.eclipse.wst.server_adapters.sdk.feature/feature.xml b/features/org.eclipse.wst.server_adapters.sdk.feature/feature.xml
index 2907c4d..3306e7d 100644
--- a/features/org.eclipse.wst.server_adapters.sdk.feature/feature.xml
+++ b/features/org.eclipse.wst.server_adapters.sdk.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.wst.server_adapters.sdk.feature"
label="%featureName"
- version="3.2.400.qualifier"
+ version="3.2.500.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="1.0.1.qualifier">
diff --git a/features/org.eclipse.wst.server_adapters.sdk.feature/pom.xml b/features/org.eclipse.wst.server_adapters.sdk.feature/pom.xml
index 8dad883..5f9e2c7 100644
--- a/features/org.eclipse.wst.server_adapters.sdk.feature/pom.xml
+++ b/features/org.eclipse.wst.server_adapters.sdk.feature/pom.xml
@@ -22,6 +22,6 @@
<groupId>org.eclipse.webtools.servertools</groupId>
<artifactId>org.eclipse.wst.server_adapters.sdk.feature</artifactId>
- <version>3.2.400-SNAPSHOT</version>
+ <version>3.2.500-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/features/org.eclipse.wst.server_core.feature/feature.xml b/features/org.eclipse.wst.server_core.feature/feature.xml
index b0c8063..5be40b7 100644
--- a/features/org.eclipse.wst.server_core.feature/feature.xml
+++ b/features/org.eclipse.wst.server_core.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.wst.server_core.feature"
label="%featureName"
- version="3.3.500.qualifier"
+ version="3.3.600.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="1.0.1.qualifier">
diff --git a/features/org.eclipse.wst.server_core.feature/pom.xml b/features/org.eclipse.wst.server_core.feature/pom.xml
index a2dfc0e..89bad6d 100644
--- a/features/org.eclipse.wst.server_core.feature/pom.xml
+++ b/features/org.eclipse.wst.server_core.feature/pom.xml
@@ -22,7 +22,7 @@
<groupId>org.eclipse.webtools.servertools</groupId>
<artifactId>org.eclipse.wst.server_core.feature</artifactId>
- <version>3.3.500-SNAPSHOT</version>
+ <version>3.3.600-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<build>
diff --git a/features/org.eclipse.wst.server_ui.feature/feature.xml b/features/org.eclipse.wst.server_ui.feature/feature.xml
index 8f50fc7..c3bc7d0 100644
--- a/features/org.eclipse.wst.server_ui.feature/feature.xml
+++ b/features/org.eclipse.wst.server_ui.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.wst.server_ui.feature"
label="%featureName"
- version="3.3.500.qualifier"
+ version="3.3.600.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="1.0.1.qualifier">
diff --git a/features/org.eclipse.wst.server_ui.feature/pom.xml b/features/org.eclipse.wst.server_ui.feature/pom.xml
index 3e73fd2..4eac273 100644
--- a/features/org.eclipse.wst.server_ui.feature/pom.xml
+++ b/features/org.eclipse.wst.server_ui.feature/pom.xml
@@ -22,7 +22,7 @@
<groupId>org.eclipse.webtools.servertools</groupId>
<artifactId>org.eclipse.wst.server_ui.feature</artifactId>
- <version>3.3.500-SNAPSHOT</version>
+ <version>3.3.600-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<build>
diff --git a/plugins/org.eclipse.wst.server.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.server.core/META-INF/MANIFEST.MF
index ec9c22b..18955a8 100644
--- a/plugins/org.eclipse.wst.server.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.server.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.server.core; singleton:=true
-Bundle-Version: 1.6.101.qualifier
+Bundle-Version: 1.7.0.qualifier
Bundle-Activator: org.eclipse.wst.server.core.internal.ServerPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -18,6 +18,7 @@
org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)",
org.eclipse.update.core;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
org.eclipse.wst.common.project.facet.core;bundle-version="[1.1.0,2.0.0)";resolution:=optional,
- org.eclipse.wst.common.core;bundle-version="[1.2.0,2.0.0)"
+ org.eclipse.wst.common.core;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.wst.server.discovery;bundle-version="[1.0.0,2.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.wst.server.core/pom.xml b/plugins/org.eclipse.wst.server.core/pom.xml
index a69b5a2..e6e6ce9 100644
--- a/plugins/org.eclipse.wst.server.core/pom.xml
+++ b/plugins/org.eclipse.wst.server.core/pom.xml
@@ -22,6 +22,6 @@
<groupId>org.eclipse.webtools.servertools</groupId>
<artifactId>org.eclipse.wst.server.core</artifactId>
- <version>1.6.101-SNAPSHOT</version>
+ <version>1.7.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerCore.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerCore.java
index 1747637..fbbe050 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerCore.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerCore.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -16,6 +16,8 @@
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.runtime.*;
import org.eclipse.wst.server.core.internal.*;
+import org.eclipse.wst.server.discovery.Discovery;
+import org.eclipse.wst.server.discovery.ServerProxy;
/**
* Main class for server core API.
* <p>
@@ -39,6 +41,7 @@
// cached copy of all server and configuration types
private static List<IServerType> serverTypes;
+ private static List<IServerType> DAServerTypes;
private static IRegistryChangeListener registryListener;
@@ -152,6 +155,34 @@
serverTypes.toArray(st);
return st;
}
+
+ /**
+ * @since 1.7
+ */
+ public static IServerType[] getDownloadableServers(IProgressMonitor monitor){
+ if (DAServerTypes == null || DAServerTypes.isEmpty())
+ loadDAServerTypes(monitor);
+ IServerType[] servers2 = new IServerType[DAServerTypes.size()];
+ DAServerTypes.toArray(servers2);
+
+ return servers2;
+ }
+
+ /**
+ * @since 1.7
+ */
+ public static void resetDownloadableServers(){
+ DAServerTypes = null;
+ }
+
+ /**
+ * @since 1.7
+ */
+ public static boolean isDownloadableServerLoaded(){
+ if (DAServerTypes != null && !DAServerTypes.isEmpty())
+ return true;
+ return false;
+ }
/**
* Returns the server type with the given id, or <code>null</code>
@@ -242,7 +273,26 @@
Trace.trace(Trace.STRING_EXTENSION_POINT, "-<- Done loading .serverTypes extension point -<-");
}
}
+
+ /**
+ * Load the server types.
+ */
+ private static synchronized void loadDAServerTypes(IProgressMonitor monitor) {
+ DAServerTypes = new ArrayList<IServerType>();
+
+ // fetch from site and add
+ DAServerTypes.addAll(createProxyServers(monitor));
+
+ }
+ private static List<ServerTypeProxy> createProxyServers(IProgressMonitor monitor){
+ List<ServerProxy> serverProxyList = Discovery.getExtensionsWithServer(monitor);
+ List<ServerTypeProxy> serverTypeProxyList = new ArrayList<ServerTypeProxy>();
+ for (Iterator iterator = serverProxyList.iterator(); iterator.hasNext();) {
+ serverTypeProxyList.add(new ServerTypeProxy((ServerProxy) iterator.next()));
+ }
+ return serverTypeProxyList;
+ }
/**
* Load the server types.
*/
@@ -315,6 +365,7 @@
public static IServer[] getServers() {
return getResourceManager().getServers();
}
+
/**
* Adds a new runtime lifecycle listener.
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/TaskModel.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/TaskModel.java
index 2b7504e..d37df20 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/TaskModel.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/TaskModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -66,7 +66,16 @@
* @see #putObject(String, Object)
*/
public static final String TASK_LAUNCH_MODE = "launch-mode";
-
+
+ /**
+ * Task model id for downloadable server adapter extension.
+ *
+ * @see #getObject(String)
+ * @see #putObject(String, Object)
+ * @since 1.7
+ */
+ public static final String TASK_EXTENSION = "extension";
+
private Map<String, Object> map = new HashMap<String, Object>();
/**
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeProxy.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeProxy.java
new file mode 100644
index 0000000..4c00241
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeProxy.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2011 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.wst.server.core.internal;
+
+/**
+ *
+ */
+public class RuntimeProxy extends Runtime {
+
+ public RuntimeProxy(RuntimeTypeProxy runtimeTypeProxy) {
+ super(null, runtimeTypeProxy.getId(), runtimeTypeProxy);
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeTypeProxy.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeTypeProxy.java
new file mode 100644
index 0000000..d659d90
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeTypeProxy.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.wst.server.core.internal;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.server.core.IModuleType;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.discovery.RuntimeProxy;
+/**
+ * @since 1.7
+ *
+ */
+public class RuntimeTypeProxy implements IRuntimeType {
+ private String runtimTypeId;
+ private String name;
+ private String vendor;
+ private String description;
+
+ public RuntimeTypeProxy(String id, String name, String description, String vendor) {
+ super();
+ this.runtimTypeId = id;
+ this.name = name;
+ this.description = description;
+ this.vendor = vendor;
+ }
+ public RuntimeTypeProxy(RuntimeProxy runtimeProxy) {
+ super();
+ this.runtimTypeId = runtimeProxy.getId();
+ this.name = runtimeProxy.getName();
+ this.description = runtimeProxy.getDescription();
+ this.vendor = runtimeProxy.getVendor();
+ }
+
+ /**
+ *
+ * @return the id
+ */
+ public String getId() {
+ return runtimTypeId;
+ }
+
+ /**
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ public String getVendor() {
+ return vendor;
+ }
+
+ public String getVersion() {
+ return "";
+ }
+
+ /**
+ * Return the supported module types.
+ *
+ * @return an array of module types
+ */
+ public IModuleType[] getModuleTypes() {
+ return null;
+ }
+
+ public boolean canCreate() {
+ return false;
+ }
+
+ public IRuntimeWorkingCopy createRuntime(String id, IProgressMonitor monitor) {
+ return null;
+ }
+
+ public String toString() {
+ return "RuntimeType[" + getId() + ", " + getName() + "]";
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java
index 9dd2a33..3be9b4b 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java
@@ -429,13 +429,16 @@
this.serverType = serverType;
map.put("server-type-id", serverType.getId());
map.put(PROP_HOSTNAME, "localhost");
- map.put(PROP_START_TIMEOUT, ((ServerType)serverType).getStartTimeout()/1000 + "");
- map.put(PROP_STOP_TIMEOUT, ((ServerType)serverType).getStopTimeout()/1000 + "");
+ if (serverType instanceof ServerType){
+ map.put(PROP_START_TIMEOUT, ((ServerType)serverType).getStartTimeout()/1000 + "");
+ map.put(PROP_STOP_TIMEOUT, ((ServerType)serverType).getStopTimeout()/1000 + "");
+ serverState = ((ServerType)serverType).getInitialState();
+ }
if (runtime != null && runtime.getRuntimeType() != null) {
String name = runtime.getRuntimeType().getName();
map.put(PROP_NAME, name);
}
- serverState = ((ServerType)serverType).getInitialState();
+
}
public IServerType getServerType() {
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerTypeProxy.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerTypeProxy.java
new file mode 100644
index 0000000..4f3af52
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerTypeProxy.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.wst.server.core.internal;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.server.core.*;
+import org.eclipse.wst.server.discovery.ServerProxy;
+/**
+ * @since 1.7
+ *
+ */
+public class ServerTypeProxy implements IServerType{
+ private String serverId;
+ private String serverName;
+ private String serverDescription;
+ private IRuntimeType runtimeType;
+ private String extension;
+ private String uri;
+ private String proxyServerId;
+
+
+ /**
+ * ServerType constructor comment.
+ *
+ * @param element a configuration element
+ */
+ public ServerTypeProxy(String id, String name, String description, String hostName, IRuntimeType runtimeType) {
+ super();
+ this.serverId = id;
+ this.serverName = name;
+ this.serverDescription = description;
+ this.runtimeType = runtimeType;
+ }
+ public ServerTypeProxy(ServerProxy serverProxy) {
+ super();
+ this.serverId = serverProxy.getId();
+ this.serverName = serverProxy.getName();
+ this.serverDescription = serverProxy.getDescription();
+ this.runtimeType = new RuntimeTypeProxy(serverProxy.getRuntimeType());
+ this.extension = serverProxy.getExtension();
+ this.uri = serverProxy.getURI();
+ this.proxyServerId = serverProxy.getProxyServerId();
+
+ }
+
+ /**
+ * Returns the id of this factory.
+ *
+ * @return java.lang.String
+ */
+ public String getId() {
+ return serverId;
+ }
+
+ public String getName() {
+ return serverName;
+ }
+
+ public String getDescription() {
+ return serverDescription;
+ }
+
+ public IRuntimeType getRuntimeType() {
+ return runtimeType;
+ }
+
+ public boolean hasRuntime() {
+ return false;
+ }
+
+ public void dispose() {
+ runtimeType = null;
+ }
+
+ public String getExtension(){
+ return extension;
+ }
+ /**
+ * Return a string representation of this object.
+ *
+ * @return java.lang.String
+ */
+ public String toString() {
+ return "ServerType[" + getId() + "]";
+ }
+
+ public boolean supportsLaunchMode(String launchMode) {
+ return false;
+ }
+
+ public boolean hasServerConfiguration() {
+ return false;
+ }
+
+ public boolean supportsRemoteHosts() {
+ return true;
+ }
+
+ public IServerWorkingCopy createServer(String id, IFile file, IRuntime runtime, IProgressMonitor monitor)
+ throws CoreException {
+ return null;
+ }
+
+ public IServerWorkingCopy createServer(String id, IFile file, IProgressMonitor monitor) throws CoreException {
+ return null;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public String getProxyServerId() {
+ return proxyServerId;
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java
index 77d8a4d..92358d7 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -55,7 +55,8 @@
super(id, file, runtime, serverType);
wch = new WorkingCopyHelper(this);
wch.setDirty(true);
- serverState = ((ServerType)serverType).getInitialState();
+ if (serverType instanceof ServerType)
+ serverState = ((ServerType)serverType).getInitialState();
}
public boolean isWorkingCopy() {
diff --git a/plugins/org.eclipse.wst.server.discovery/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.server.discovery/META-INF/MANIFEST.MF
index 19cb572..0a76940 100644
--- a/plugins/org.eclipse.wst.server.discovery/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.server.discovery/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: %bundleName
Bundle-Vendor: %bundleVendor
Bundle-SymbolicName: org.eclipse.wst.server.discovery;singleton:=true
-Bundle-Version: 1.0.701.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Activator: org.eclipse.wst.server.discovery.internal.Activator
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0)",
org.eclipse.ui;bundle-version="[3.5.0,4.0)",
@@ -14,7 +14,8 @@
org.eclipse.equinox.p2.ui;bundle-version="[2.0.0,3.0)",
org.eclipse.equinox.p2.repository;bundle-version="[2.0.0,3.0.0)",
org.eclipse.equinox.p2.core;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.equinox.p2.operations;bundle-version="[2.0.0,3.0.0)"
+ org.eclipse.equinox.p2.operations;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.core.variables;bundle-version="[3.2.0,4.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.wst.server.discovery,
diff --git a/plugins/org.eclipse.wst.server.discovery/build.properties b/plugins/org.eclipse.wst.server.discovery/build.properties
index 56eabe9..7a547df 100644
--- a/plugins/org.eclipse.wst.server.discovery/build.properties
+++ b/plugins/org.eclipse.wst.server.discovery/build.properties
@@ -3,6 +3,7 @@
bin.includes = META-INF/,\
.,\
serverAdapterSites.xml,\
+ serverAdapterSitesDetails.xml,\
discovery.xsd,\
icons/,\
.options,\
diff --git a/plugins/org.eclipse.wst.server.discovery/pom.xml b/plugins/org.eclipse.wst.server.discovery/pom.xml
index 1986b01..cbdf6ae 100644
--- a/plugins/org.eclipse.wst.server.discovery/pom.xml
+++ b/plugins/org.eclipse.wst.server.discovery/pom.xml
@@ -22,6 +22,6 @@
<groupId>org.eclipse.webtools.servertools</groupId>
<artifactId>org.eclipse.wst.server.discovery</artifactId>
- <version>1.0.701-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.wst.server.discovery/serverAdapterSitesDetails.xml b/plugins/org.eclipse.wst.server.discovery/serverAdapterSitesDetails.xml
new file mode 100644
index 0000000..847d9c1
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.discovery/serverAdapterSitesDetails.xml
@@ -0,0 +1,98 @@
+<extensionDetails>
+ <feature
+ uri="http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/updates/bluemixAdapter/mars/"
+ id="com.ibm.cftools.wtp.serveradapter.feature.feature.group" name="IBM Bluemix Tools Server Adapter"
+ description="Cloud Tools for IBM Bluemix" provider="IBM"
+ version="1.0.0.v20150801_1001" serverId="com.ibm.cftools.server"/>
+ <feature
+ uri="http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/updates/libertyAdapter/mars/"
+ id="com.ibm.ws.st.tools.base.feature.group"
+ name="WebSphere Application Server Liberty Profile Tools"
+ description="Tools for developing and administering WebSphere Application Server Liberty Profile"
+ provider="IBM" version="1.0.400.v20150617_2241" serverId="com.ibm.ws.st.server.wlp">
+ </feature>
+ <feature
+ uri="http://www.apache.org/dist/geronimo/eclipse/updates/"
+ id="org.apache.geronimo.v10.feature.feature.group" name="Geronimo v1.0 Server Adapter"
+ description="This feature provides the WTP Server Adapter and additional development tools for Apache Geronimo."
+ provider="Apache" version="2.0.0">
+ </feature>
+ <feature
+ uri="http://www.apache.org/dist/geronimo/eclipse/updates/"
+ id="org.apache.geronimo.v22.feature.feature.group" name="Geronimo v2.2 Server Adapter"
+ description="This feature provides the WTP Server Adapters and additional development tools for the Apache Geronimo v2.0, v2.1 and v2.2 servers."
+ provider="Apache" version="2.2.1">
+ </feature>
+ <feature
+ uri="http://www.apache.org/dist/geronimo/eclipse/updates/"
+ id="org.apache.geronimo.feature.feature.group" name="Geronimo Core Feature"
+ description="This feature provides core support required for the WTP Server Adapter for specific versions of the Apache Geronimo server."
+ provider="Apache" version="2.1.1">
+ </feature>
+ <feature
+ uri="http://www.apache.org/dist/geronimo/eclipse/updates/"
+ id="org.apache.geronimo.v30.feature.feature.group" name="Geronimo v3.0 Server Adapter"
+ description="This feature provides the WTP Server Adapters and additional development tools for the Apache Geronimo v1.1, v2.0, v2.1, v2.2, and v3.0 servers."
+ provider="Apache" version="3.0.1">
+ </feature>
+ <feature
+ uri="http://www.apache.org/dist/geronimo/eclipse/updates/"
+ id="org.apache.geronimo.v11.feature.feature.group" name="Geronimo v1.1.x Server Adapter"
+ description="This feature provides the WTP Server Adapter and additional development tools for Apache Geronimo."
+ provider="Apache" version="2.0.0">
+ </feature>
+ <feature
+ uri="http://www.apache.org/dist/geronimo/eclipse/updates/"
+ id="org.apache.geronimo.v21.feature.feature.group" name="Geronimo v2.1 Server Adapter"
+ description="This feature provides the WTP Server Adapters and additional development tools for the Apache Geronimo v2.0 and v2.1 servers."
+ provider="Apache" version="2.1.8">
+ </feature>
+ <feature
+ uri="http://www.apache.org/dist/geronimo/eclipse/updates/"
+ id="org.apache.geronimo.v20.feature.feature.group" name="Geronimo v2.0 Server Adapter"
+ description="This feature provides the WTP Server Adapter and additional development tools for the Apache Geronimo v2.0 server."
+ provider="Apache" version="2.1.2">
+ </feature>
+ <feature
+ uri="http://master.dl.sourceforge.net/project/sapnweclipse/updates/"
+ id="com.sap.netweaver.porta.ide.eclipse.feature.feature.group" name="SAP NetWeaver Server Adapter"
+ description="Server adapter for the SAP NetWeaver Application Server. Supports J2EE 1.4 and Java EE 5 modules."
+ provider="SAP" version="0.7.2.201006211643">
+ </feature>
+ <feature
+ uri="http://jope.ow2.org/update/jope/"
+ id="org.ow2.jonas.wtp.adapter.feature.group" name="Jonas WTP Adapter"
+ description="JOPE (JOnAS Plugin for Eclipse) is an open source JOnAS plugin for Eclipse."
+ provider="OW2" version="5.1.2">
+ </feature>
+ <feature
+ uri="http://www.caucho.com/eclipse/"
+ id="com.caucho.resin.eclipse.feature.group" name="Resin (Java EE Web Profile) Server"
+ description="Resin Eclipse Plugin based on WebTools Generic Server."
+ provider="Resin" version="4.0.27">
+ </feature>
+ <feature
+ uri="http://download.jboss.org/jbosstools/updates/webtools/mars/"
+ id="org.jboss.ide.eclipse.as.feature.feature.group" name="JBoss AS, WildFly, & EAP Server Tools"
+ description="Provides WTP server adapters for JBoss installations. These adapters are capable of deployment and providing classpaths for projects. Zipped or exploded deployments, JMX integration, and other extensions are included."
+ provider="Red Hat JBoss Middleware" version="3.1.0.Beta2-v20150723-0026-B29">
+ </feature>
+ <feature
+ uri="http://download.oracle.com/otn_software/oepe/mars/"
+ id="oracle.eclipse.tools.cloud.feature.group" name="Oracle Cloud Tools"
+ description="Additional tools for developing Oracle Cloud applications."
+ provider="Oracle" version="8.2.0.201507100122">
+ </feature>
+ <feature
+ uri="http://download.oracle.com/otn_software/oepe/mars/"
+ id="oracle.eclipse.tools.weblogic.feature.group" name="Oracle WebLogic Server Tools"
+ description="Tools for developing applications for Oracle WebLogic Server (versions 12.1.x, 10.3.x, 10.0 and 9.2)."
+ provider="Oracle" version="8.2.0.201507100122">
+ </feature>
+ <feature
+ uri="http://download.oracle.com/otn_software/oepe/mars/"
+ id="oracle.eclipse.tools.glassfish.feature.group" name="GlassFish Tools"
+ description="Tools for developing applications for GlassFish."
+ provider="Oracle" version="8.2.0.201507100122">
+ </feature>
+</extensionDetails>
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/Discovery.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/Discovery.java
index 125b74d..1d8d5a2 100644
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/Discovery.java
+++ b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/Discovery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 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
@@ -10,9 +10,13 @@
*******************************************************************************/
package org.eclipse.wst.server.discovery;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.wst.server.discovery.internal.ExtensionUtility;
public class Discovery {
public static boolean launchExtensionWizard(Shell shell, String title, String message) {
@@ -22,4 +26,42 @@
return true;
return false;
}
+
+
+ /**
+ * @since 1.1
+ */
+ public static List<ServerProxy> getExtensionsWithServer(IProgressMonitor monitor){
+ return ExtensionUtility.getExtensionsWithServer(monitor);
+
+ }
+
+ /**
+ * @since 1.1
+ */
+ public static String getLicenseText(String extensionId){
+ return ExtensionUtility.getLicenseText(extensionId);
+
+ }
+
+ /**
+ * @since 1.1
+ */
+ public static void installExtension(String extensionId){
+ ExtensionUtility.installExtension(extensionId);
+ }
+
+ /**
+ * @since 1.1
+ */
+ public static ErrorMessage refreshExtension(String extensionId, String uri, IProgressMonitor monitor){
+ return ExtensionUtility.refreshExtension(extensionId,uri, monitor);
+ }
+
+ /**
+ * @since 1.1
+ */
+ public static void refreshServerAdapters(IProgressMonitor monitor) {
+ ExtensionUtility.refreshServerAdapters(monitor);
+ }
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/ErrorMessage.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/ErrorMessage.java
new file mode 100644
index 0000000..49ef98b
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/ErrorMessage.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.wst.server.discovery;
+
+/**
+ * @since 1.1
+ */
+public class ErrorMessage {
+
+ private String errorTitle;
+ private String errorDescription;
+ public ErrorMessage(String errorTitle, String errorDescription) {
+ super();
+ this.errorTitle = errorTitle;
+ this.errorDescription = errorDescription;
+ }
+ public String getErrorTitle() {
+ return errorTitle;
+ }
+
+ public String getErrorDescription() {
+ return errorDescription;
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/ExtensionWizard.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/ExtensionWizard.java
index ed9cb12..5ce64bb 100644
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/ExtensionWizard.java
+++ b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/ExtensionWizard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 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
@@ -23,6 +23,7 @@
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.server.discovery.internal.ExtensionUtility;
import org.eclipse.wst.server.discovery.internal.ImageResource;
import org.eclipse.wst.server.discovery.internal.Messages;
import org.eclipse.wst.server.discovery.internal.model.Extension;
@@ -119,19 +120,6 @@
if (!b[0])
return true;
- String name = NLS.bind(Messages.installJobName, extension.getName());
- Job job = new Job(name) {
- public IStatus run(IProgressMonitor monitor) {
- return extension.install(monitor);
- }
- };
-
- // Request a restart when the installation is completed (bugzilla# 314823)
- ProvisioningOperationRunner por = new ProvisioningOperationRunner(ProvisioningUI.getDefaultUI());
- por.manageJob(job, ProvisioningJob.RESTART_OR_APPLY);
-
- job.setUser(true);
- job.schedule();
- return true;
+ return ExtensionUtility.installExtension(extension);
}
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/RuntimeProxy.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/RuntimeProxy.java
new file mode 100644
index 0000000..0d03072
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/RuntimeProxy.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.wst.server.discovery;
+
+/**
+ * @since 1.1
+ *
+ */
+public class RuntimeProxy {
+ private String runtimTypeId;
+ private String name;
+ private String vendor;
+ private String description;
+
+ public RuntimeProxy(String id, String name, String description, String vendor) {
+ super();
+ this.runtimTypeId = id;
+ this.name = name;
+ this.description = description;
+ this.vendor = vendor;
+ }
+
+ /**
+ *
+ * @return the id
+ */
+ public String getId() {
+ return runtimTypeId;
+ }
+
+ /**
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ public String getVendor() {
+ return vendor;
+ }
+
+ public String getVersion() {
+ return null;
+ }
+
+ public String toString() {
+ return "RuntimeType[" + getId() + ", " + getName() + "]";
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/ServerProxy.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/ServerProxy.java
new file mode 100644
index 0000000..e34bb8e
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/ServerProxy.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.wst.server.discovery;
+
+/**
+ * @since 1.1
+ *
+ */
+public class ServerProxy {
+ private String serverId;
+ private String serverName;
+ private String serverDescription;
+ private RuntimeProxy runtimeType;
+ private String extension;
+ private String uri;
+ private String proxyServerId;
+
+ /**
+ * ServerType constructor comment.
+ *
+ * @param element a configuration element
+ */
+ public ServerProxy(String id, String name, String description, RuntimeProxy runtimeType, String extension, String uri, String proxyServerId) {
+ super();
+ this.serverId = id;
+ this.serverName = name;
+ this.serverDescription = description;
+ this.runtimeType = runtimeType;
+ this.extension = extension;
+ this.uri = uri;
+ this.proxyServerId = proxyServerId;
+ }
+
+ /**
+ * Returns the id of this factory.
+ *
+ * @return java.lang.String
+ */
+ public String getId() {
+ return serverId;
+ }
+
+ public String getName() {
+ return serverName;
+ }
+
+ public boolean startBeforePublish() {
+ return true;
+ }
+
+ public boolean synchronousStart() {
+ return true;
+ }
+
+ public String getDescription() {
+ return serverDescription;
+ }
+
+ public RuntimeProxy getRuntimeType() {
+ return runtimeType;
+ }
+
+ public String getExtension() {
+ return extension;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public String getProxyServerId() {
+ return proxyServerId;
+ }
+ /**
+ * Return a string representation of this object.
+ *
+ * @return java.lang.String
+ */
+ public String toString() {
+ return "ServerType[" + getId() + "]";
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionUtility.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionUtility.java
index 6735f3d..bb6c71e 100644
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionUtility.java
+++ b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionUtility.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2015 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
@@ -10,23 +10,103 @@
*******************************************************************************/
package org.eclipse.wst.server.discovery.internal;
-import java.io.InputStream;
+import java.io.*;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
import java.net.URL;
import java.util.*;
+
import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.equinox.internal.p2.ui.ProvisioningOperationRunner;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.Version;
-import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.operations.ProvisioningJob;
+import org.eclipse.equinox.p2.query.IQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.QueryUtil;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.discovery.internal.model.Extension;
-import org.eclipse.wst.server.discovery.internal.model.ExtensionUpdateSite;
+import org.eclipse.wst.server.discovery.ErrorMessage;
+import org.eclipse.wst.server.discovery.RuntimeProxy;
+import org.eclipse.wst.server.discovery.ServerProxy;
+import org.eclipse.wst.server.discovery.internal.model.*;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
public class ExtensionUtility {
+ private static final String SERVER_ADAPTER_SITES_DETAILS = "serverAdapterSitesDetails.xml";
+ private static Extension[] extensionList = null;
+ private static Object tempLock = new Object();
+ private static List<ServerProxy> serverExtension = new ArrayList<ServerProxy>();
+ private static HashMap<String, Extension>extensionMap = new HashMap<String, Extension>();
+ private static HashMap<String, ErrorMessage> extensionMapError = new HashMap<String, ErrorMessage>();
+
+
+ private static List<IServerExtension> getExtensionUpdateSitesDetails(URL url, Extension[] extnList) throws CoreException {InputStream in = null;
+ try {
+ in = url.openStream();
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Could not load URL " + url);
+ }
+
+ if (in == null)
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, "Could not load extension details", null));
+
+ try {
+ IMemento memento = XMLMemento.loadMemento(in);
+ List<IServerExtension> list = new ArrayList<IServerExtension>();
+ IMemento children[] = memento.getChildren("feature");
+
+ if (extnList != null){
+ XMLMemento newMemento = XMLMemento.createWriteRoot("extensionDetails");
+
+ for (int j = 0; j < extnList.length; j++) {
+ IMemento childMemento = newMemento.createChild("feature");
+ childMemento.putString("provider", extnList[j].getProvider());
+ for (int i = 0; i < children.length; i++) {
+ if (children[i].getString("id").equals(extnList[j].getId())){
+ childMemento.putString("provider", children[i].getString("provider"));
+ if(extnList[j].getServerId() != null){
+ childMemento.putString("serverId", extnList[j].getServerId());
+ }
+ else if (children[i].getString("serverId") != null)
+ childMemento.putString("serverId", children[i].getString("serverId"));
+
+ break;
+ }
+ }
+
+ childMemento.putString("id", extnList[j].getId());
+ childMemento.putString("description", extnList[j].getDescription());
+ childMemento.putString("name", extnList[j].getName());
+ childMemento.putString("uri", extnList[j].getURI());
+ childMemento.putString("version", extnList[j].getVersion().toString());
+ ExtensionProxy item = new ExtensionProxy(childMemento.getString("id"), childMemento.getString("name"), childMemento.getString("description"),
+ childMemento.getString("provider"), childMemento.getString("uri"), childMemento.getString("version"), childMemento.getString("serverId"));
+ list.add(item);
+ }
+ newMemento.saveToFile(url.toURI().getPath());
+ }
+ else{
+ for (int i = 0; i < children.length; i++) {
+ ExtensionProxy item = new ExtensionProxy(children[i].getString("id"), children[i].getString("name"), children[i].getString("description"),
+ children[i].getString("provider"), children[i].getString("uri"), children[i].getString("version"), children[i].getString("serverId"));
+ list.add(item);
+ }
+ }
+ return list;
+ } catch (Exception e) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, e.getMessage(), e));
+ }
+
+ }
+
private static ExtensionUpdateSite[] getExtensionUpdateSites(URL url) throws CoreException {
InputStream in = null;
try {
@@ -56,7 +136,120 @@
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, e.getMessage(), e));
}
}
+
+ private static void copyFileUsingFileStreams(InputStream input, File dest) throws IOException {
+ if (input == null) {
+ throw new IOException("Input stream is null");
+ }
+ // dest is never null
+ OutputStream output = null;
+ try {
+ output = new FileOutputStream(dest);
+ byte[] buf = new byte[1024];
+ int bytesRead;
+ while ((bytesRead = input.read(buf)) > 0) {
+ output.write(buf, 0, bytesRead);
+ }
+ } finally {
+ input.close();
+ if (output != null) output.close();
+ }
+ }
+ /**
+ * Returns an array of all known extension update sites.
+ * <p>
+ * A new array is returned on each call, so clients may store or modify the result.
+ * </p>
+ *
+ * @return the array of extensions items {@link ExtensionUpdateSite}
+ */
+ private static List<IServerExtension> getExtensionUpdateSitesDetails(Extension[] extenList) {
+ try {
+ URL cacheFileUrl = null;
+ File workspaceFile = new File(Activator.getDefault().getStateLocation().toOSString() + File.separator + SERVER_ADAPTER_SITES_DETAILS);
+ // First look in workspace, then in configuration and finally fall back to master copy
+ if (workspaceFile.exists()) {
+ cacheFileUrl = workspaceFile.toURI().toURL();
+ } else {
+ // Use the configuration area
+ File configDir = getConfigDir(); // It is never null
+ File configFile = new File(configDir.getAbsolutePath() + File.separator + SERVER_ADAPTER_SITES_DETAILS);
+ if (configFile.exists()) {
+ cacheFileUrl = configFile.toURI().toURL();
+ } else {
+ // Create in configuration area
+ URL masterCopyUrl = Activator.getDefault().getBundle().getEntry(SERVER_ADAPTER_SITES_DETAILS);
+ boolean configFileAreaExists = configDir.exists();
+ if (!configFileAreaExists) {
+ try {
+ configFileAreaExists = configDir.mkdirs();
+ } catch (Exception e) {
+ // Could fail if user has no write permission
+ printLog("Cannot write to configuration", e);
+ configFileAreaExists = false;
+ }
+ }
+ if (configFileAreaExists) {
+ try {
+ copyFileUsingFileStreams(masterCopyUrl.openStream(), configFile);
+ cacheFileUrl = configFile.toURI().toURL();
+ } catch (IOException e) {
+ printLog("Cannot write to configuration", e);
+ }
+ }
+ if (cacheFileUrl == null) {
+ // Failed to create in configuration area; use workspace area
+ try {
+ File workspaceFileArea = workspaceFile.getParentFile();
+ boolean workspaceFileAreaExists = workspaceFileArea.exists();
+ if (!workspaceFileAreaExists) {
+ try {
+ workspaceFileAreaExists = workspaceFileArea.mkdirs();
+ } catch (Exception e) {
+ // Should never fail, yet better to be safe than sorry!
+ Trace.trace(Trace.SEVERE, "Cannot write to workspace", e);
+ workspaceFileAreaExists = false;
+ }
+ }
+ if (workspaceFileAreaExists) {
+ copyFileUsingFileStreams(masterCopyUrl.openStream(), workspaceFile);
+ cacheFileUrl = workspaceFile.toURI().toURL();
+ }
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Cannot write to workspace", e);
+ }
+ }
+ if (cacheFileUrl == null) {
+ // Use the master copy as the cache
+ cacheFileUrl = masterCopyUrl;
+ }
+ }
+ }
+ printLog("cacheFile=" + cacheFileUrl, null);
+ return getExtensionUpdateSitesDetails(cacheFileUrl, extenList);
+ } catch (CoreException ce) {
+ Trace.trace(Trace.SEVERE, "Could not get extension items details", ce);
+ } catch (MalformedURLException e) {
+ Trace.trace(Trace.SEVERE, "Could not get extension items details", e);
+ } catch (IOException e) {
+ Trace.trace(Trace.SEVERE, "Could not get extension items details", e);
+ } catch (URISyntaxException e) {
+ Trace.trace(Trace.SEVERE, "Could not get extension items details", e);
+ }
+ return new ArrayList<IServerExtension>();
+ }
+ private static File getConfigDir() throws IOException, URISyntaxException {
+ Location cfgLoc = Platform.getConfigurationLocation();
+ URL cfgDataUrl = cfgLoc.getDataArea(Activator.PLUGIN_ID);
+ return new File(cfgDataUrl.toExternalForm());
+ }
+
+ private static void printLog(String msg, Exception ex) {
+ Activator.getDefault().getLog().log(new Status(Status.INFO, Activator.PLUGIN_ID, msg, ex));
+ }
+
+
/**
* Returns an array of all known extension update sites.
* <p>
@@ -83,7 +276,7 @@
* @param newFeature
* @return true if the new feature is already installed, or a newer one is.
*/
- private static boolean alreadyExists(List<Extension> existing, Extension newFeature) {
+ private static boolean alreadyExists(List<Extension> existing, IServerExtension newFeature) {
if (existing.contains(newFeature))
return true;
@@ -91,28 +284,31 @@
Iterator<Extension> iterator = existing.iterator();
while (iterator.hasNext()) {
- Extension feature = iterator.next();
+ IServerExtension feature = iterator.next();
if (feature.getId().equals(newFeature.getId())) {
+ if(newV == null)
+ return true;
if (feature.getVersion().compareTo(newV) >= 0)
return true;
}
}
-
return false;
}
- private static void addExtension(List<Extension> list, List<Extension> existing, Extension newFeature, ExtensionListener listener) {
+ private static void addExtension(List<IServerExtension> list, List<Extension> existing, IServerExtension newFeature, ExtensionListener listener) {
if (alreadyExists(existing, newFeature))
return;
synchronized (list) {
Version newV = newFeature.getVersion();
- Extension remove = null;
+ IServerExtension remove = null;
- Iterator<Extension> iterator = list.iterator();
+ Iterator<IServerExtension> iterator = list.iterator();
while (iterator.hasNext()) {
- Extension feature = iterator.next();
+ IServerExtension feature = iterator.next();
if (feature.getId().equals(newFeature.getId())) {
+ if (newV == null)
+ return; // don't add if already exists
if (feature.getVersion().compareTo(newV) < 0) {
remove = feature;
} else
@@ -122,16 +318,28 @@
}
if (remove != null) {
list.remove(remove);
- listener.extensionRemoved(remove);
+ if (listener!= null)
+ listener.extensionRemoved((Extension)remove);
}
list.add(newFeature);
}
- listener.extensionFound(newFeature);
+ if (listener!= null){
+ listener.extensionFound((Extension)newFeature);
+ }
+ if (listener == null && newFeature instanceof ExtensionProxy)
+ serverExtension.add(createServerProxy((ExtensionProxy)newFeature));
+
+ }
+
+ private static ServerProxy createServerProxy(ExtensionProxy newFeature){
+ RuntimeProxy runtimeProxy = new RuntimeProxy("com.eclipse.runtime.proxy", newFeature.getName(), newFeature.getDescription(), newFeature.getProvider());
+ ServerProxy serverProxy = new ServerProxy("com.eclipse.server.proxy", newFeature.getName(), newFeature.getDescription(), runtimeProxy, newFeature.getId(), newFeature.getURI(), newFeature.getServerId());
+ return serverProxy;
}
- protected static void addExtensions(List<Extension> list, List<Extension> existing, List<Extension> newFeatures, ExtensionListener listener) {
- Iterator<Extension> iterator = newFeatures.iterator();
+ protected static void addExtensions(List<IServerExtension> list, List<Extension> existing, List<IServerExtension> newFeatures, ExtensionListener listener) {
+ Iterator<IServerExtension> iterator = newFeatures.iterator();
while (iterator.hasNext())
addExtension(list, existing, iterator.next(), listener);
}
@@ -150,14 +358,26 @@
IProfileRegistry profileRegistry = (IProfileRegistry) getService(Activator.getDefault().getBundle().getBundleContext(), IProfileRegistry.class.getName());
IProfile[] profiles = profileRegistry.getProfiles();
IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
-
+ if (profile == null ) {//it happens sometime , possibility of bug in profileRegistry
+ for (int i = 0; i < profiles.length; i++) {
+ if (profiles[i].getProfileId().equals(IProfileRegistry.SELF)){
+ profile = profiles[i];
+ break;
+ }
+
+ }
+ }
+ List<Extension> list = new ArrayList<Extension>();
+
+ if (profile == null)
+ return list;
+
IQuery<IInstallableUnit> query = QueryUtil.createIUAnyQuery();
//Query query = new InstallableUnitQuery("org.eclipse.wst.server.core.serverAdapter");
//List<String> list2 = new ArrayList();
//Query query = new ExtensionInstallableUnitQuery(list2);
IQueryResult<IInstallableUnit> collector = profile.query(query, monitor);
- List<Extension> list = new ArrayList<Extension>();
Iterator<IInstallableUnit> iter = collector.iterator();
while (iter.hasNext()) {
IInstallableUnit iu = iter.next();
@@ -170,20 +390,49 @@
return list;
}
- public static Extension[] getAllExtensions(final String id, final ExtensionListener listener, IProgressMonitor monitor) throws CoreException {
+
+ public static void setExtensionList(Extension[] extList){
+ synchronized (tempLock) {
+ extensionList = extList;
+ }
+ }
+
+ public static Extension[] getAllExtensionsWithServer(final String id, IProgressMonitor monitor) throws CoreException {
monitor = ProgressUtil.getMonitorFor(monitor);
monitor.beginTask("", 1100);
monitor.subTask(Messages.discoverLocalConfiguration);
final List<Extension> existing = getExistingFeatures(ProgressUtil.getSubMonitorFor(monitor, 100));
+
+ List <IServerExtension> extensionCached = getExtensionUpdateSitesDetails(null);
+ final List<IServerExtension> list = new ArrayList<IServerExtension>();
+ if (extensionCached != null && extensionCached.size() != 0){
+ addExtensions(list, existing, extensionCached, null);
+ }
+ return null;
+ }
+ public static Extension[] getAllExtensions(final String id, final ExtensionListener listener, IProgressMonitor monitor) throws CoreException {
+
+ synchronized(tempLock){
+ if (extensionList != null && extensionList.length != 0 && listener != null){
+ for (int i = 0; i < extensionList.length;i++){
+ listener.extensionFound(extensionList[i]);
+ }
+ return extensionList;
+ }
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask("", 1100);
+ monitor.subTask(Messages.discoverLocalConfiguration);
+ final List<Extension> existing = getExistingFeatures(ProgressUtil.getSubMonitorFor(monitor, 100));
+
final ExtensionUpdateSite[] items = getExtensionUpdateSites();
if (items == null || items.length == 0)
return new Extension[0];
final int x = 1000 / items.length;
monitor.worked(50);
- final List<Extension> list = new ArrayList<Extension>();
+ final List<IServerExtension> list = new ArrayList<IServerExtension>();
int size = items.length;
Thread[] threads = new Thread[size];
@@ -198,10 +447,11 @@
threads[i] = new Thread("Extension Checker for " + items[i].getUrl()) {
public void run() {
try {
- List<Extension> list2 = items[ii].getExtensions(ProgressUtil.getSubMonitorFor(monitor2, x));
+ List<IServerExtension> list2 = items[ii].getExtensions(ProgressUtil.getSubMonitorFor(monitor2, x));
addExtensions(list, existing, list2, listener);
} catch (CoreException ce) {
- listener.siteFailure(ce.getLocalizedMessage());
+ if (listener!= null)
+ listener.siteFailure(ce.getLocalizedMessage());
Trace.trace(Trace.WARNING, "Error downloading extension info", ce);
}
}
@@ -228,9 +478,32 @@
Extension[] ef = new Extension[list.size()];
list.toArray(ef);
monitor.done();
+ extensionList = ef;
return ef;
+ }
}
+ private static String SERVER_ADAPTER_ID = "org.eclipse.wst.server.core.serverAdapter";
+
+ public static List<ServerProxy> getExtensionsWithServer(IProgressMonitor monitor){
+ if (serverExtension == null || serverExtension.isEmpty()){
+ try {
+ getAllExtensionsWithServer(SERVER_ADAPTER_ID, monitor);
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Could not load server adapter list");
+ }
+ }
+ return serverExtension;
+
+ }
+
+ public static String getLicenseText(String extensionId){
+ Extension extension = extensionMap.get(extensionId);
+ if (extension != null)
+ return extension.getLicense();
+ return null;
+
+ }
/**
* Returns the service described by the given arguments. Note that this is a helper class
* that <b>immediately</b> ungets the service reference. This results in a window where the
@@ -264,4 +537,94 @@
return result;
}
+
+ public static boolean installExtension(final Extension extension){
+ if (extension == null){
+ return false;
+ }
+ String name = NLS.bind(Messages.installJobName, extension.getName());
+ Job job = new Job(name) {
+ public IStatus run(IProgressMonitor monitor) {
+ return extension.install(monitor);
+ }
+ };
+
+ // Request a restart when the installation is completed (bugzilla# 314823)
+ ProvisioningOperationRunner por = new ProvisioningOperationRunner(ProvisioningUI.getDefaultUI());
+ por.manageJob(job, ProvisioningJob.RESTART_OR_APPLY);
+
+ job.setUser(true);
+ job.schedule();
+ return true;
+ }
+
+ public static boolean installExtension(final String extensionId){
+ return installExtension(extensionMap.get(extensionId));
+ }
+
+ public static ErrorMessage refreshExtension(final String extensionId, String uri, IProgressMonitor monitor){
+ ErrorMessage errorMessageObj = null;
+ if (extensionMap.get(extensionId) != null){
+ if (extensionMapError.get(extensionId) == null)
+ return null;
+ }
+ ExtensionUpdateSite site = new ExtensionUpdateSite(uri, null, null);
+ try {
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask("", 1000);
+ monitor.subTask(Messages.fetchingRepository);
+ IProgressMonitor subMonitor = ProgressUtil.getSubMonitorFor(monitor, 500);
+ List<IServerExtension> list = site.getExtensions(subMonitor);
+ monitor.worked(500);
+ if (monitor.isCanceled())
+ return null;
+ boolean firstIteration = true;
+ for (Iterator iterator = list.iterator(); iterator.hasNext();) {
+ IServerExtension iServerExtension = (IServerExtension) iterator.next();
+ if (iServerExtension.getId().equals(extensionId)){
+ Extension extension = (Extension)iServerExtension;
+ if (extensionMap.get(extensionId) != null && !firstIteration && extension.getVersion().compareTo(((Extension)extensionMap.get(extensionId)).getVersion()) <= 0)
+ continue;
+ subMonitor = ProgressUtil.getSubMonitorFor(monitor, 500);
+ monitor.subTask(Messages.validateInstall);
+ final IProvisioningPlan plan = extension.getProvisioningPlan(true, subMonitor);
+ if (monitor.isCanceled())
+ return null;
+ if (plan == null || !plan.getStatus().isOK()) {
+ if (plan!= null){
+ StringBuffer detailedErrorMsg= new StringBuffer();
+ IStatus[] statusList = plan.getStatus().getChildren();
+ for (int i = 0; i < statusList.length; i++) {
+ detailedErrorMsg.append(statusList[i].getMessage());
+ }
+ errorMessageObj = new ErrorMessage(Messages.validateInstallError, detailedErrorMsg.toString());
+ Activator.getDefault().getLog().log(new Status(IStatus.INFO, Activator.PLUGIN_ID,detailedErrorMsg.toString(), plan.getStatus().getException()));
+ }
+ else{
+ errorMessageObj = new ErrorMessage(Messages.validateInstallError,Messages.fetchingRepositoryFailure);
+ Activator.getDefault().getLog().log(new Status(IStatus.INFO, Activator.PLUGIN_ID, "Could not get the provisioning plan",null));
+ }
+ }
+ extensionMap.put(extensionId, extension);
+ extensionMapError.put(extensionId, errorMessageObj);
+ firstIteration = false;
+ }
+ }
+ return errorMessageObj;
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Could not refresh server adapter node.");
+ return new ErrorMessage(Messages.fetchingRepositoryFailure, e.getLocalizedMessage());
+ }
+
+ }
+
+ public static void refreshServerAdapters(IProgressMonitor monitor){
+ try {
+ Extension[] extnList = getAllExtensions(SERVER_ADAPTER_ID, null, monitor);
+ getExtensionUpdateSitesDetails(extnList);
+ serverExtension = new ArrayList<ServerProxy>();
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Could not refresh server adapter list.");
+ }
+ }
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.java
index c9b6efb..a20a715 100644
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.java
+++ b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 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
@@ -28,6 +28,11 @@
public static String installConfirm;
public static String installJobName;
+
+ public static String fetchingRepository;
+ public static String validateInstall;
+ public static String validateInstallError;
+ public static String fetchingRepositoryFailure;
static {
NLS.initializeMessages(Activator.PLUGIN_ID + ".internal.Messages", Messages.class);
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.properties b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.properties
index 2d6534b..8a057f0 100644
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.properties
+++ b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2008,2010 IBM Corporation and others.
+# Copyright (c) 2008,2015 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
@@ -23,4 +23,8 @@
dialogTitle=Install Extension
-viewInitializing=Initializing...
\ No newline at end of file
+viewInitializing=Initializing...
+fetchingRepository=Fetching from Repository
+validateInstall=Validating requirements for install
+validateInstallError=Selected Server cannot be installed. Check Error log for details
+fetchingRepositoryFailure=Could not fetch the details
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/Extension.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/Extension.java
index 09a7116..806ebdc 100644
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/Extension.java
+++ b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/Extension.java
@@ -29,7 +29,7 @@
import org.eclipse.wst.server.discovery.internal.ExtensionUtility;
import org.osgi.framework.BundleContext;
-public class Extension {
+public class Extension implements IServerExtension{
private IInstallableUnit iu;
private URI uri;
@@ -99,6 +99,18 @@
IProfileRegistry profileRegistry = (IProfileRegistry) ExtensionUtility.getService(bundleContext, IProfileRegistry.SERVICE_NAME);
IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
+ IProfile[] profiles = profileRegistry.getProfiles();
+ if (profile == null ) {//it happens sometime , possibility of bug in profileRegistry
+ for (int i = 0; i < profiles.length; i++) {
+ if (profiles[i].getProfileId().equals(IProfileRegistry.SELF)){
+ profile = profiles[i];
+ break;
+ }
+
+ }
+ }
+ if (profile == null)
+ return null;
IProfileChangeRequest pcr = planner.createChangeRequest(profile);
pcr.add(iu);
IProvisioningAgent agent = ExtensionUtility.getAgent(bundleContext);
@@ -142,4 +154,12 @@
//System.out.println("Time: " + (System.currentTimeMillis() - time)); // TODO
return plan;
}
+
+ public String getURI() {
+ return uri.toString();
+ }
+
+ public String getServerId() {
+ return iu.getProperty("serverId", null);
+ }
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/ExtensionProxy.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/ExtensionProxy.java
new file mode 100644
index 0000000..55cc4de
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/ExtensionProxy.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.wst.server.discovery.internal.model;
+
+import org.eclipse.equinox.p2.metadata.Version;
+
+/**
+ * @since 1.1
+ */
+public class ExtensionProxy implements IServerExtension{
+ private String id;
+ private String name;
+ private String description;
+ private String provider;
+ private String uri;
+ private String version;
+ private String serverId;
+
+
+ public ExtensionProxy(String id, String name, String description, String provider, String uri, String version, String serverId) {
+ this.id= id;
+ this.name= name;
+ this.description= description;
+ this.provider= provider;
+ this.uri = uri;
+ this.version = version;
+ this.serverId = serverId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getProvider() {
+ return provider;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public Version getVersion() {
+ return null;
+ }
+
+ public String getVersionString() {
+ return version;
+ }
+
+ public String getServerId() {
+ return serverId;
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/ExtensionUpdateSite.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/ExtensionUpdateSite.java
index 27312f3..01d8f26 100644
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/ExtensionUpdateSite.java
+++ b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/ExtensionUpdateSite.java
@@ -65,7 +65,7 @@
return categories;
}
- public List<Extension> getExtensions(IProgressMonitor monitor) throws CoreException {
+ public List<IServerExtension> getExtensions(IProgressMonitor monitor) throws CoreException , ProvisionException{
try {
/*
* To discovery the server adapter, there are three methods:
@@ -86,7 +86,7 @@
UpdateSiteMetadataRepositoryFactory mrf = new UpdateSiteMetadataRepositoryFactory();
mrf.setAgent(ExtensionUtility.getAgent(bd));
// If the site.xml does not exist, the load will throw a org.eclipse.equinox.p2.core.ProvisionException
- List<Extension> list = new ArrayList<Extension>();
+ List<IServerExtension> list = new ArrayList<IServerExtension>();
try {
IMetadataRepository repo = mrf.load(url2, IRepositoryManager.REPOSITORIES_ALL, monitor);
IQuery<IInstallableUnit> query = QueryUtil.createMatchQuery("id ~=/*org.eclipse.wst.server.core.serverAdapter/"); //$NON-NLS-1$
@@ -106,11 +106,11 @@
IQuery<IInstallableUnit> query = QueryUtil.createIUAnyQuery();
IMetadataRepository repo = manager.loadRepository(url2, monitor);
- List<Extension> list2 = getInstallableUnits(repo,query,url2,monitor);
+ List<IServerExtension> list2 = getInstallableUnits(repo,query,url2,monitor);
int size = list2.size();
for (int i=0;i<size;i++){
- Extension e = list2.get(i);
+ Extension e = (Extension)list2.get(i);
IInstallableUnit[] iuArr = e.getIUs();
if(iuArr != null && iuArr.length > 0){
if (iuArr[0] != null){
@@ -135,15 +135,19 @@
}
return list;
- } catch (Exception e) {
+ } catch (ProvisionException e) {
Trace.trace(Trace.WARNING, "Error getting update info", e); //$NON-NLS-1$
- return new ArrayList<Extension>(0);
+ throw e;
+ }catch (Exception e) {
+ Trace.trace(Trace.WARNING, "Error getting update info", e); //$NON-NLS-1$
+
+ return new ArrayList<IServerExtension>(0);
}
}
// Get the list of InstallableUnits and all its requirements
- protected List<Extension> getInstallableUnits(IMetadataRepository repo, IQuery<IInstallableUnit> query, URI url, IProgressMonitor monitor){
- List<Extension> list = new ArrayList<Extension>();
+ protected List<IServerExtension> getInstallableUnits(IMetadataRepository repo, IQuery<IInstallableUnit> query, URI url, IProgressMonitor monitor){
+ List<IServerExtension> list = new ArrayList<IServerExtension>();
IQueryResult<IInstallableUnit> collector = repo.query(query, monitor);
for (IInstallableUnit iu: collector.toUnmodifiableSet()) {
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/IServerExtension.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/IServerExtension.java
new file mode 100644
index 0000000..9df509d
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/IServerExtension.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.wst.server.discovery.internal.model;
+
+import org.eclipse.equinox.p2.metadata.Version;
+
+public interface IServerExtension {
+ public String getName() ;
+
+ public String getDescription() ;
+
+ public String getProvider() ;
+
+ public String getId() ;
+
+ public String getURI() ;
+
+ public Version getVersion() ;
+}
diff --git a/plugins/org.eclipse.wst.server.ui/icons/obj16/down_arrow.gif b/plugins/org.eclipse.wst.server.ui/icons/obj16/down_arrow.gif
new file mode 100644
index 0000000..1314b42
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.ui/icons/obj16/down_arrow.gif
Binary files differ
diff --git a/plugins/org.eclipse.wst.server.ui/plugin.xml b/plugins/org.eclipse.wst.server.ui/plugin.xml
index 5d6cd6d..9925b80 100644
--- a/plugins/org.eclipse.wst.server.ui/plugin.xml
+++ b/plugins/org.eclipse.wst.server.ui/plugin.xml
@@ -631,4 +631,17 @@
id="org.eclipse.wst.server.ui.saveEditorPrompter1">
</saveEditorPrompter>
</extension>
+<extension point="org.eclipse.wst.server.ui.serverImages">
+ <image
+ id="com.eclipse.wst.server.downloadableserver.image"
+ icon="icons/obj16/server.gif"
+ typeIds="com.eclipse.server.proxy" />
+ </extension>
+<extension point="org.eclipse.wst.server.ui.wizardFragments">
+ <fragment
+ id="com.eclipse.wst.server.downloadableserver"
+ typeIds="com.eclipse.server.proxy"
+ class="org.eclipse.wst.server.ui.internal.wizard.fragment.DownloadableAdapterLicenseWizardFragment"/>
+</extension>
+
</plugin>
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultServerImageDescriptor.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultServerImageDescriptor.java
index b0868ad..91019fc 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultServerImageDescriptor.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultServerImageDescriptor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -23,6 +23,9 @@
private Image fBaseImage;
private Point fSize;
private Image overlay;
+ private int fFlags;
+
+ public static final int BOTTOM_RIGHT = 0x001;
/**
* Create a new OverlayImageDescriptor.
@@ -89,8 +92,14 @@
*/
protected void drawOverlays() {
ImageData data = overlay.getImageData();
- int x = getSize().x - data.width;
- drawImage(data, x, 0);
+ Point size = getSize();
+ int x = size.x - data.width;
+ int y = 0;
+ if ((fFlags & BOTTOM_RIGHT) != 0) {
+ y = size.y - data.height;
+ }
+
+ drawImage(data, x, y);
}
protected Image getBaseImage() {
@@ -104,4 +113,9 @@
protected void setSize(Point size) {
fSize = size;
}
+
+ public void setFlags(int flags) {
+ fFlags = flags;
+ }
+
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ImageResource.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ImageResource.java
index dc40bc5..1d1b27c 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ImageResource.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ImageResource.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2013 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -167,6 +167,9 @@
// Audio images
public static final String IMG_AUDIO_SOUND = "sound";
public static final String IMG_AUDIO_CATEGORY = "category";
+
+ public static final String IMG_DOWN_ARROW = "IMG_DOWN_ARROW";
+
/**
* Cannot construct an ImageResource. Use static methods only.
@@ -323,6 +326,8 @@
registerImage(IMG_AUDIO_SOUND, URL_OBJ + "audio_sound.gif");
registerImage(IMG_AUDIO_CATEGORY, URL_OBJ + "audio_category.gif");
+ registerImage(IMG_DOWN_ARROW, URL_OBJ + "down_arrow.gif");
+
loadServerImages();
PlatformUI.getWorkbench().getProgressService().registerIconForFamily(
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.java
index 6d1889a..599bf39 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2015 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
@@ -368,6 +368,12 @@
public static String internalWebBrowserName;
public static String ServersView2_noServers;
+
+ public static String chooseAnotherServer;
+ public static String downLoadableAdapterDescription;
+ public static String errorTitle;
+ public static String jobRefreshingServerAdapter;
+ public static String refreshButton;
static {
NLS.initializeMessages(ServerUIPlugin.PLUGIN_ID + ".internal.Messages", Messages.class);
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.properties b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.properties
index 80ab7b5..078f962 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.properties
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2004, 2013 IBM Corporation and others.
+# Copyright (c) 2004, 2015 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
@@ -368,7 +368,7 @@
# installable server composite
installableServerCompTree=Select the &server support to install:
-installableServerLink=Download additional server adapters
+installableServerLink=Show additional server adapters
installableServerLocal=Examining local configuration
installableServerSearching=Searching {0}
@@ -515,3 +515,9 @@
internalWebBrowserName=Internal Web Browser
ServersView2_noServers=<a>No servers are available. Click this link to create a new server...</a>
+
+chooseAnotherServer=Click Back to choose another server
+downLoadableAdapterDescription=Click Next to download and install
+errorTitle=Error
+jobRefreshingServerAdapter=Refreshing server adapter list
+refreshButton=Refresh
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPreferences.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPreferences.java
index 85e3910..9f948cd 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPreferences.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPreferences.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -30,6 +30,7 @@
private static final String PREF_RESTART = "restart";
private static final String PREF_CREATE_SERVER_WITH_RUNTIME = "create-server";
private static final String PREF_PUBLISH_ON_ADD_REMOVE = "publish-on-add-remove";
+ private static final String PREF_EXT_ADAPTER = "external-adapter";
public static final byte SAVE_EDITORS_ALWAYS = 2;
public static final byte SAVE_EDITORS_NEVER = 0;
@@ -83,6 +84,7 @@
preferences.setDefault(PREF_SHOW_ON_ACTIVITY, true);
preferences.setDefault(PREF_CREATE_SERVER_WITH_RUNTIME, false);
preferences.setDefault(PREF_PUBLISH_ON_ADD_REMOVE, true);
+ preferences.setDefault(PREF_EXT_ADAPTER, true);
}
/**
@@ -370,4 +372,25 @@
preferences.setValue(PREF_PUBLISH_ON_ADD_REMOVE, b);
ServerUIPlugin.getInstance().savePluginPreferences();
}
+
+ /**
+ * Returns whether the user should be prompted when the launch mode
+ * of the server doesn't match.
+ *
+ * @return int
+ */
+ public boolean getExtAdapter() {
+ return preferences.getBoolean(PREF_EXT_ADAPTER);
+ }
+
+ /**
+ * Sets whether the user should be prompted when the launch mode
+ * of the server doesn't match.
+ *
+ * @param b a launch mode constant
+ */
+ public void setExtAdapter(boolean b) {
+ preferences.setValue(PREF_EXT_ADAPTER, b);
+ ServerUIPlugin.getInstance().savePluginPreferences();
+ }
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeComposite.java
index 32dee4a..93ac173 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeComposite.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2013 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -10,23 +10,22 @@
*******************************************************************************/
package org.eclipse.wst.server.ui.internal.viewers;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.*;
import org.eclipse.ui.dialogs.FilteredTree;
+import org.eclipse.wst.server.ui.internal.Messages;
+import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
/**
*
*/
@@ -34,6 +33,11 @@
protected FilteredTree tree;
protected TreeViewer treeViewer;
protected Label description;
+ protected Button showAdapters;
+ protected Link prefLink;
+ protected Button refreshButton;
+ protected AbstractTreeContentProvider contentProvider;
+
public AbstractTreeComposite(Composite parent) {
super(parent, SWT.NONE);
@@ -61,16 +65,43 @@
String details = getDetailsLabel();
if (details != null) {
- Link prefLink = new Link(this, SWT.NONE);
+ Composite comp = new Composite(this, SWT.NONE);
+ layout = new GridLayout();
+ layout.numColumns = 3;
+ comp.setLayout(layout);
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
data.horizontalSpan = 2;
- prefLink.setLayoutData(data);
+ comp.setLayoutData(data);
+ Dialog.applyDialogFont(comp);
+ if (getDetailsLink()){
+ showAdapters = new Button(comp, SWT.CHECK);
+
+ showAdapters.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ handleShowAdapterSelection(showAdapters.getSelection());
+ }
+ });
+ showAdapters.setSelection(ServerUIPlugin.getPreferences().getExtAdapter());
+ }
+ prefLink = new Link(comp, SWT.NONE);
prefLink.setText("<a>" + details + "</a>");
prefLink.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
detailsSelected();
}
});
+ if (getDetailsLink()){
+ prefLink.setEnabled(!ServerUIPlugin.getPreferences().getExtAdapter());
+ refreshButton = new Button(comp, SWT.PUSH);
+ refreshButton.setText(Messages.refreshButton);
+ refreshButton.setEnabled(ServerUIPlugin.getPreferences().getExtAdapter());
+ refreshButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ refreshButton.setEnabled(false);
+ refreshServerNode();
+ }
+ });
+ }
}
Label label = new Label(this, SWT.WRAP);
@@ -156,8 +187,96 @@
protected String getDetailsLabel() {
return null;
}
+
+ protected boolean getDetailsLink() {
+ return false;
+ }
protected void detailsSelected() {
// do nothing
}
+
+ protected void refreshServerNode(){
+ // class implementing will provide the details if required
+ }
+ protected void downloadAdaptersSelectionChanged(boolean action) {
+ ServerUIPlugin.getPreferences().setExtAdapter(action);
+ Job job = new Job(Messages.jobInitializingServersView) {
+ public IStatus run(final IProgressMonitor monitor) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ if (ServerUIPlugin.getPreferences().getExtAdapter()){
+ handleShowAdapters(monitor);
+ }
+ else {
+ contentProvider.fillTree();
+ refresh("root");
+ if (contentProvider.getInitialSelection() != null){
+ treeViewer.setSelection(new StructuredSelection(contentProvider.getInitialSelection()), true);
+ }
+ }
+
+ } catch (Exception e) {
+ // ignore - wizard has already been closed
+ }
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ };
+ job.setSystem(true);
+ job.setPriority(Job.SHORT);
+ job.schedule();
+ }
+
+ protected void handleShowAdapterSelection(boolean selection){
+ showAdapters.setSelection(selection);
+ prefLink.setEnabled(!selection);
+ refreshButton.setEnabled(selection);
+ downloadAdaptersSelectionChanged(selection);
+ }
+
+ protected void deferInitialization() {
+ Job job = new Job(Messages.jobInitializingServersView) {
+ public IStatus run(final IProgressMonitor monitor) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ if (ServerUIPlugin.getPreferences().getExtAdapter()){
+ handleShowAdapters(monitor);
+ }
+ else if (contentProvider.getInitialSelection() != null){
+ treeViewer.setSelection(new StructuredSelection(contentProvider.getInitialSelection()), true);
+ }
+ } catch (Exception e) {
+ // ignore - wizard has already been closed
+ }
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ };
+
+ job.setSystem(true);
+ job.setPriority(Job.SHORT);
+ job.schedule();
+ }
+
+ protected void handleShowAdapters(IProgressMonitor monitor){
+ contentProvider.fillAdapterTree(treeViewer, monitor);
+ if (contentProvider.getInitialSelection() != null && !treeViewer.getTree().isDisposed()){
+ treeViewer.setSelection(new StructuredSelection(contentProvider.getInitialSelection()), true);
+ }
+
+ }
+
+ protected void enableRefresh(){
+ if ( !showAdapters.isDisposed() && showAdapters.getSelection() )
+ refreshButton.setEnabled(true);
+ }
+
+ protected void disableRefresh(){
+ refreshButton.setEnabled(false);
+ }
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeContentProvider.java
index 3133d01..bfa5be6 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeContentProvider.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -13,8 +13,11 @@
import java.util.*;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.wst.server.ui.internal.Messages;
import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
/**
* Runtime type content provider.
@@ -47,6 +50,20 @@
}
protected abstract void fillTree();
+
+ protected void fillAdapterTree(final TreeViewer treeViewer, final IProgressMonitor monitor){
+ final Thread t = new Thread(Messages.jobInitializingServersView) {
+ public void run() {
+ deferredAdapterInitialize(treeViewer, monitor);
+ }
+ };
+ t.setDaemon(true);
+ t.start();
+ }
+
+ protected void deferredAdapterInitialize(final TreeViewer treeViewer, IProgressMonitor monitor){
+ // do nothing
+ }
protected void clean() {
elements = null;
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeComposite.java
index 33af761..a7bcd29 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeComposite.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -31,7 +31,6 @@
protected String version;
protected String runtimeTypeId;
- protected RuntimeTypeTreeContentProvider contentProvider;
protected boolean initialSelection = true;
public interface RuntimeTypeSelectionListener {
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerComposite.java
index abc3009..9f5ce3b 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerComposite.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2013 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -44,7 +44,6 @@
public class ServerComposite extends AbstractTreeComposite implements IShellProvider {
protected IServer selection;
protected ServerSelectionListener listener;
- protected ServerTreeContentProvider contentProvider;
protected boolean initialSelection = true;
protected IModule module;
@@ -116,7 +115,7 @@
public void setIncludeIncompatibleVersions(boolean b) {
includeIncompatibleVersions = b;
ISelection sel = treeViewer.getSelection();
- contentProvider.setIncludeIncompatibleVersions(b);
+ ((ServerTreeContentProvider)contentProvider).setIncludeIncompatibleVersions(b);
treeViewer.refresh();
treeViewer.setSelection(sel, true);
}
@@ -132,7 +131,7 @@
public void refreshAll() {
ISelection sel = treeViewer.getSelection();
contentProvider = new ServerTreeContentProvider(module, launchMode);
- contentProvider.setIncludeIncompatibleVersions(includeIncompatibleVersions);
+ ((ServerTreeContentProvider)contentProvider).setIncludeIncompatibleVersions(includeIncompatibleVersions);
treeViewer.setContentProvider(contentProvider);
treeViewer.setSelection(sel);
}
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeComposite.java
index ff2c1ec..288e34b 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeComposite.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -14,21 +14,16 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.*;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-
import org.eclipse.wst.server.core.IModuleType;
import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.discovery.Discovery;
import org.eclipse.wst.server.ui.internal.Messages;
+import org.eclipse.wst.server.ui.internal.ProgressUtil;
import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
/**
*
@@ -36,7 +31,6 @@
public class ServerTypeComposite extends AbstractTreeComposite {
protected IServerType selection;
protected ServerTypeSelectionListener listener;
- protected ServerTypeTreeContentProvider contentProvider;
protected boolean initialSelection = true;
protected IModuleType moduleType;
@@ -80,19 +74,29 @@
public void selectionChanged(SelectionChangedEvent event) {
Object obj = getSelection(event.getSelection());
if (obj instanceof IServerType) {
- selection = (IServerType) obj;
- setDescription(selection.getDescription());
- } else {
- selection = null;
- setDescription("");
- }
- listener.serverTypeSelected(selection);
+ handleTreeSelectionChange((IServerType)obj);
}
- });
+ }});
+
treeViewer.setSorter(new DefaultViewerSorter());
}
+ public void handleTreeSelectionChange(IServerType serverSelection){
+ if (serverSelection != null) {
+ selection = serverSelection;
+ setDescription(selection.getDescription());
+ } else {
+ selection = null;
+ setDescription("");
+ }
+
+ listener.serverTypeSelected(selection);
+ }
+
+ public void setSelection(IServerType server){
+ treeViewer.setSelection(new StructuredSelection(server), true);
+ }
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible && initialSelection) {
@@ -101,35 +105,13 @@
}
}
- protected void deferInitialization() {
- Job job = new Job(Messages.jobInitializingServersView) {
- public IStatus run(IProgressMonitor monitor) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- try {
- if (contentProvider.getInitialSelection() != null)
- treeViewer.setSelection(new StructuredSelection(contentProvider.getInitialSelection()), true);
- } catch (Exception e) {
- // ignore - wizard has already been closed
- }
- }
- });
- return Status.OK_STATUS;
- }
- };
-
- job.setSystem(true);
- job.setPriority(Job.SHORT);
- job.schedule();
- }
-
public boolean setHost(boolean newHost) {
if (isLocalhost == newHost)
return false;
isLocalhost = newHost;
ISelection sel = treeViewer.getSelection();
- contentProvider.setLocalhost(isLocalhost);
+ ((ServerTypeTreeContentProvider)contentProvider).setLocalhost(isLocalhost);
treeViewer.refresh();
//treeViewer.expandToLevel(2);
treeViewer.setSelection(sel, true);
@@ -139,7 +121,7 @@
public void setIncludeIncompatibleVersions(boolean b) {
includeIncompatibleVersions = b;
ISelection sel = treeViewer.getSelection();
- contentProvider.setIncludeIncompatibleVersions(b);
+ ((ServerTypeTreeContentProvider)contentProvider).setIncludeIncompatibleVersions(b);
treeViewer.refresh();
treeViewer.setSelection(sel, true);
}
@@ -166,6 +148,10 @@
return Messages.installableServerLink;
}
+ protected boolean getDetailsLink() {
+ return true;
+ }
+
private void closeWizard(Composite comp) {
if (comp == null || comp.isDisposed())
return;
@@ -184,4 +170,102 @@
closeWizard(this);
}
}
+
+ protected void refreshServerNode(){
+ class RefreshJob extends Job{
+ public RefreshJob() {
+ super(Messages.jobRefreshingServerAdapter);
+ }
+
+ public boolean belongsTo(Object family) {
+ return "org.eclipse.wst.server.ui.family".equals(family);
+ }
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask("", 1000);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ contentProvider.fillTree();
+ refresh("root");
+ if (contentProvider.getInitialSelection() != null && !treeViewer.getTree().isDisposed()){
+ treeViewer.setSelection(new StructuredSelection(contentProvider.getInitialSelection()), true);
+ }
+ }
+ });
+ monitor.worked(200);
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ Discovery.refreshServerAdapters(ProgressUtil.getSubMonitorFor(monitor, 500));
+ monitor.worked(700);
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ ServerCore.resetDownloadableServers();
+ final IProgressMonitor finalMonitor = monitor;
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+
+ if (ServerUIPlugin.getPreferences().getExtAdapter()){
+ handleShowAdapters(ProgressUtil.getSubMonitorFor(finalMonitor, 200));
+ }
+ }
+ });
+ monitor.worked(900);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ enableRefresh();
+ }
+ });
+ return Status.OK_STATUS;
+ }
+
+ }
+ RefreshJob job = new RefreshJob();
+ job.setUser(true);
+ job.schedule();
+ job.setPriority(Job.SHORT);
+ /*Job job = new Job(Messages.jobRefreshingServerAdapter) {
+ @SuppressWarnings("restriction")
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask("", 1000);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ contentProvider.fillTree();
+ refresh("root");
+ if (contentProvider.getInitialSelection() != null && !treeViewer.getTree().isDisposed()){
+ treeViewer.setSelection(new StructuredSelection(contentProvider.getInitialSelection()), true);
+ }
+ }
+ });
+ monitor.worked(200);
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ Discovery.refreshServerAdapters(ProgressUtil.getSubMonitorFor(monitor, 500));
+ monitor.worked(700);
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ ServerCore.resetDownloadableServers();
+ final IProgressMonitor finalMonitor = monitor;
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+
+ if (ServerUIPlugin.getPreferences().getExtAdapter()){
+ handleShowAdapters(ProgressUtil.getSubMonitorFor(finalMonitor, 200));
+ }
+ }
+ });
+ monitor.worked(900);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ enableRefresh();
+ }
+ });
+ return Status.OK_STATUS;
+ }
+
+ };*/
+
+
+ }
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeContentProvider.java
index acded76..d97650f 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeContentProvider.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2014 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -10,11 +10,17 @@
*******************************************************************************/
package org.eclipse.wst.server.ui.internal.viewers;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.wst.server.core.*;
import org.eclipse.wst.server.core.internal.ServerType;
+import org.eclipse.wst.server.core.internal.ServerTypeProxy;
+import org.eclipse.wst.server.discovery.internal.Activator;
import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
import org.eclipse.wst.server.ui.internal.Trace;
/**
@@ -68,8 +74,25 @@
}
elements = list.toArray();
}
+
+ public void cleanAdapterTree(final TreeViewer treeViewer){
+ fillTree();
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ treeViewer.refresh("root");
+ } catch (Exception e) {
+ // ignore - wizard has already been closed
+ }
+ }
+ });
+ }
+
+
protected boolean include(IServerType serverType) {
+ if (serverType instanceof ServerTypeProxy)
+ return true;
if (serverTypeId != null && !serverType.getId().startsWith(serverTypeId))
return false;
@@ -105,6 +128,54 @@
return false;
}
+ @SuppressWarnings("restriction")
+ private boolean compareServers(List serverList, ServerTypeProxy server){
+ for (Iterator iterator = serverList.iterator(); iterator.hasNext();) {
+ IServerType existingServer = (IServerType) iterator.next();
+ if (existingServer.getId().equals(server.getProxyServerId())){
+ Activator.getDefault().getLog().log(new Status(IStatus.INFO, Activator.PLUGIN_ID,"already installed: " + server.getProxyServerId(), null));
+ return true;
+ }
+
+ }
+ return false;
+ }
+ protected void deferredAdapterInitialize(final TreeViewer treeViewer, IProgressMonitor monitor) {
+ List<TreeElement> list = new ArrayList<TreeElement>();
+ IServerType[] serverTypes = ServerCore.getDownloadableServers(monitor);
+ if (serverTypes != null) {
+ int size = serverTypes.length;
+ for (int i = 0; i < size; i++) {
+ IServerType serverType = serverTypes[i];
+ try {
+ IRuntimeType runtimeType = serverType.getRuntimeType();
+ TreeElement ele = getOrCreate(list, runtimeType.getVendor());
+ if (!compareServers(ele.contents, (ServerTypeProxy)serverType)){
+ ele.contents.add(serverType);
+ elementToParentMap.put(serverType, ele);
+ }
+ } catch (Exception e) {
+ if (Trace.WARNING) {
+ Trace.trace(Trace.STRING_WARNING, "Error in server configuration content provider", e);
+ }
+ }
+ }
+ }
+ if (list.size() >0) {
+ List<Object> newList = new ArrayList<Object>();
+ newList.addAll(Arrays.asList(elements));
+ newList.addAll(list);
+ elements = newList.toArray();
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ if (!treeViewer.getTree().isDisposed())
+ treeViewer.refresh("root");
+ }
+ });
+ }
+ }
+
+
protected boolean checkForNonStubEnvironmentRuntime(IServerType serverType) {
IRuntimeType runtimeType = serverType.getRuntimeType();
IRuntime[] runtimes = ServerUIPlugin.getRuntimes(runtimeType);
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeLabelProvider.java
index a872232..7f32f57 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeLabelProvider.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -10,10 +10,12 @@
*******************************************************************************/
package org.eclipse.wst.server.ui.internal.viewers;
-import org.eclipse.wst.server.core.IServerType;
-import org.eclipse.wst.server.ui.internal.ImageResource;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.internal.ServerTypeProxy;
+import org.eclipse.wst.server.ui.internal.DefaultServerImageDescriptor;
+import org.eclipse.wst.server.ui.internal.ImageResource;
/**
* Server type label provider.
*/
@@ -39,7 +41,16 @@
*/
protected Image getImageImpl(Object element) {
IServerType type = (IServerType) element;
- return ImageResource.getImage(type.getId());
+ Image image = ImageResource.getImage(type.getId());
+ DefaultServerImageDescriptor dsid = null;
+ if (element instanceof ServerTypeProxy) {
+ Image image1 = ImageResource.getImage(ImageResource.IMG_DOWN_ARROW);
+ dsid = new DefaultServerImageDescriptor(image, image1);
+ dsid.setFlags(DefaultServerImageDescriptor.BOTTOM_RIGHT);
+ image = dsid.createImage();
+ }
+
+ return image;
}
/**
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewServerWizard.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewServerWizard.java
index 304dd7c..0f4ec85 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewServerWizard.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewServerWizard.java
@@ -13,15 +13,14 @@
import java.util.List;
import org.eclipse.jface.viewers.IStructuredSelection;
-
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
import org.eclipse.wst.server.core.TaskModel;
import org.eclipse.wst.server.ui.internal.Messages;
import org.eclipse.wst.server.ui.internal.wizard.fragment.ModifyModulesWizardFragment;
import org.eclipse.wst.server.ui.internal.wizard.fragment.NewServerWizardFragment;
import org.eclipse.wst.server.ui.internal.wizard.fragment.TasksWizardFragment;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
/**
* A wizard to create a new server and server configuration.
*/
@@ -40,7 +39,6 @@
list.add(WizardTaskUtil.TempSaveRuntimeFragment);
list.add(WizardTaskUtil.TempSaveServerFragment);
-
list.add(new ModifyModulesWizardFragment());
list.add(new TasksWizardFragment());
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizard.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizard.java
index d5b7117..80dfad3 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizard.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -11,11 +11,7 @@
package org.eclipse.wst.server.ui.internal.wizard;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.*;
@@ -25,7 +21,6 @@
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.IWizardPage;
-
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
@@ -34,6 +29,7 @@
import org.eclipse.wst.server.ui.internal.EclipseUtil;
import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
import org.eclipse.wst.server.ui.internal.Trace;
+import org.eclipse.wst.server.ui.internal.wizard.fragment.DownloadableAdapterLicenseWizardFragment;
import org.eclipse.wst.server.ui.internal.wizard.page.WorkspaceRunnableAdapter;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
/**
@@ -319,7 +315,7 @@
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
WizardFragment fragment = (WizardFragment) iterator.next();
- if (!taskModel.equals(fragment.getTaskModel()))
+ if ((!(fragment instanceof DownloadableAdapterLicenseWizardFragment))&& !taskModel.equals(fragment.getTaskModel()))
fragment.setTaskModel(taskModel);
}
return list;
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizardPage.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizardPage.java
index 0c9c9bb..21a1968 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizardPage.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizardPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -15,6 +15,7 @@
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
@@ -71,6 +72,12 @@
return true;
}
+ public IWizardPage getNextPage(){
+ if (fragment.isForceLastFragment())
+ return null;
+ return super.getNextPage();
+ }
+
public boolean canFlipToNextPage() {
if (getNextPage() == null)
return false;
@@ -83,6 +90,7 @@
return true;
}
+
public void setVisible(boolean visible) {
super.setVisible(visible);
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/WizardTaskUtil.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/WizardTaskUtil.java
index 5af8336..49b038c 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/WizardTaskUtil.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/WizardTaskUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -11,15 +11,13 @@
package org.eclipse.wst.server.ui.internal.wizard;
import java.util.List;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.ProjectProperties;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
+import org.eclipse.wst.server.core.internal.*;
import org.eclipse.wst.server.ui.internal.EclipseUtil;
import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
import org.eclipse.wst.server.ui.internal.Trace;
@@ -97,6 +95,8 @@
IServer server = (IServer) taskModel.getObject(TaskModel.TASK_SERVER);
if (server != null && server instanceof IServerWorkingCopy) {
IServerWorkingCopy workingCopy = (IServerWorkingCopy) server;
+ if (workingCopy.getServerType() instanceof ServerTypeProxy)
+ return;
if (workingCopy.isDirty()) {
IFile file = ((Server)workingCopy).getFile();
if (file != null) {
@@ -146,6 +146,8 @@
}
IRuntime runtime = workingCopy.getRuntime();
+ if (runtime instanceof RuntimeProxy)
+ return;
server = workingCopy.save(false, monitor);
workingCopy = server.createWorkingCopy();
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/DownloadableAdapterLicenseWizardFragment.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/DownloadableAdapterLicenseWizardFragment.java
new file mode 100644
index 0000000..d80b384
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/DownloadableAdapterLicenseWizardFragment.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.wst.server.ui.internal.wizard.fragment;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.wst.server.core.TaskModel;
+import org.eclipse.wst.server.discovery.Discovery;
+import org.eclipse.wst.server.ui.internal.Messages;
+
+public class DownloadableAdapterLicenseWizardFragment extends LicenseWizardFragment {
+ public void performFinish(IProgressMonitor monitor) throws CoreException {
+ Discovery.installExtension((String) getTaskModel().getObject(TaskModel.TASK_EXTENSION));
+ }
+
+ public void enter() {
+ super.enter();
+ setForceLastFragment(true);
+ if (((Integer) getTaskModel().getObject(LicenseWizardFragment.LICENSE_ERROR)).equals(new Integer(IMessageProvider.ERROR))){
+ comp.setVisibleAcceptReject(false);
+ wizardHandle.setTitle(Messages.errorTitle);
+ wizardHandle.setMessage(Messages.chooseAnotherServer, IMessageProvider.ERROR);
+ }
+ else{
+ comp.setVisibleAcceptReject(true);
+ wizardHandle.setTitle(Messages.wizLicenseTitle);
+ wizardHandle.setMessage("", IMessageProvider.NONE);
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/LicenseWizardFragment.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/LicenseWizardFragment.java
index 3555b42..fa5092c 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/LicenseWizardFragment.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/LicenseWizardFragment.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2015 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
@@ -25,8 +25,11 @@
public static final String LICENSE_UNKNOWN = "unknown";
public static final String LICENSE_ACCEPT = "accept";
public static final String LICENSE_SERVER = "license_server";
-
+ public static final String LICENSE_ERROR = "license_error";
+
protected LicenseComposite comp;
+ protected IWizardHandle wizardHandle;
+
public LicenseWizardFragment() {
// do nothing
@@ -47,6 +50,7 @@
public Composite createComposite(Composite parent, IWizardHandle wizard) {
comp = new LicenseComposite(parent, getTaskModel(), wizard);
+ this.wizardHandle = wizard;
wizard.setTitle(Messages.wizLicenseTitle);
wizard.setDescription(Messages.wizLicenseDescription);
wizard.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_WIZBAN_NEW_SERVER));
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewServerWizardFragment.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewServerWizardFragment.java
index ede2055..9cee374 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewServerWizardFragment.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewServerWizardFragment.java
@@ -10,10 +10,7 @@
*******************************************************************************/
package org.eclipse.wst.server.ui.internal.wizard.fragment;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -21,13 +18,13 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.wst.server.core.*;
import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
+import org.eclipse.wst.server.core.util.SocketUtil;
import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
import org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil;
-import org.eclipse.wst.server.ui.internal.wizard.page.NewServerComposite;
import org.eclipse.wst.server.ui.internal.wizard.page.NewManualServerComposite;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
+import org.eclipse.wst.server.ui.internal.wizard.page.NewServerComposite;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-import org.eclipse.wst.server.core.util.SocketUtil;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
/**
*
*/
@@ -107,31 +104,32 @@
Byte b = getMode();
if (b != null && b.byteValue() == MODE_MANUAL) {
- IRuntime runtime = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+ Object runtime = getTaskModel().getObject(TaskModel.TASK_RUNTIME);
if (runtime != null && runtime instanceof IRuntimeWorkingCopy) {
- WizardFragment sub = getWizardFragment(runtime.getRuntimeType().getId());
+ WizardFragment sub = getWizardFragment(((IRuntime)runtime).getRuntimeType().getId());
if (sub != null)
list.add(sub);
- }
-
+ }
IServerAttributes server = (IServerAttributes) getTaskModel().getObject(TaskModel.TASK_SERVER);
if (server != null) {
- if (server.getServerType().hasServerConfiguration() && server instanceof ServerWorkingCopy) {
+ if (server.getServerType().hasServerConfiguration() && server instanceof ServerWorkingCopy && runtime instanceof IRuntime) {
ServerWorkingCopy swc = (ServerWorkingCopy) server;
- if (runtime != null && runtime.getLocation() != null && !runtime.getLocation().isEmpty()) {
- if (runtimeLocation == null || !runtimeLocation.equals(runtime.getLocation()))
+ IRuntime runtime1 = (IRuntime)runtime;
+ if (runtime != null && runtime1.getLocation() != null && !runtime1.getLocation().isEmpty()) {
+ if (runtimeLocation == null || !runtimeLocation.equals(runtime1.getLocation()))
try {
- swc.importRuntimeConfiguration(runtime, null);
+ swc.importRuntimeConfiguration(runtime1, null);
} catch (CoreException ce) {
// ignore
}
- runtimeLocation = runtime.getLocation();
+ runtimeLocation = runtime1.getLocation();
} else
runtimeLocation = null;
}
WizardFragment sub = getWizardFragment(server.getServerType().getId());
- if (sub != null)
+ if (sub != null){
list.add(sub);
+ }
}
} else if (b != null && b.byteValue() == MODE_EXISTING) {
/*if (comp != null) {
@@ -177,6 +175,8 @@
return false;
}
+ if (!manualComp.canProceed())
+ return false;
boolean supportsRemote = getServer().getServerType().supportsRemoteHosts();
if (manualComp.getCurrentHostname().trim().length() == 0){
isComplete = false;
@@ -221,4 +221,12 @@
}
super.performFinish(monitor);
}
+
+ public void exit() {
+ Composite composite = comp.getNewManualServerComposite();
+ if(composite != null && composite instanceof NewManualServerComposite){
+ NewManualServerComposite manualComp = (NewManualServerComposite) composite;
+ manualComp.refreshExtension();
+ }
+ }
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/LicenseComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/LicenseComposite.java
index 399acbd..bdbc337 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/LicenseComposite.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/LicenseComposite.java
@@ -132,4 +132,9 @@
}
taskModel.putObject(LicenseWizardFragment.LICENSE_ACCEPT, new Boolean(accepted));
}
+
+ public void setVisibleAcceptReject(boolean visible){
+ accept.setVisible(visible);
+ decline.setVisible(visible);
+ }
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java
index e0f619c..d12c5b2 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2015 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
@@ -19,6 +19,7 @@
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
@@ -40,16 +41,20 @@
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
+import org.eclipse.wst.server.core.internal.*;
import org.eclipse.wst.server.core.util.SocketUtil;
+import org.eclipse.wst.server.discovery.Discovery;
+import org.eclipse.wst.server.discovery.ErrorMessage;
import org.eclipse.wst.server.ui.AbstractUIControl;
import org.eclipse.wst.server.ui.AbstractUIControl.IUIControlListener;
import org.eclipse.wst.server.ui.AbstractUIControl.UIControlEntry;
import org.eclipse.wst.server.ui.internal.*;
+import org.eclipse.wst.server.ui.internal.Messages;
+import org.eclipse.wst.server.ui.internal.Trace;
import org.eclipse.wst.server.ui.internal.viewers.ServerTypeComposite;
import org.eclipse.wst.server.ui.internal.wizard.TaskWizard;
import org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil;
+import org.eclipse.wst.server.ui.internal.wizard.fragment.LicenseWizardFragment;
import org.eclipse.wst.server.ui.internal.wizard.page.HostnameComposite.IHostnameSelectionListener;
import org.eclipse.wst.server.ui.wizard.ServerCreationWizardPageExtension;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
@@ -79,6 +84,7 @@
protected IRuntime[] runtimes;
protected IRuntime newRuntime;
+ protected Label serverNameLabel;
protected Text serverName;
protected String defaultServerName;
protected boolean serverNameModified;
@@ -101,6 +107,7 @@
protected Label hostnameLabel;
protected Text hostname;
protected ControlDecoration hostnameDecoration;
+ protected FieldDecoration fd;
protected ServerCreationCache cache = new ServerCreationCache();
@@ -205,7 +212,7 @@
});
FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
- FieldDecoration fd = registry.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
+ fd = registry.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
hostnameDecoration.setImage(fd.getImage());
hostnameDecoration.setDescriptionText(fd.getDescription());
@@ -223,7 +230,7 @@
String[] hosts2 = hosts.toArray(new String[hosts.size()]);
new AutoCompleteField(hostname, new TextContentAdapter(), hosts2);
- Label serverNameLabel = new Label(this, SWT.NONE);
+ serverNameLabel = new Label(this, SWT.NONE);
serverNameLabel.setText(Messages.serverName);
serverName = new Text(this, SWT.SINGLE | SWT.BORDER | SWT.CANCEL);
@@ -402,8 +409,9 @@
}
protected void handleHostnameChange(IServerType serverType) {
-
wizard.setMessage(null, IMessageProvider.NONE);
+ if (serverType instanceof ServerTypeProxy)
+ return;
if (!validate(serverType)) {
return;// Host name validation failed, so there is no need to continue handling hostname change event
}
@@ -441,6 +449,8 @@
if(selectedServerType == null){
return false;
}
+ if (selectedServerType instanceof ServerTypeProxy)
+ return true;
boolean supportsRemote = selectedServerType.supportsRemoteHosts();
if (hostname.getText().trim().length() == 0){
wizard.setMessage(NLS.bind(Messages.wizEmptyHostName, new Object[0]), IMessageProvider.ERROR);
@@ -682,10 +692,143 @@
}
}
+ boolean canProceed = true;
+ public boolean canProceed(){
+ return canProceed;
+ }
+
+ public boolean refreshExtension(){
+ if (!(oldServerType instanceof ServerTypeProxy))
+ return true;
+ final ServerTypeProxy finalServerType = (ServerTypeProxy)oldServerType;
+ try {
+ wizard.run(true, true, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ ErrorMessage errorMsg = Discovery.refreshExtension(finalServerType.getExtension(), finalServerType.getURI(), monitor);
+ if (errorMsg != null){
+ final ErrorMessage errorMsgFinal = errorMsg;
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ canProceed = false;
+ wizard.setMessage(errorMsgFinal.getErrorTitle(), IMessageProvider.ERROR);
+ WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(finalServerType.getId());
+ if (fragment2 != null){
+ TaskModel taskModel = fragment2.getTaskModel();
+ taskModel.putObject(LicenseWizardFragment.LICENSE, errorMsgFinal.getErrorDescription());
+ taskModel.putObject(LicenseWizardFragment.LICENSE_ERROR, new Integer(IMessageProvider.ERROR));
+ }
+ wizard.update();
+ }
+ });
+ }
+ else{
+ WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(finalServerType.getId());
+ if (fragment2 != null){
+ TaskModel taskModel = fragment2.getTaskModel();
+ taskModel.putObject(LicenseWizardFragment.LICENSE, Discovery.getLicenseText(finalServerType.getExtension()));
+ taskModel.putObject(LicenseWizardFragment.LICENSE_ERROR, new Integer(IMessageProvider.NONE));
+ }
+ }
+ }
+ });
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ return true;
+ }
+
+ protected boolean showDownloadableServerWizard(ServerTypeProxy serverType, IProgressMonitor monitor) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ wizard.setMessage(Messages.downLoadableAdapterDescription, IMessageProvider.INFORMATION);
+ }
+ });
+
+ WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(serverType.getId());
+ if (fragment2 == null)
+ return false;
+ TaskModel taskModel = fragment2.getTaskModel();
+ if (taskModel == null)
+ taskModel = new TaskModel();
+ taskModel.putObject(TaskModel.TASK_EXTENSION, serverType.getExtension());
+ taskModel.putObject(TaskModel.TASK_RUNTIME, serverType.getRuntimeType());
+ taskModel.putObject(TaskModel.TASK_SERVER, serverType);
+ fragment2.setTaskModel(taskModel);
+ return true;
+ }
+
+ boolean success ;
/**
* Handle the server type selection.
*/
protected void handleTypeSelection(IServerType serverType) {
+ canProceed = true;
+ // wizard.setMessage(null, IMessageProvider.NONE);
+ if (serverType instanceof ServerTypeProxy){
+ hostname.setVisible(false);
+ serverNameLabel.setVisible(false);
+ serverName.setVisible(false);
+ hostnameLabel.setVisible(false);
+ runtimeLabel.setVisible(false);
+ runtimeCombo.setVisible(false);
+ configureRuntimes.setVisible(false);
+ addRuntime.setVisible(false);
+ hostnameDecoration.setImage(null);
+ hostnameDecoration.setDescriptionText(null);
+ final ServerTypeProxy serverTypeFinal = (ServerTypeProxy)serverType;
+ success = false;
+ ServerTypeProxy serverProxy = (ServerTypeProxy)serverType;
+ RuntimeTypeProxy runtimeProxy = (RuntimeTypeProxy)serverProxy.getRuntimeType();
+ runtime = new RuntimeProxy(runtimeProxy);
+ server = new ServerWorkingCopy(serverProxy.getId(), null, runtime,serverProxy );
+
+ fireServerWorkingCopyChanged();
+ listener.serverSelected(server);
+ // Fire the property change event.
+ List<ServerCreationWizardPageExtension> pageExtensionLst = ServerUIPlugin.getServerCreationWizardPageExtensions();
+ for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) {
+ curPageExtension.handlePropertyChanged(new PropertyChangeEvent(this, AbstractUIControl.PROP_SERVER_TYPE, oldServerType, serverType));
+ }
+ wizard.update();
+ try {
+ wizard.run(true, true, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ success = showDownloadableServerWizard(serverTypeFinal, monitor);
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ }
+
+ if (success){
+ // Update the old server type value.
+ oldServerType = serverTypeFinal;
+
+ }
+ wizard.update();
+
+ return;
+ }
+ oldServerType = serverType;
+ if (serverType != null){
+ // Update the old server type value.
+ hostname.setVisible(true);
+ serverNameLabel.setVisible(true);
+ serverName.setVisible(true);
+ hostnameLabel.setVisible(true);
+ runtimeLabel.setVisible(true);
+ runtimeCombo.setVisible(true);
+ configureRuntimes.setVisible(true);
+ addRuntime.setVisible(true);
+ hostnameDecoration.setImage(fd.getImage());
+ hostnameDecoration.setDescriptionText(fd.getDescription());
+ }
boolean wrong = false;
if (serverType != null && moduleType != null) {
IRuntimeType runtimeType = serverType.getRuntimeType();
@@ -705,7 +848,7 @@
runtime = null;
wizard.setMessage("", IMessageProvider.ERROR); //$NON-NLS-1$
} else {
- wizard.setMessage(null, IMessageProvider.NONE);
+ //wizard.setMessage(null, IMessageProvider.NONE);
loadServerImpl(serverType);
if (server != null && module != null) {
IStatus status = NewServerComposite.isSupportedModule(server, module);
@@ -936,4 +1079,5 @@
// If the widget is null, return false
return false;
}
+
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/WizardFragment.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/WizardFragment.java
index 3c7e505..d190d70 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/WizardFragment.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/WizardFragment.java
@@ -42,6 +42,7 @@
public abstract class WizardFragment {
private TaskModel taskModel;
private boolean isComplete = true;
+ private boolean isforceLastFragment = false;
private List<WizardFragment> listImpl;
/**
@@ -219,4 +220,28 @@
protected void setComplete(boolean complete) {
this.isComplete = complete;
}
+
+ /**
+ * Returns true if this fragment is forced to be the last fragment. If it is
+ * not forceLastFragment the user will be allowed to go to the next fragment.
+ * If the fragment is isForceLastFragment, the Next button
+ * will be enabled if more fragment exists. If forceLastFragment, clicking Finish
+ * will still execute the finish of remaining fragments.
+ *
+ * @return <code>true</code> if the fragment is forceLastFragment, and
+ * <code>false</code> otherwise
+ */
+ public boolean isForceLastFragment() {
+ return isforceLastFragment;
+ }
+
+ /**
+ * Set the isforceLastFragment state.
+ *
+ * @param isforceLastFragment <code>true</code> if the fragment is forced to be last fragment, and
+ * <code>false</code> otherwise
+ */
+ protected void setForceLastFragment(boolean isforceLastFragment) {
+ this.isforceLastFragment = isforceLastFragment;
+ }
}
\ No newline at end of file