Author: rob.stryker(a)jboss.com
Date: 2011-11-28 11:57:32 -0500 (Mon, 28 Nov 2011)
New Revision: 36706
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/IJBoss7ManagerService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerServiceProxy.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/JBoss71ManagerService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java
Log:
JBIDE-10224 JBIDE-10253 - work for as7.1 incompatible with 7.0 jars
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/IJBoss7ManagerService.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/IJBoss7ManagerService.java 2011-11-28
16:37:54 UTC (rev 36705)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/IJBoss7ManagerService.java 2011-11-28
16:57:32 UTC (rev 36706)
@@ -22,6 +22,8 @@
public static final String AS_VERSION_710_Beta = "710.beta1"; //$NON-NLS-1$
public static final int MGMT_PORT = 9999;
+ public void init() throws Exception;
+
/**
* Asynchronously deploy a file to a server
* @param host
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerServiceProxy.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerServiceProxy.java 2011-11-28
16:37:54 UTC (rev 36705)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerServiceProxy.java 2011-11-28
16:57:32 UTC (rev 36706)
@@ -31,6 +31,10 @@
.format("(&(objectClass={0})(as.version={1}))",
IJBoss7ManagerService.class.getCanonicalName(), asVersion)), null); //$NON-NLS-1$
}
+ public void init() throws Exception {
+ checkedGetService().init();
+ }
+
public IJBoss7DeploymentResult deployAsync(String host, int port, String deploymentName,
File file,
IProgressMonitor monitor) throws Exception {
return checkedGetService().deployAsync(host, port, deploymentName, file, monitor);
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerUtil.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerUtil.java 2011-11-28
16:37:54 UTC (rev 36705)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerUtil.java 2011-11-28
16:57:32 UTC (rev 36706)
@@ -20,7 +20,9 @@
private static final String JBOSS7_RUNTIME =
"org.jboss.ide.eclipse.as.runtime.70"; //$NON-NLS-1$
private static final String JBOSS71_RUNTIME =
"org.jboss.ide.eclipse.as.runtime.71"; //$NON-NLS-1$
private static final String EAP6_RUNTIME =
"org.jboss.ide.eclipse.as.runtime.eap.60"; //$NON-NLS-1$
+ private static final int UNLIKELY_PORT = 65401;
+
public static IJBoss7ManagerService getService(IServer server) throws
InvalidSyntaxException {
BundleContext context = JBossServerCorePlugin.getContext();
JBoss7ManagerServiceProxy proxy = new JBoss7ManagerServiceProxy(context,
getRequiredVersion(server));
@@ -33,22 +35,25 @@
/* HUUUUUUUUGE HACK */
private synchronized static void skipLazyInit() {
if( !initialized ) {
+
// Testing to see if forcing the proxy open will
BundleContext context = JBossServerCorePlugin.getContext();
JBoss7ManagerServiceProxy proxy = null;
try {
proxy = new JBoss7ManagerServiceProxy(context,
IJBoss7ManagerService.AS_VERSION_710_Beta);
proxy.open();
- proxy.getServerState("localhost", 9999); //$NON-NLS-1$
+ //proxy.getServerState("localhost", UNLIKELY_PORT); //$NON-NLS-1$
+ proxy.init();
} catch( Exception e ) {
- e.printStackTrace();
+ // ignore, expected failure
}
try {
proxy = new JBoss7ManagerServiceProxy(context,
IJBoss7ManagerService.AS_VERSION_700);
proxy.open();
- proxy.getServerState("localhost", 9999); //$NON-NLS-1$
+ //proxy.getServerState("localhost", UNLIKELY_PORT); //$NON-NLS-1$
+ proxy.init();
} catch(Exception e ) {
- e.printStackTrace();
+ // ignore, expected failure
}
initialized = true;
}
@@ -84,9 +89,7 @@
}
public static interface IServiceAware<RESULT> {
-
public RESULT execute(IJBoss7ManagerService service) throws Exception;
-
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath 2011-11-28
16:37:54 UTC (rev 36705)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath 2011-11-28
16:57:32 UTC (rev 36706)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib"
path="jboss-as-controller-client-7.0.0.Final.jar"/>
- <classpathentry exported="true" kind="lib"
path="jboss-as-protocol-7.0.0.Final.jar"/>
+ <classpathentry exported="true" kind="lib"
path="jboss-as-protocol-7.0.0.Final.jar"
sourcepath="/home/rob/code/jboss/as7/jboss-as/protocol"/>
<classpathentry exported="true" kind="lib"
path="jboss-dmr-1.0.0.Final.jar"/>
<classpathentry exported="true" kind="lib"
path="jboss-logging-3.0.0.GA.jar"/>
<classpathentry exported="true" kind="lib"
path="jboss-marshalling-1.3.0.GA.jar"/>
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java 2011-11-28
16:37:54 UTC (rev 36705)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java 2011-11-28
16:57:32 UTC (rev 36706)
@@ -65,9 +65,6 @@
public AS7Manager(String host, int port) throws UnknownHostException {
this.client = ModelControllerClient.Factory.create(host, port);
this.manager = ServerDeploymentManager.Factory.create(client);
- System.out.println("70 client class: " + client.getClass());
- System.out.println("70 manager class: " + manager.getClass());
-
}
public IJBoss7DeploymentResult undeploySync(String name, IProgressMonitor monitor)
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java 2011-11-28
16:37:54 UTC (rev 36705)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java 2011-11-28
16:57:32 UTC (rev 36706)
@@ -23,6 +23,9 @@
* @author Rob Stryker
*/
public class JBoss7ManagerService implements IJBoss7ManagerService {
+ public void init() throws Exception {
+ }
+
public IJBoss7DeploymentResult deployAsync(String host, int port, String
deploymentName,
File file, IProgressMonitor monitor) throws Exception {
AS7Manager manager = new AS7Manager(host, port);
@@ -116,7 +119,7 @@
}
}
- @Override
public void dispose() {
}
+
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java 2011-11-28
16:37:54 UTC (rev 36705)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java 2011-11-28
16:57:32 UTC (rev 36706)
@@ -33,6 +33,14 @@
import java.util.Set;
import java.util.concurrent.Future;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.sasl.RealmCallback;
+import javax.security.sasl.RealmChoiceCallback;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osgi.util.NLS;
import org.jboss.as.controller.client.ModelControllerClient;
@@ -63,12 +71,39 @@
}
public AS71Manager(String host, int port) throws UnknownHostException {
- this.client = ModelControllerClient.Factory.create(host, port);
+ this.client = ModelControllerClient.Factory.create(host, port,getCallbackHandler());
this.manager = ServerDeploymentManager.Factory.create(client);
- System.out.println("71 client class: " + client.getClass());
- System.out.println("71 client class: " + manager.getClass());
}
+ protected CallbackHandler getCallbackHandler() {
+ return new Tools71CallbackHandler();
+ }
+
+ protected class Tools71CallbackHandler implements CallbackHandler {
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ if (callbacks.length == 1 && callbacks[0] instanceof NameCallback) {
+ ((NameCallback) callbacks[0]).setName("anonymous JBossTools
user");
+ return;
+ }
+
+ NameCallback name = null;
+ PasswordCallback pass = null;
+ for (Callback current : callbacks) {
+ if (current instanceof NameCallback) {
+ name = (NameCallback) current;
+ } else if (current instanceof PasswordCallback) {
+ pass = (PasswordCallback) current;
+ }
+ }
+ // TODO get the username
+ String username, password;
+ username = password = "test";
+ name.setName(username);
+ pass.setPassword(password.toCharArray());
+ }
+ }
+
public IJBoss7DeploymentResult undeploySync(String name, IProgressMonitor monitor)
throws JBoss7ManangerException {
IJBoss7DeploymentResult result = undeploy(name);
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/JBoss71ManagerService.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/JBoss71ManagerService.java 2011-11-28
16:37:54 UTC (rev 36705)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/JBoss71ManagerService.java 2011-11-28
16:57:32 UTC (rev 36706)
@@ -11,18 +11,27 @@
package org.jboss.ide.eclipse.as.internal.management.as71;
import java.io.File;
+import java.security.Security;
import org.eclipse.core.runtime.IProgressMonitor;
import org.jboss.ide.eclipse.as.core.server.v7.management.IJBoss7DeploymentResult;
import org.jboss.ide.eclipse.as.core.server.v7.management.IJBoss7ManagerService;
import org.jboss.ide.eclipse.as.core.server.v7.management.JBoss7DeploymentState;
import org.jboss.ide.eclipse.as.core.server.v7.management.JBoss7ServerState;
+import org.jboss.sasl.JBossSaslProvider;
/**
* @author Rob Stryker
*/
public class JBoss71ManagerService implements IJBoss7ManagerService {
+ public void init() throws Exception {
+ JBossSaslProvider saslProvider = new JBossSaslProvider();
+ if (Security.getProvider(saslProvider.getName()) == null) {
+ Security.insertProviderAt(saslProvider, 1);
+ }
+ }
+
public IJBoss7DeploymentResult deployAsync(String host, int port, String
deploymentName,
File file, IProgressMonitor monitor) throws Exception {
AS71Manager manager = new AS71Manager(host, port);
@@ -119,4 +128,5 @@
@Override
public void dispose() {
}
+
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2011-11-28
16:37:54 UTC (rev 36705)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2011-11-28
16:57:32 UTC (rev 36706)
@@ -59,6 +59,7 @@
public static String rwf_homeMissingFiles;
public static String rwf_jboss7homeNotValid;
public static String rwf_homeIncorrectVersion;
+ public static String rwf_homeIncorrectVersionError;
public static String rwf_nameTextBlank;
public static String rwf_homeDirBlank;
public static String rwf_NoVMSelected;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2011-11-28
16:37:54 UTC (rev 36705)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2011-11-28
16:57:32 UTC (rev 36706)
@@ -17,6 +17,7 @@
rwf_homeMissingFiles=The home directory does not exist or is missing a required file or
folder: {0}
rwf_jboss7homeNotValid=The home directory does not point to a valid JBoss installation.
rwf_homeIncorrectVersion=This server type expects a version of {0} but the server
directory is of version {1}.
+rwf_homeIncorrectVersionError=This server type expects a version of {0} but the server
directory is of version {1}. This combination may cause critical errors.
rwf_nameTextBlank=The name field must not be blank
rwf_homeDirBlank=The directory field must not be blank
rwf_NoVMSelected=No VM selected
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java 2011-11-28
16:37:54 UTC (rev 36705)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java 2011-11-28
16:57:32 UTC (rev 36706)
@@ -183,6 +183,11 @@
configDirTextVal = configDirText.getText();
updateErrorMessage();
}
+ protected String getWarningString() {
+ if( getHomeVersionWarning() != null )
+ return getHomeVersionWarning();
+ return null;
+ }
protected String getErrorString() {
if (nameText == null)
@@ -207,6 +212,21 @@
return Messages.bind(Messages.rwf7_ConfigFileError, actualPath.toString());
}
}
+
+ // Forced error strings for as7.0 and 7.1 incompatabilities.
+ File loc = new File(homeDir, getSystemJarPath() );
+ String version = getVersionString(loc);
+ IRuntime rt = (IRuntime) getTaskModel().getObject(
+ TaskModel.TASK_RUNTIME);
+ String adapterVersion = rt.getRuntimeType().getVersion();
+
+ if(!isEAP() && (adapterVersion.equals("7.0") &&
!version.startsWith("7.0."))
+ || (adapterVersion.equals("7.1") &&
version.startsWith("7.0."))) {
+ return NLS.bind(Messages.rwf_homeIncorrectVersionError, adapterVersion, version);
+ }
+ if( isEAP() && (adapterVersion.equals("6.0") &&
version.startsWith("7.0.")))
+ return NLS.bind(Messages.rwf_homeIncorrectVersionError, adapterVersion, version);
+
return null;
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2011-11-28
16:37:54 UTC (rev 36705)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2011-11-28
16:57:32 UTC (rev 36706)
@@ -664,7 +664,10 @@
IRuntime rt = (IRuntime) getTaskModel().getObject(
TaskModel.TASK_RUNTIME);
String v = rt.getRuntimeType().getVersion();
-
+ return getHomeVersionWarning(version, v);
+ }
+
+ protected String getHomeVersionWarning(String version, String v) {
/*
* CHEAP WARNING HACK -
* EAP 5.0 was started as named 5.0, but is now 5.x.
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java 2011-11-28
16:37:54 UTC (rev 36705)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java 2011-11-28
16:57:32 UTC (rev 36706)
@@ -117,5 +117,8 @@
public void dispose() {
}
+
+ public void init() throws Exception {
+ }
}
}