JBoss Tools SVN: r30899 - trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2011-04-28 07:17:28 -0400 (Thu, 28 Apr 2011)
New Revision: 30899
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java
Log:
JBIDE-8806
testSeamELContentAssistJbide1676 test case fails
Issue is fixed
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java 2011-04-28 09:59:05 UTC (rev 30898)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java 2011-04-28 11:17:28 UTC (rev 30899)
@@ -45,7 +45,7 @@
private static final String[] VALID_SEAM_EL_PROPOSALS = new String[] {
"TestSeamELContentAssistEntityManagerFactory",
"fullPostList",
- "a4j",
+ "a4j",
"a4jSkin",
"actor",
"ajaxContext",
@@ -302,13 +302,20 @@
if (filteredValidProposals.contains(proposalString)) {
existingProposals.add(proposalString);
filteredValidProposals.remove(proposalString);
- } else {
+ } else if (!existingProposals.contains(proposalString)){
nonExistingProposals.add(proposalString);
}
}
}
assertTrue("Some Seam EL proposals werent\'t shown in the Content Assistant", filteredValidProposals.isEmpty());
- assertTrue("Some Seam EL proposals were shown in the Content Assistant but they shouldn\'t", nonExistingProposals.isEmpty());
+ StringBuffer sb = new StringBuffer();
+ if (nonExistingProposals != null && !nonExistingProposals.isEmpty()) {
+ for (String np : nonExistingProposals) {
+ sb.append(np).append(' ');
+ }
+ }
+
+ assertTrue("Some Seam EL proposals were shown in the Content Assistant but they shouldn\'t: " + sb.toString(), nonExistingProposals.isEmpty());
} finally {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.closeEditor(editorPart, false);
14 years, 11 months
JBoss Tools SVN: r30898 - trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-04-28 05:59:05 -0400 (Thu, 28 Apr 2011)
New Revision: 30898
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java
Log:
[JBIDE-8793] added workaround to swallow connectin closed exception that is thrown by the client if the server is shut down (AS7-689)
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java 2011-04-28 09:06:49 UTC (rev 30897)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java 2011-04-28 09:59:05 UTC (rev 30898)
@@ -7,7 +7,7 @@
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.management.as7.deployment;
import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ADDRESS;
@@ -19,9 +19,11 @@
import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.RESULT;
import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.SHUTDOWN;
+import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import java.net.UnknownHostException;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -52,7 +54,7 @@
this(host, MGMT_PORT);
}
- public AS7Manager(String host, int port) throws UnknownHostException {
+ public AS7Manager(String host, int port) throws UnknownHostException {
this.client = ModelControllerClient.Factory.create(host, port);
this.manager = ServerDeploymentManager.Factory.create(client);
}
@@ -150,7 +152,7 @@
request.get(OP).set(SHUTDOWN);
quietlyExecute(request);
}
-
+
public void dispose() {
StreamUtils.safeClose(client);
}
@@ -160,11 +162,11 @@
ModelNode response = client.execute(node);
if (!AS7ManagerUtil.isSuccess(response)) {
throw new JBoss7ManangerException(
- NLS.bind(AS7Messages.OperationOnAddressFailed,
- new Object[]{ node.get(OP),
- node.get(ADDRESS),
- response.get(FAILURE_DESCRIPTION)}
- ));
+ NLS.bind(AS7Messages.OperationOnAddressFailed,
+ new Object[] { node.get(OP),
+ node.get(ADDRESS),
+ response.get(FAILURE_DESCRIPTION) }
+ ));
}
return response.get(RESULT);
} catch (Exception e) {
@@ -175,13 +177,22 @@
public void quietlyExecute(ModelNode node) throws JBoss7ManangerException {
try {
client.execute(node);
- } catch(IOException e) {
- // ignore
} catch (Exception e) {
+ if (isConnectionCloseException(e)) {
+ // TODO: workaround for AS7-689
+ // ignore
+ }
throw new JBoss7ManangerException(e);
}
}
-
+
+ private boolean isConnectionCloseException(Exception e) {
+ return e instanceof IOException
+ && e.getCause() instanceof ExecutionException
+ && e.getCause().getCause() instanceof EOFException
+ && e.getCause().getCause().getMessage().indexOf("Connection closed") > -1;
+ }
+
private IJBoss7DeploymentResult execute(DeploymentPlanBuilder builder) throws JBoss7ManangerException {
try {
DeploymentAction action = builder.getLastAction();
14 years, 11 months
JBoss Tools SVN: r30897 - in trunk/as: plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7 and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-04-28 05:06:49 -0400 (Thu, 28 Apr 2011)
New Revision: 30897
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBoss7ManagerService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7Manager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerProxy.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7Manager.java
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/jboss-management-service.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerTestUtils.java
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementServiceIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java
Log:
[JBIDE-8793] implemented shutdown server in adapter
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBoss7ManagerService.java (from rev 30870, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7Manager.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBoss7ManagerService.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBoss7ManagerService.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
+
+public interface IJBoss7ManagerService {
+
+ public static final String AS_VERSION_PROPERTY = "as.version"; //$NON-NLS-1$
+
+ public static final String AS_VERSION_700 = "700"; //$NON-NLS-1$
+
+ /**
+ * Asynchronously deploy a file to a server
+ *
+ * @param host
+ * The host
+ * @param port
+ * The port
+ * @param name
+ * The deployment's name
+ * @param file
+ * The file to be deployed
+ * @param monitor
+ * The progress monitor
+ *
+ * @return Not sure what to return yet
+ * @throws Exception
+ */
+ public IJBoss7DeploymentResult deployAsync(String host, int port,
+ String deploymentName, File file, IProgressMonitor monitor) throws Exception;
+
+ /**
+ * Synchronously deploy a file to a server
+ *
+ * @param host
+ * The host
+ * @param port
+ * The port
+ * @param name
+ * The deployment's name
+ * @param file
+ * The file to be deployed
+ * @param monitor
+ * The progress monitor
+ *
+ * @return Not sure what to return yet
+ * @throws Exception
+ */
+ public IJBoss7DeploymentResult deploySync(String host, int port,
+ String deploymentName, File file, IProgressMonitor monitor) throws Exception;
+
+ /**
+ * Asynchronously undeploy a file to a server
+ *
+ * @param host
+ * The host
+ * @param port
+ * The port
+ * @param name
+ * The deployment's name
+ * @param file
+ * The file to be deployed
+ * @param monitor
+ * The progress monitor
+ *
+ * @return Not sure what to return yet
+ * @throws Exception
+ */
+ public IJBoss7DeploymentResult undeployAsync(String host, int port,
+ String deploymentName, boolean removeFile, IProgressMonitor monitor) throws Exception;
+
+ /**
+ * Synchronously undeploy a file to a server
+ *
+ * @param host
+ * The host
+ * @param port
+ * The port
+ * @param name
+ * The deployment's name
+ * @param file
+ * The file to be deployed
+ * @param monitor
+ * The progress monitor
+ *
+ * @return Not sure what to return yet
+ * @throws Exception
+ */
+ public IJBoss7DeploymentResult syncUndeploy(String host, int port,
+ String deploymentName, boolean removeFile, IProgressMonitor monitor) throws Exception;
+
+ /**
+ * Returns the state for a given deployment name on a given host and port.
+ *
+ * @param host
+ * the host to query
+ * @param port
+ * the port to contact it on
+ * @param deploymentName
+ * the name of the deployment that shall be queried
+ *
+ * @return the state of the deployment
+ * @throws Exception
+ */
+ public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception;
+
+ /**
+ * Stops the given server
+ *
+ * @throws JBoss7ManangerException
+ * @throws Exception
+ */
+ public void stop(String host, int port) throws Exception;
+
+ public void stop(String host) throws Exception;
+
+ public void dispose();
+}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7Manager.java 2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7Manager.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.core.server.internal.v7;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public interface IJBoss7Manager {
-
- public static final String AS_VERSION_PROPERTY = "as.version"; //$NON-NLS-1$
-
- public static final String AS_VERSION_700 = "700"; //$NON-NLS-1$
-
- /**
- * Asynchronously deploy a file to a server
- *
- * @param host
- * The host
- * @param port
- * The port
- * @param name
- * The deployment's name
- * @param file
- * The file to be deployed
- * @param monitor
- * The progress monitor
- *
- * @return Not sure what to return yet
- * @throws Exception
- */
- public IJBoss7DeploymentResult deployAsync(String host, int port,
- String deploymentName, File file, IProgressMonitor monitor) throws Exception;
-
- /**
- * Synchronously deploy a file to a server
- *
- * @param host
- * The host
- * @param port
- * The port
- * @param name
- * The deployment's name
- * @param file
- * The file to be deployed
- * @param monitor
- * The progress monitor
- *
- * @return Not sure what to return yet
- * @throws Exception
- */
- public IJBoss7DeploymentResult deploySync(String host, int port,
- String deploymentName, File file, IProgressMonitor monitor) throws Exception;
-
- /**
- * Asynchronously undeploy a file to a server
- *
- * @param host
- * The host
- * @param port
- * The port
- * @param name
- * The deployment's name
- * @param file
- * The file to be deployed
- * @param monitor
- * The progress monitor
- *
- * @return Not sure what to return yet
- * @throws Exception
- */
- public IJBoss7DeploymentResult undeployAsync(String host, int port,
- String deploymentName, boolean removeFile, IProgressMonitor monitor) throws Exception;
-
- /**
- * Synchronously undeploy a file to a server
- *
- * @param host
- * The host
- * @param port
- * The port
- * @param name
- * The deployment's name
- * @param file
- * The file to be deployed
- * @param monitor
- * The progress monitor
- *
- * @return Not sure what to return yet
- * @throws Exception
- */
- public IJBoss7DeploymentResult syncUndeploy(String host, int port,
- String deploymentName, boolean removeFile, IProgressMonitor monitor) throws Exception;
-
- /**
- * Returns the state for a given deployment name on a given host and port.
- *
- * @param host
- * the host to query
- * @param port
- * the port to contact it on
- * @param deploymentName
- * the name of the deployment that shall be queried
- *
- * @return the state of the deployment
- * @throws Exception
- */
- public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception;
-
- /**
- * Stops the given server
- *
- * @throws JBoss7ManangerException
- * @throws Exception
- */
- public void stop(String host, int port) throws Exception;
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerProxy.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerProxy.java 2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerProxy.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -1,57 +0,0 @@
-package org.jboss.ide.eclipse.as.core.server.internal.v7;
-
-import java.io.File;
-import java.text.MessageFormat;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.util.tracker.ServiceTracker;
-
-public class JBoss7ManagerProxy extends ServiceTracker<IJBoss7Manager, IJBoss7Manager>
- implements IJBoss7Manager {
-
- public JBoss7ManagerProxy(BundleContext context, String asVersion) throws InvalidSyntaxException {
- super(
- context,
- context.createFilter(MessageFormat
- .format("(&(objectClass={0})(as.version={1}))", IJBoss7Manager.class.getCanonicalName(), asVersion)), null); //$NON-NLS-1$
- }
-
- public IJBoss7DeploymentResult deployAsync(String host, int port, String deploymentName, File file,
- IProgressMonitor monitor) throws Exception {
- return checkedGetService().deployAsync(host, port, deploymentName, file, monitor);
- }
-
- public IJBoss7DeploymentResult deploySync(String host, int port, String deploymentName, File file,
- IProgressMonitor monitor) throws Exception {
- return checkedGetService().deployAsync(host, port, deploymentName, file, monitor);
- }
-
- public IJBoss7DeploymentResult undeployAsync(String host, int port, String deploymentName, boolean removeFile,
- IProgressMonitor monitor) throws Exception {
- return checkedGetService().undeployAsync(host, port, deploymentName, removeFile, monitor);
- }
-
- public IJBoss7DeploymentResult syncUndeploy(String host, int port, String deploymentName, boolean removeFile,
- IProgressMonitor monitor) throws Exception {
- return checkedGetService().syncUndeploy(host, port, deploymentName, removeFile, monitor);
- }
-
- public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception {
- return checkedGetService().getDeploymentState(host, port, deploymentName);
- }
-
- public void stop(String host, int port) throws Exception {
- checkedGetService().stop(host, port);
- }
-
- private IJBoss7Manager checkedGetService() throws JBoss7ManangerException {
- IJBoss7Manager service = getService();
- if (service == null) {
- throw new JBoss7ManangerException("Could not acquire JBoss Management service"); //$NON-NLS-1$
- }
- return service;
- }
-
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java (from rev 30870, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerProxy.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -0,0 +1,66 @@
+package org.jboss.ide.eclipse.as.core.server.internal.v7;
+
+import java.io.File;
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class JBoss7ManagerServiceProxy extends ServiceTracker<IJBoss7ManagerService, IJBoss7ManagerService>
+ implements IJBoss7ManagerService {
+
+ public JBoss7ManagerServiceProxy(BundleContext context, String asVersion) throws InvalidSyntaxException {
+ super(
+ context,
+ context.createFilter(MessageFormat
+ .format("(&(objectClass={0})(as.version={1}))", IJBoss7ManagerService.class.getCanonicalName(), asVersion)), null); //$NON-NLS-1$
+ }
+
+ public IJBoss7DeploymentResult deployAsync(String host, int port, String deploymentName, File file,
+ IProgressMonitor monitor) throws Exception {
+ return checkedGetService().deployAsync(host, port, deploymentName, file, monitor);
+ }
+
+ public IJBoss7DeploymentResult deploySync(String host, int port, String deploymentName, File file,
+ IProgressMonitor monitor) throws Exception {
+ return checkedGetService().deployAsync(host, port, deploymentName, file, monitor);
+ }
+
+ public IJBoss7DeploymentResult undeployAsync(String host, int port, String deploymentName, boolean removeFile,
+ IProgressMonitor monitor) throws Exception {
+ return checkedGetService().undeployAsync(host, port, deploymentName, removeFile, monitor);
+ }
+
+ public IJBoss7DeploymentResult syncUndeploy(String host, int port, String deploymentName, boolean removeFile,
+ IProgressMonitor monitor) throws Exception {
+ return checkedGetService().syncUndeploy(host, port, deploymentName, removeFile, monitor);
+ }
+
+ public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception {
+ return checkedGetService().getDeploymentState(host, port, deploymentName);
+ }
+
+ public void stop(String host, int port) throws Exception {
+ checkedGetService().stop(host, port);
+ }
+
+ public void stop(String host) throws Exception {
+ checkedGetService().stop(host);
+ }
+
+ private IJBoss7ManagerService checkedGetService() throws JBoss7ManangerException {
+ IJBoss7ManagerService service = getService();
+ if (service == null) {
+ throw new JBoss7ManangerException("Could not acquire JBoss Management service"); //$NON-NLS-1$
+ }
+ return service;
+ }
+
+ public void dispose() {
+ close();
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java 2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -12,18 +12,21 @@
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
import org.osgi.framework.BundleContext;
public class JBoss7ManagerUtil {
public static final String SERVICE_VERSION_70 = "org.jboss.ide.eclipse.as.management.as7.service"; //$NON-NLS-1$
- public static IJBoss7Manager findManagementService(IServer server) throws Exception {
+ public static IJBoss7ManagerService findManagementService(IServer server) throws Exception {
BundleContext context = JBossServerCorePlugin.getContext();
- return new JBoss7ManagerProxy(context, getRequiredVersion(server));
+ JBoss7ManagerServiceProxy proxy = new JBoss7ManagerServiceProxy(context, getRequiredVersion(server));
+ proxy.open();
+ return proxy;
}
private static String getRequiredVersion(IServer server) {
- return IJBoss7Manager.AS_VERSION_700;
+ return IJBoss7ManagerService.AS_VERSION_700;
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -24,12 +24,15 @@
import org.eclipse.wst.server.core.IModule;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
-import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossBehaviorDelegate;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
public class JBoss7ServerBehavior extends JBossServerBehavior {
+
+ private IJBoss7ManagerService service;
+
private static HashMap<String, Class> delegateClassMap;
static {
delegateClassMap = new HashMap<String, Class>();
@@ -44,7 +47,14 @@
public void stop(boolean force) {
- setServerStopped();
+ try {
+ IJBoss7ManagerService service = getService();
+ // TODO: for now only local, implement for remote afterwards
+ service.stop("localhost"); //$NON-NLS-1$
+ setServerStopped();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
public boolean shouldSuspendScanner() {
@@ -83,4 +93,19 @@
} else
super.publishFinish(monitor);
}
+
+ private IJBoss7ManagerService getService() throws Exception {
+ if (service == null) {
+ service = JBoss7ManagerUtil.findManagementService(getServer());
+ }
+ return service;
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ if (service != null) {
+ service.dispose();
+ }
+ }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java 2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -16,6 +16,7 @@
public class LocalJBoss7BehaviorDelegate extends LocalJBossBehaviorDelegate {
public IStatus canChangeState(String launchMode) {
- return Status.CANCEL_STATUS;
+// return Status.CANCEL_STATUS;
+ return Status.OK_STATUS;
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath 2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath 2011-04-28 09:06:49 UTC (rev 30897)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry exported="true" kind="lib" path="jboss-as-controller-client-7.0.0.Beta3.jar" sourcepath="/jboss-as-controller-client"/>
+ <classpathentry exported="true" kind="lib" path="jboss-as-controller-client-7.0.0.Beta3.jar" sourcepath="/jboss-as-controller-client/src"/>
<classpathentry exported="true" kind="lib" path="jboss-as-protocol-7.0.0.Beta3.jar"/>
<classpathentry exported="true" kind="lib" path="jboss-dmr-1.0.0.Beta5.jar" sourcepath="/home/adietish/jboss-workspaces/jboss-tools/jbosstools-src/jboss-dmr-1.0.0.Beta5-sources.jar"/>
<classpathentry exported="true" kind="lib" path="jboss-logging-3.0.0.Beta3.jar"/>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/jboss-management-service.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/jboss-management-service.xml 2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/jboss-management-service.xml 2011-04-28 09:06:49 UTC (rev 30897)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.jboss.ide.eclipse.as.management.as7.service">
- <implementation class="org.jboss.ide.eclipse.as.management.as7.deployment.JBoss7Manager"/>
+ <implementation class="org.jboss.ide.eclipse.as.management.as7.deployment.JBoss7ManagerService"/>
<service>
- <provide interface="org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7Manager"/>
+ <provide interface="org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService"/>
</service>
<property name="as.version" type="String" value="700"/>
</scr:component>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java 2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -43,10 +43,16 @@
*/
public class AS7Manager {
+ public static final int MGMT_PORT = 9999;
+
private ModelControllerClient client;
private ServerDeploymentManager manager;
- public AS7Manager(String host, int port) throws UnknownHostException {
+ public AS7Manager(String host) throws UnknownHostException {
+ this(host, MGMT_PORT);
+ }
+
+ public AS7Manager(String host, int port) throws UnknownHostException {
this.client = ModelControllerClient.Factory.create(host, port);
this.manager = ServerDeploymentManager.Factory.create(client);
}
@@ -139,7 +145,7 @@
*
* @throws JBoss7ManangerException
*/
- public void stop() throws JBoss7ManangerException {
+ public void stopServer() throws JBoss7ManangerException {
ModelNode request = new ModelNode();
request.get(OP).set(SHUTDOWN);
quietlyExecute(request);
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java 2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.management.as7.deployment;
-
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ADD;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ADDRESS;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.DEPLOYMENT;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ENABLED;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.INPUT_STREAM_INDEX;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.OP;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.REMOVE;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.UNDEPLOY;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.List;
-import java.util.concurrent.CancellationException;
-
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.Operation;
-import org.jboss.as.controller.client.OperationBuilder;
-import org.jboss.as.protocol.StreamUtils;
-import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
-
-/**
- * @author André Dietisheim
- */
-public class DetypedDeployer {
-
- public static void undeploy(String name, String host, int port) throws JBoss7ManangerException {
- ModelControllerClient client = null;
- try {
- client = ModelControllerClient.Factory.create(host, port);
- // undeploy
- ModelNode request = new ModelNode();
- request.get(OP).set(UNDEPLOY);
- request.get(ADDRESS).add(DEPLOYMENT, name);
- ModelNode result = client.execute(request);
- throwOnFailure(result);
-
- remove(name, host, port);
-
- } catch (Exception e) {
- throw new JBoss7ManangerException(e);
- } finally {
- StreamUtils.safeClose(client);
- }
- }
-
- public static void remove(String name, String host, int port) throws JBoss7ManangerException {
- ModelControllerClient client = null;
- try {
- client = ModelControllerClient.Factory.create(host, port);
-
- // remove
- ModelNode request = new ModelNode();
- request.get(OP).set(REMOVE);
- request.get(ADDRESS).add(DEPLOYMENT, name);
- client.execute(request);
- } catch (Exception e) {
- throw new JBoss7ManangerException(e);
- } finally {
- StreamUtils.safeClose(client);
- }
- }
-
- public static void deploy(File file, String host, int port) throws JBoss7ManangerException {
- deploy(file.getName(), file, host, port);
- }
-
- public static void deploy(String name, File file, String host, int port) throws JBoss7ManangerException {
- ModelControllerClient client = null;
- try {
- client = ModelControllerClient.Factory.create(host, port);
-
- ModelNode request = new ModelNode();
- request.get(OP).set(ADD);
- request.get(ADDRESS).add(DEPLOYMENT, name);
- request.get(ENABLED).set(true);
-
- OperationBuilder builder = OperationBuilder.Factory.create(request);
- builder.addInputStream(new BufferedInputStream(new FileInputStream(file)));
- Operation operation = builder.build();
- request.get(INPUT_STREAM_INDEX).set(0);
-
- ModelNode result = client.execute(operation);
- System.out.println(result);
-
- throwOnFailure(result);
- } catch (Exception e) {
- throw new JBoss7ManangerException(e);
- } finally {
- StreamUtils.safeClose(client);
- }
- }
-
- public static void replace(String name, File file, String host, int port) throws JBoss7ManangerException {
- ModelControllerClient client = null;
- try {
- client = ModelControllerClient.Factory.create(host, port);
-
- ModelNode request = new ModelNode();
- request.get("operation").set("full-replace-deployment");
- request.get("name").set(name);
-
- OperationBuilder builder = OperationBuilder.Factory.create(request);
- builder.addInputStream(new BufferedInputStream(new FileInputStream(file)));
- Operation operation = builder.build();
- request.get("input-stream-index").set(0);
-
- ModelNode result = client.execute(operation);
-
- throwOnFailure(result);
- } catch (Exception e) {
- throw new JBoss7ManangerException(e);
- } finally {
- StreamUtils.safeClose(client);
- }
- }
-
- public static boolean isDeployed(String name, String host, int port) throws CancellationException, IOException {
- ModelControllerClient client = ModelControllerClient.Factory.create(host, port);
- try {
- return AS7ManagerUtil.isDeployed(name, client);
- } finally {
- StreamUtils.safeClose(client);
- }
- }
-
- public static List<String> getDeployments(String host, int port) throws UnknownHostException {
- ModelControllerClient client = ModelControllerClient.Factory.create(host, port);
- return AS7ManagerUtil.getDeployments(client);
- }
-
- private static void throwOnFailure(ModelNode result) throws JBoss7ManangerException {
- if (!AS7ManagerUtil.isSuccess(result)) {
- throw new JBoss7ManangerException(AS7ManagerUtil.getFailureDescription(result));
- }
- }
-
- private DetypedDeployer() {
- // inhibit instantiation
- }
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7Manager.java 2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7Manager.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.management.as7.deployment;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7Manager;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
-
-/**
- * @author Rob Stryker
- */
-public class JBoss7Manager implements IJBoss7Manager {
-
- public IJBoss7DeploymentResult deployAsync(String host, int port, String deploymentName,
- File file, IProgressMonitor monitor) throws Exception {
- AS7Manager manager = new AS7Manager(host, port);
- return manager.deploy(deploymentName, file);
- }
-
- public IJBoss7DeploymentResult deploySync(String host, int port, String deploymentName,
- File file, IProgressMonitor monitor) throws Exception {
- AS7Manager manager = new AS7Manager(host, port);
- return manager.deploySync(deploymentName, file, monitor);
- }
-
- public IJBoss7DeploymentResult undeployAsync(String host, int port, String deploymentName,
- boolean removeFile, IProgressMonitor monitor) throws Exception {
- AS7Manager manager = new AS7Manager(host, port);
- return manager.undeploy(deploymentName);
- }
-
- public IJBoss7DeploymentResult syncUndeploy(String host, int port, String deploymentName,
- boolean removeFile, IProgressMonitor monitor) throws Exception {
- AS7Manager manager = new AS7Manager(host, port);
- return manager.undeploySync(deploymentName, monitor);
- }
-
- public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception {
- AS7Manager manager = new AS7Manager(host, port);
- return manager.getDeploymentState(deploymentName);
- }
-
- public void stop(String host, int port) throws Exception {
- new AS7Manager(host, port).stop();
- }
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java (from rev 30870, trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7Manager.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.management.as7.deployment;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
+
+/**
+ * @author Rob Stryker
+ */
+public class JBoss7ManagerService implements IJBoss7ManagerService {
+
+ public IJBoss7DeploymentResult deployAsync(String host, int port, String deploymentName,
+ File file, IProgressMonitor monitor) throws Exception {
+ AS7Manager manager = new AS7Manager(host, port);
+ return manager.deploy(deploymentName, file);
+ }
+
+ public IJBoss7DeploymentResult deploySync(String host, int port, String deploymentName,
+ File file, IProgressMonitor monitor) throws Exception {
+ AS7Manager manager = new AS7Manager(host, port);
+ return manager.deploySync(deploymentName, file, monitor);
+ }
+
+ public IJBoss7DeploymentResult undeployAsync(String host, int port, String deploymentName,
+ boolean removeFile, IProgressMonitor monitor) throws Exception {
+ AS7Manager manager = new AS7Manager(host, port);
+ return manager.undeploy(deploymentName);
+ }
+
+ public IJBoss7DeploymentResult syncUndeploy(String host, int port, String deploymentName,
+ boolean removeFile, IProgressMonitor monitor) throws Exception {
+ AS7Manager manager = new AS7Manager(host, port);
+ return manager.undeploySync(deploymentName, monitor);
+ }
+
+ public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception {
+ AS7Manager manager = new AS7Manager(host, port);
+ return manager.getDeploymentState(deploymentName);
+ }
+
+ public void stop(String host) throws Exception {
+ new AS7Manager(host).stopServer();
+ }
+
+ public void stop(String host, int port) throws Exception {
+ new AS7Manager(host, port).stopServer();
+ }
+
+ @Override
+ public void dispose() {
+ }
+}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerIntegrationTest.java 2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerIntegrationTest.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -41,9 +41,9 @@
@Before
public void setUp() throws IOException {
assertTrue("There is no server at " + AS7ManagerTestUtils.HOST +
- " that listens on port " + AS7ManagerTestUtils.MGMT_PORT,
- AS7ManagerTestUtils.isListening(AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT));
- this.manager = new AS7Manager(AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
+ " that listens on port " + AS7Manager.MGMT_PORT,
+ AS7ManagerTestUtils.isListening(AS7ManagerTestUtils.HOST, AS7Manager.MGMT_PORT));
+ this.manager = new AS7Manager(AS7ManagerTestUtils.HOST, AS7Manager.MGMT_PORT);
}
@After
@@ -160,9 +160,11 @@
}
@Test
- public void canShutdown() throws JBoss7ManangerException, UnknownHostException, IOException {
- assertTrue(AS7ManagerTestUtils.isListening(AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT));
- manager.stop();
- assertFalse(AS7ManagerTestUtils.isListening(AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT));
+ public void canStopServer() throws JBoss7ManangerException, UnknownHostException, IOException {
+ assertTrue(
+ AS7ManagerTestUtils.isListening(AS7ManagerTestUtils.HOST, AS7Manager.MGMT_PORT));
+ manager.stopServer();
+ assertFalse(
+ AS7ManagerTestUtils.isListening(AS7ManagerTestUtils.HOST, AS7Manager.MGMT_PORT));
}
}
\ No newline at end of file
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerTestUtils.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerTestUtils.java 2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerTestUtils.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -39,7 +39,6 @@
public static final String MINIMALISTIC_WAR = "minimalistic.war";
public static final String HOST = "localhost";
- public static final int MGMT_PORT = 9999;
public static final int WEB_PORT = 8080;
private static final String WAR_FOLDER = "/wars/";
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java 2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.management.as7.tests;
-
-import static org.hamcrest.Matchers.hasItems;
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.util.List;
-
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
-import org.jboss.ide.eclipse.as.management.as7.deployment.DetypedDeployer;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class DetypedDeployerIntegrationTest {
-
- @Test
- public void canDeploy() throws Exception {
- File warFile = AS7ManagerTestUtils.getWarFile(AS7ManagerTestUtils.MINIMALISTIC_WAR);
- try {
- DetypedDeployer.deploy(warFile, AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
-
- String response = AS7ManagerTestUtils.waitForRespose("minimalistic", AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.WEB_PORT);
- assertTrue(response.indexOf("minimalistic") >= 0);
-
- } finally {
- quietlyUndeploy(warFile);
- }
- }
-
- @Test(expected = JBoss7ManangerException.class)
- public void cannotDeployWarTwice() throws Exception {
- File warFile = AS7ManagerTestUtils.getWarFile(AS7ManagerTestUtils.MINIMALISTIC_WAR);
- try {
- DetypedDeployer.deploy(warFile, AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
- DetypedDeployer.deploy(warFile, AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
- } finally {
- quietlyUndeploy(warFile);
- }
- }
-
- @Test
- public void canReplaceWar() throws Exception {
- File warFile = AS7ManagerTestUtils.getWarFile(AS7ManagerTestUtils.MINIMALISTIC_WAR);
- File warFile2 = AS7ManagerTestUtils.getWarFile(AS7ManagerTestUtils.GWT_HELLOWORLD_WAR);
- String name = warFile.getName();
- try {
- DetypedDeployer.deploy(name, warFile, AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
- DetypedDeployer.replace(name, warFile2, AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
- String response = AS7ManagerTestUtils.waitForRespose(
- "minimalistic", AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.WEB_PORT);
- assertTrue(response.indexOf("GWT") >= 0);
- } finally {
- quietlyUndeploy(warFile);
- }
- }
-
- @Test(expected = JBoss7ManangerException.class)
- public void cannotUndeployNondeployed() throws JBoss7ManangerException {
- DetypedDeployer.undeploy("inexistant", AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
- }
-
- @Test
- public void canQueryDeploymentdeployedState() throws Exception {
- File warFile = AS7ManagerTestUtils.getWarFile(AS7ManagerTestUtils.MINIMALISTIC_WAR);
- File warFile2 = AS7ManagerTestUtils.getWarFile(AS7ManagerTestUtils.GWT_HELLOWORLD_WAR);
- try {
- DetypedDeployer.deploy(warFile, AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
- DetypedDeployer.deploy(warFile2, AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
- List<String> deployments = DetypedDeployer.getDeployments(AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
- assertThat(deployments.size(), is(2));
- assertThat(deployments, hasItems(AS7ManagerTestUtils.MINIMALISTIC_WAR, AS7ManagerTestUtils.GWT_HELLOWORLD_WAR));
- } finally {
- quietlyUndeploy(warFile);
- quietlyUndeploy(warFile2);
- }
- }
-
- private void quietlyUndeploy(File file) {
- try {
- DetypedDeployer.undeploy(file.getName(), AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
- } catch (Exception e) {
- e.printStackTrace();
- // ignore
- }
- }
-}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementServiceIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementServiceIntegrationTest.java 2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementServiceIntegrationTest.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -14,7 +14,7 @@
import java.net.UnknownHostException;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7Manager;
+import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -43,10 +43,10 @@
public void serviceIsReachable() throws BundleException {
ensureDSIsRunning();
BundleContext context = Activator.getContext();
- ServiceReference<IJBoss7Manager> reference =
- context.getServiceReference(IJBoss7Manager.class);
+ ServiceReference<IJBoss7ManagerService> reference =
+ context.getServiceReference(IJBoss7ManagerService.class);
assertNotNull(reference);
- IJBoss7Manager service = context.getService(reference);
+ IJBoss7ManagerService service = context.getService(reference);
assertNotNull(service);
}
@@ -56,7 +56,7 @@
Bundle bundle = getDSBundle();
assertNotNull(
DS_BUNDLEID + " not installed. You have to install the declarative services daemon so that "
- + IJBoss7Manager.class + " service is registered"
+ + IJBoss7ManagerService.class + " service is registered"
, bundle);
if (bundle.getState() != Bundle.ACTIVE) {
bundle.start();
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-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java 2011-04-28 09:06:49 UTC (rev 30897)
@@ -7,10 +7,10 @@
import java.util.Hashtable;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7Manager;
import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManagerProxy;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManagerServiceProxy;
import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
import org.jboss.ide.eclipse.as.test.ASTest;
import org.junit.Test;
@@ -22,10 +22,10 @@
@Test
public void canUseService() throws JBoss7ManangerException, InvalidSyntaxException {
BundleContext context = ASTest.getContext();
- JBoss7ManagerProxy serviceProxy = new JBoss7ManagerProxy(context,
- IJBoss7Manager.AS_VERSION_700);
+ JBoss7ManagerServiceProxy serviceProxy = new JBoss7ManagerServiceProxy(context,
+ IJBoss7ManagerService.AS_VERSION_700);
serviceProxy.open();
- IJBoss7Manager manager = serviceProxy.getService();
+ IJBoss7ManagerService manager = serviceProxy.getService();
assertNotNull(manager);
}
@@ -33,10 +33,10 @@
public void canUseServiceEvenIfAlternativeIsRegistered() throws JBoss7ManangerException, InvalidSyntaxException {
BundleContext context = ASTest.getDefault().getBundle().getBundleContext();
registerFakeASService("710");
- JBoss7ManagerProxy serviceProxy =
- new JBoss7ManagerProxy(context, IJBoss7Manager.AS_VERSION_700);
+ JBoss7ManagerServiceProxy serviceProxy =
+ new JBoss7ManagerServiceProxy(context, IJBoss7ManagerService.AS_VERSION_700);
serviceProxy.open();
- IJBoss7Manager manager = serviceProxy.getService();
+ IJBoss7ManagerService manager = serviceProxy.getService();
assertNotNull(manager);
}
@@ -44,22 +44,22 @@
public void canUseAlternative() throws Exception {
BundleContext context = ASTest.getDefault().getBundle().getBundleContext();
registerFakeASService("710");
- JBoss7ManagerProxy managerProxy =
- new JBoss7ManagerProxy(context, "710");
+ JBoss7ManagerServiceProxy managerProxy =
+ new JBoss7ManagerServiceProxy(context, "710");
managerProxy.open();
- IJBoss7Manager manager = managerProxy.getService();
+ IJBoss7ManagerService manager = managerProxy.getService();
assertNotNull(manager);
manager.getDeploymentState("fake", 4242, "fake");
}
private void registerFakeASService(String version) {
Dictionary<String, String> serviceProperties = new Hashtable<String, String>();
- serviceProperties.put(IJBoss7Manager.AS_VERSION_PROPERTY, version);
- ASTest.getContext().registerService(IJBoss7Manager.class, new JBoss71Manager(),
+ serviceProperties.put(IJBoss7ManagerService.AS_VERSION_PROPERTY, version);
+ ASTest.getContext().registerService(IJBoss7ManagerService.class, new JBoss71Manager(),
serviceProperties);
}
- private static class JBoss71Manager implements IJBoss7Manager {
+ private static class JBoss71Manager implements IJBoss7ManagerService {
public IJBoss7DeploymentResult deployAsync(String host, int port, String deploymentName, File file,
IProgressMonitor monitor) throws JBoss7ManangerException {
@@ -88,5 +88,12 @@
public void stop(String host, int port) throws JBoss7ManangerException {
}
+
+ public void stop(String host) throws JBoss7ManangerException {
+ }
+
+ @Override
+ public void dispose() {
+ }
}
}
14 years, 11 months
JBoss Tools SVN: r30896 - in trunk/as/plugins: org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-04-28 03:50:07 -0400 (Thu, 28 Apr 2011)
New Revision: 30896
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathCorePlugin.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java
Log:
AS7 - classpath work. Classpath container now resolves but suffers from same issue as AS-6, too many open files
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/plugin.xml 2011-04-28 07:20:06 UTC (rev 30895)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/plugin.xml 2011-04-28 07:50:07 UTC (rev 30896)
@@ -94,6 +94,13 @@
<factory class="org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectRuntimeClasspathProvider$Factory"/>
<type class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/>
</adapter>
+
+ <adapter>
+ <runtime-component
+ id="org.jboss.ide.eclipse.as.runtime.component" version="7.0"/>
+ <factory class="org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectRuntimeClasspathProvider$Factory"/>
+ <type class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/>
+ </adapter>
<adapter>
<runtime-component
@@ -124,7 +131,7 @@
<extension point="org.eclipse.jst.server.core.runtimeClasspathProviders">
<runtimeClasspathProvider
id="org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget"
- runtimeTypeIds="org.jboss.ide.eclipse.as.runtime.32, org.jboss.ide.eclipse.as.runtime.40, org.jboss.ide.eclipse.as.runtime.42,org.jboss.ide.eclipse.as.runtime.50,org.jboss.ide.eclipse.as.runtime.51,org.jboss.ide.eclipse.as.runtime.60,org.jboss.ide.eclipse.as.runtime.eap.43,org.jboss.ide.eclipse.as.runtime.eap.50"
+ runtimeTypeIds="org.jboss.ide.eclipse.as.runtime.32, org.jboss.ide.eclipse.as.runtime.40, org.jboss.ide.eclipse.as.runtime.42,org.jboss.ide.eclipse.as.runtime.50,org.jboss.ide.eclipse.as.runtime.51,org.jboss.ide.eclipse.as.runtime.60,org.jboss.ide.eclipse.as.runtime.70,org.jboss.ide.eclipse.as.runtime.eap.43,org.jboss.ide.eclipse.as.runtime.eap.50"
class="org.jboss.ide.eclipse.as.classpath.core.runtime.ClientAllRuntimeClasspathProvider"/>
</extension>
<extension
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathCorePlugin.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathCorePlugin.java 2011-04-28 07:20:06 UTC (rev 30895)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathCorePlugin.java 2011-04-28 07:50:07 UTC (rev 30896)
@@ -115,13 +115,9 @@
return null;
IJBossServerRuntime jbsrt = (IJBossServerRuntime)runtime.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
- if( jbsrt == null ) {
- return null;
- }
-
IPath loc = runtime.getLocation();
- IPath configPath = jbsrt.getConfigurationFullPath();
String rtID = runtime.getRuntimeType().getId();
+ IPath configPath = jbsrt == null ? null : jbsrt.getConfigurationFullPath();
return new RuntimeKey(loc, configPath, rtID);
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java 2011-04-28 07:20:06 UTC (rev 30895)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java 2011-04-28 07:50:07 UTC (rev 30896)
@@ -135,6 +135,8 @@
if(AS_60.equals(rtID)) list = get60(loc,configPath);
if(EAP_50.equals(rtID)) list = get50(loc,configPath);
+ if( AS_70.equals(rtID)) list = get70(loc);
+
if( list == null ) {
runtimeClasspath = new IClasspathEntry[0];
} else {
@@ -207,21 +209,33 @@
return list;
}
+ protected Set<Entry> get70(IPath location) {
+ Set<Entry> list = new HashSet<Entry>();
+ addPaths(location.append(AS7_MODULES), list, true);
+ return list;
+ }
+
protected IClasspathEntry getEntry(Entry entry) {
return JavaRuntime.newArchiveRuntimeClasspathEntry(entry.getPath()).getClasspathEntry();
}
protected void addPaths(IPath folder, Set<Entry> list) {
+ addPaths(folder, list, false);
+ }
+
+ protected void addPaths(IPath folder, Set<Entry> list, boolean recurse) {
if( folder.toFile().exists()) {
File f = folder.toFile();
if(f.isDirectory()) {
- String[] files = f.list();
- for( int i = 0; i < files.length; i++ ) {
- if( files[i].endsWith(EXT_JAR) && ClientAllFilter.accepts(folder.append(files[i]))) {
- addSinglePath(folder.append(files[i]), list);
+ File[] asFiles = f.listFiles();
+ for( int i = 0; i < asFiles.length; i++ ) {
+ if( asFiles[i].getName().endsWith(EXT_JAR) && ClientAllFilter.accepts(folder.append(asFiles[i].getName()))) {
+ addSinglePath(folder.append(asFiles[i].getName()), list);
+ } else if( recurse && asFiles[i].isDirectory()) {
+ addPaths(folder.append(asFiles[i].getName()), list, true);
}
}
- } else { // folder is a file, not a folder
+ } else { // item is a file, not a folder
addSinglePath(folder, list);
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java 2011-04-28 07:20:06 UTC (rev 30895)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java 2011-04-28 07:50:07 UTC (rev 30896)
@@ -28,6 +28,7 @@
public static final String NATIVE = "native"; //$NON-NLS-1$
public static final String AS7_STANDALONE = "standalone";//$NON-NLS-1$
public static final String AS7_DEPLOYMENTS = "deployments";//$NON-NLS-1$
+ public static final String AS7_MODULES = "modules";//$NON-NLS-1$
public static final String[] JBOSS_TEMPORARY_FOLDERS = new String[] { WORK, DATA, FOLDER_TMP, FOLDER_LOG};
14 years, 11 months
JBoss Tools SVN: r30895 - in trunk/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-04-28 03:20:06 -0400 (Thu, 28 Apr 2011)
New Revision: 30895
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7ServerWizardFragment.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7ServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.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/editor/DeploymentModuleOptionCompositeAssistant.java
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/plugin.xml
Log:
AS7 work, heavy lifting, wizard / editor / desperate for "functioning" status
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerRuntime.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerRuntime.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerRuntime.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -16,15 +16,16 @@
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
import org.eclipse.wst.server.core.IRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.AbstractLocalJBossServerRuntime;
/**
*
* @author Rob Stryker
*/
public interface IJBossServerRuntime {
- public static String PROPERTY_VM_ID = "PROPERTY_VM_ID"; //$NON-NLS-1$
- public static String PROPERTY_VM_TYPE_ID = "PROPERTY_VM_TYPE_ID"; //$NON-NLS-1$
- public static String PROPERTY_EXECUTION_ENVIRONMENT = "PROPERTY_EXEC_ENVIRONMENT"; //$NON-NLS-1$
+ public static String PROPERTY_VM_ID = AbstractLocalJBossServerRuntime.PROPERTY_VM_ID;
+ public static String PROPERTY_VM_TYPE_ID = AbstractLocalJBossServerRuntime.PROPERTY_VM_TYPE_ID;
+ public static String PROPERTY_EXECUTION_ENVIRONMENT =AbstractLocalJBossServerRuntime.PROPERTY_EXECUTION_ENVIRONMENT;
public static String PROPERTY_CONFIGURATION_NAME = "org.jboss.ide.eclipse.as.core.runtime.configurationName"; //$NON-NLS-1$
public static String PROPERTY_CONFIG_LOCATION="org.jboss.ide.eclipse.as.core.runtime.configurationLocation"; //$NON-NLS-1$
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server.internal;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.internal.launching.environments.EnvironmentsManager;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstallType;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.model.RuntimeDelegate;
+import org.jboss.ide.eclipse.as.core.Messages;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.util.IConstants;
+
+public abstract class AbstractLocalJBossServerRuntime extends RuntimeDelegate {
+ public static String PROPERTY_VM_ID = "PROPERTY_VM_ID"; //$NON-NLS-1$
+ public static String PROPERTY_VM_TYPE_ID = "PROPERTY_VM_TYPE_ID"; //$NON-NLS-1$
+ public static String PROPERTY_EXECUTION_ENVIRONMENT = "PROPERTY_EXEC_ENVIRONMENT"; //$NON-NLS-1$
+
+ public void setDefaults(IProgressMonitor monitor) {
+ getRuntimeWorkingCopy().setName(getNextRuntimeName());
+ setExecutionEnvironment(getDefaultExecutionEnvironment(getRuntime().getRuntimeType()));
+ setVM(null);
+ }
+
+ protected String getNextRuntimeName() {
+ String version = getRuntime().getRuntimeType().getVersion();
+ String base = Messages.jboss + " " + version + " " + Messages.runtime; //$NON-NLS-1$//$NON-NLS-2$
+ return getNextRuntimeName(base);
+ }
+
+ public abstract String getDefaultRunArgs();
+ public abstract String getDefaultRunVMArgs();
+
+ public static String getNextRuntimeName(String base) {
+ IRuntime rt = ServerCore.findRuntime(base);
+ if (rt == null)
+ return base;
+
+ int i = 0;
+ while (rt != null) {
+ rt = ServerCore.findRuntime(base + " " + ++i); //$NON-NLS-1$
+ }
+ return base + " " + i; //$NON-NLS-1$
+ }
+
+ public IVMInstall getVM() {
+ if (getVMInstallTypeId() != null) {
+ String id = getAttribute(PROPERTY_VM_ID, (String)null);
+ String type = getAttribute(PROPERTY_VM_TYPE_ID, (String)null);
+
+ IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(type);
+ IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
+
+ for (int i = 0; i < vmInstalls.length; i++) {
+ if (id.equals(vmInstalls[i].getId()))
+ return vmInstalls[i];
+ }
+ }
+ if( getExecutionEnvironment() != null ) {
+ IVMInstall[] installs = getExecutionEnvironment().getCompatibleVMs();
+ if( getExecutionEnvironment().getDefaultVM() != null )
+ return getExecutionEnvironment().getDefaultVM();
+ if( installs != null && installs.length > 0 && installs[0] != null )
+ return installs[0];
+ }
+ // not found, return default vm
+ return getDefaultVMInstall();
+ }
+
+ public void setVM(IVMInstall selectedVM) {
+ if (selectedVM == null) {
+ setAttribute(IJBossServerRuntime.PROPERTY_VM_ID, (String) null);
+ setAttribute(IJBossServerRuntime.PROPERTY_VM_TYPE_ID, (String) null);
+ } else {
+ setAttribute(IJBossServerRuntime.PROPERTY_VM_ID, selectedVM.getId());
+ setAttribute(IJBossServerRuntime.PROPERTY_VM_TYPE_ID, selectedVM
+ .getVMInstallType().getId());
+ }
+ }
+
+ public boolean isUsingDefaultJRE() {
+ return getVMInstallTypeId() == null;
+ }
+
+ protected String getVMInstallTypeId() {
+ return getAttribute(PROPERTY_VM_TYPE_ID, (String)null);
+ }
+
+ protected IVMInstall getDefaultVMInstall() {
+ return getExecutionEnvironment().getDefaultVM();
+ }
+
+ public static IVMInstall[] getValidJREs(IRuntimeType type) {
+ return getDefaultExecutionEnvironment(type) == null ? new IVMInstall[0]
+ : getDefaultExecutionEnvironment(type).getCompatibleVMs();
+ }
+
+ public IExecutionEnvironment getExecutionEnvironment() {
+ String id = getAttribute(PROPERTY_EXECUTION_ENVIRONMENT, (String)null);
+ return id == null ? getDefaultExecutionEnvironment(getRuntime().getRuntimeType()) :
+ EnvironmentsManager.getDefault().getEnvironment(id);
+ }
+
+ public static IExecutionEnvironment getDefaultExecutionEnvironment(IRuntimeType rtType) {
+ String typeId = rtType.getId();
+ if( typeId.equals(IConstants.EAP_50) || typeId.equals(IConstants.AS_60)) {
+ return EnvironmentsManager.getDefault().getEnvironment("JavaSE-1.6"); //$NON-NLS-1$
+ }
+ return EnvironmentsManager.getDefault().getEnvironment("J2SE-1.4"); //$NON-NLS-1$
+ }
+
+ public void setExecutionEnvironment(IExecutionEnvironment environment) {
+ setAttribute(PROPERTY_EXECUTION_ENVIRONMENT, environment.getId());
+ }
+
+
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -82,7 +82,7 @@
/**
* No changes will be made to this API and new server
- * types are expected to subclass the getDeployFolder() api's
+ * types are expected to override the getDeployFolder() api's
*
* @param jbs
* @param type
@@ -96,7 +96,7 @@
String val = jbs.getAttribute(DEPLOY_DIRECTORY, (String)null);
if( val != null ) {
IPath val2 = new Path(val);
- return ServerUtil.makeGlobal(jbsrt, val2).toString();
+ return ServerUtil.makeGlobal(jbsrt.getRuntime(), val2).toString();
}
// if no value is set, default to metadata
type = DEPLOY_METADATA;
@@ -109,7 +109,7 @@
String config = jbsrt.getJBossConfiguration();
IPath p = new Path(loc).append(config)
.append(IJBossServerConstants.DEPLOY);
- return ServerUtil.makeGlobal(jbsrt, p).toString();
+ return ServerUtil.makeGlobal(jbsrt.getRuntime(), p).toString();
}
return null;
}
@@ -118,11 +118,13 @@
return getTempDeployFolder(this, getDeployLocationType());
}
+ @Deprecated
public static String getTempDeployFolder(JBossServer jbs, String type) {
IServer server = jbs.getServer();
IJBossServerRuntime jbsrt = getRuntime(server);
if( type.equals(DEPLOY_CUSTOM))
- return ServerUtil.makeGlobal(jbsrt, new Path(server.getAttribute(TEMP_DEPLOY_DIRECTORY, ""))).toString(); //$NON-NLS-1$
+ return ServerUtil.makeGlobal(jbsrt.getRuntime(),
+ new Path(server.getAttribute(TEMP_DEPLOY_DIRECTORY, ""))).toString(); //$NON-NLS-1$
if( type.equals(DEPLOY_METADATA)) {
return JBossServerCorePlugin.getServerStateLocation(server).
append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute().toString();
@@ -132,7 +134,7 @@
IPath p = new Path(loc)
.append(config).append(IJBossServerConstants.TMP)
.append(IJBossServerConstants.JBOSSTOOLS_TMP);
- return ServerUtil.makeGlobal(jbsrt, p).toString();
+ return ServerUtil.makeGlobal(jbsrt.getRuntime(), p).toString();
}
return null;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -40,7 +40,7 @@
public IStatus canChangeState(String launchMode);
}
- public static HashMap<String, Class> delegateClassMap;
+ private static HashMap<String, Class> delegateClassMap;
static {
delegateClassMap = new HashMap<String, Class>();
delegateClassMap.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD, LocalJBossBehaviorDelegate.class);
@@ -61,9 +61,9 @@
if( id.equals(lastModeId) && delegate != null && delegate.getBehaviourTypeId().equals(id))
return delegate;
- Class c = delegateClassMap.get(id);
+ Class c = getDelegateMap().get(id);
if( c == null )
- c = delegateClassMap.get(LocalPublishMethod.LOCAL_PUBLISH_METHOD);
+ c = getDelegateMap().get(LocalPublishMethod.LOCAL_PUBLISH_METHOD);
try {
JBossBehaviourDelegate o = (JBossBehaviourDelegate)c.newInstance();
@@ -76,6 +76,10 @@
return delegate;
}
+ protected HashMap<String, Class> getDelegateMap() {
+ return delegateClassMap;
+ }
+
public void stop(boolean force) {
getDelegate().stop(force);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossServerRuntime.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossServerRuntime.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossServerRuntime.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -18,16 +18,9 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.internal.launching.environments.EnvironmentsManager;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.IVMInstallType;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.model.RuntimeDelegate;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
@@ -35,46 +28,26 @@
import org.jboss.ide.eclipse.as.core.util.IConstants;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
-public class LocalJBossServerRuntime extends RuntimeDelegate implements IJBossServerRuntime {
+public class LocalJBossServerRuntime extends AbstractLocalJBossServerRuntime implements IJBossServerRuntime {
public void setDefaults(IProgressMonitor monitor) {
- getRuntimeWorkingCopy().setName(getNextRuntimeName());
+ super.setDefaults(monitor);
setAttribute(IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME, IJBossServerConstants.DEFAULT_CONFIGURATION);
- setExecutionEnvironment(getDefaultExecutionEnvironment(getRuntime().getRuntimeType()));
- setVM(null);
}
- private String getNextRuntimeName() {
- String version = getRuntime().getRuntimeType().getVersion();
- String base = null;
-
- // hack for eap 5.1, which is now using the 5.0 runtime type id
- if( isEAP(getRuntime()) && version.equals(IConstants.V5_0))
- version = "5.x"; //$NON-NLS-1$
-
- if( getRuntime().getRuntimeType().getId().startsWith("org.jboss.ide.eclipse.as.runtime.eap.")) { //$NON-NLS-1$
- base = Messages.jboss + " EAP " + version + " " + Messages.runtime; //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- base = Messages.jboss + " " + version + " " + Messages.runtime; //$NON-NLS-1$//$NON-NLS-2$
+ protected String getNextRuntimeName() {
+ if( isEAP(getRuntime())) {
+ String version = "5.x"; //$NON-NLS-1$
+ String base = Messages.jboss + " EAP " + version + " " + Messages.runtime; //$NON-NLS-1$ //$NON-NLS-2$
+ return getNextRuntimeName(base);
}
- return getNextRuntimeName(base);
+ return super.getNextRuntimeName();
}
+
public static boolean isEAP(IRuntime rt) {
return rt.getRuntimeType().getId().startsWith("org.jboss.ide.eclipse.as.runtime.eap."); //$NON-NLS-1$
}
- public static String getNextRuntimeName(String base) {
- IRuntime rt = ServerCore.findRuntime(base);
- if (rt == null)
- return base;
-
- int i = 0;
- while (rt != null) {
- rt = ServerCore.findRuntime(base + " " + ++i); //$NON-NLS-1$
- }
- return base + " " + i; //$NON-NLS-1$
- }
-
public IStatus validate() {
IStatus s = super.validate();
if( !s.isOK()) return s;
@@ -85,42 +58,7 @@
return Status.OK_STATUS;
}
-
- public IVMInstall getVM() {
- if (getVMInstallTypeId() != null) {
- String id = getAttribute(PROPERTY_VM_ID, (String)null);
- String type = getAttribute(PROPERTY_VM_TYPE_ID, (String)null);
-
- IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(type);
- IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
-
- for (int i = 0; i < vmInstalls.length; i++) {
- if (id.equals(vmInstalls[i].getId()))
- return vmInstalls[i];
- }
- }
- if( getExecutionEnvironment() != null ) {
- IVMInstall[] installs = getExecutionEnvironment().getCompatibleVMs();
- if( getExecutionEnvironment().getDefaultVM() != null )
- return getExecutionEnvironment().getDefaultVM();
- if( installs != null && installs.length > 0 && installs[0] != null )
- return installs[0];
- }
- // not found, return default vm
- return getDefaultVMInstall();
- }
-
- public void setVM(IVMInstall selectedVM) {
- if (selectedVM == null) {
- setAttribute(IJBossServerRuntime.PROPERTY_VM_ID, (String) null);
- setAttribute(IJBossServerRuntime.PROPERTY_VM_TYPE_ID, (String) null);
- } else {
- setAttribute(IJBossServerRuntime.PROPERTY_VM_ID, selectedVM.getId());
- setAttribute(IJBossServerRuntime.PROPERTY_VM_TYPE_ID, selectedVM
- .getVMInstallType().getId());
- }
- }
-
+
public String getJBossConfiguration() {
return getAttribute(PROPERTY_CONFIGURATION_NAME, (String)""); //$NON-NLS-1$
}
@@ -169,14 +107,6 @@
return envVars;
}
- public boolean isUsingDefaultJRE() {
- return getVMInstallTypeId() == null;
- }
-
- protected String getVMInstallTypeId() {
- return getAttribute(PROPERTY_VM_TYPE_ID, (String)null);
- }
-
public String getConfigLocation() {
return getAttribute(PROPERTY_CONFIG_LOCATION, IConstants.SERVER);
}
@@ -195,31 +125,4 @@
return new Path(cl);
return getRuntime().getLocation().append(cl);
}
-
- protected IVMInstall getDefaultVMInstall() {
- return getExecutionEnvironment().getDefaultVM();
- }
-
- public static IVMInstall[] getValidJREs(IRuntimeType type) {
- return getDefaultExecutionEnvironment(type) == null ? new IVMInstall[0]
- : getDefaultExecutionEnvironment(type).getCompatibleVMs();
- }
-
- public IExecutionEnvironment getExecutionEnvironment() {
- String id = getAttribute(PROPERTY_EXECUTION_ENVIRONMENT, (String)null);
- return id == null ? getDefaultExecutionEnvironment(getRuntime().getRuntimeType()) :
- EnvironmentsManager.getDefault().getEnvironment(id);
- }
-
- public static IExecutionEnvironment getDefaultExecutionEnvironment(IRuntimeType rtType) {
- String typeId = rtType.getId();
- if( typeId.equals(IConstants.EAP_50) || typeId.equals(IConstants.AS_60)) {
- return EnvironmentsManager.getDefault().getEnvironment("JavaSE-1.6"); //$NON-NLS-1$
- }
- return EnvironmentsManager.getDefault().getEnvironment("J2SE-1.4"); //$NON-NLS-1$
- }
-
- public void setExecutionEnvironment(IExecutionEnvironment environment) {
- setAttribute(PROPERTY_EXECUTION_ENVIRONMENT, environment.getId());
- }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.server.internal.launch;
-import java.io.File;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -28,10 +27,6 @@
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.jdt.core.IClasspathAttribute;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.internal.launching.RuntimeClasspathEntry;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.IVMInstall;
@@ -50,7 +45,6 @@
import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossBehaviorDelegate;
import org.jboss.ide.eclipse.as.core.server.internal.launch.JBossServerStartupLaunchConfiguration.IStartLaunchSetupParticipant;
import org.jboss.ide.eclipse.as.core.server.internal.launch.JBossServerStartupLaunchConfiguration.StartLaunchDelegate;
-import org.jboss.ide.eclipse.as.core.server.internal.launch.RunJarContainerWrapper.RunJarContainer;
import org.jboss.ide.eclipse.as.core.util.ArgsUtil;
import org.jboss.ide.eclipse.as.core.util.IConstants;
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -10,29 +10,53 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.server.internal.v7;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.core.util.ServerUtil;
public class JBoss7Server extends JBossServer implements IJBoss7Deployment {
public void setDefaults(IProgressMonitor monitor) {
super.setDefaults(monitor);
- setAttribute(DEPLOY_DIRECTORY_TYPE, DEPLOY_CUSTOM);
+ setAttribute(DEPLOY_DIRECTORY_TYPE, DEPLOY_SERVER);
setAttribute(IJBossToolingConstants.WEB_PORT_DETECT, false);
setAttribute(IJBossToolingConstants.WEB_PORT, IJBossToolingConstants.JBOSS_WEB_DEFAULT_PORT);
}
public boolean hasJMXProvider() {
return false;
}
+
+ @Override
+ public String getDeployLocationType() {
+ return getAttribute(DEPLOY_DIRECTORY_TYPE, DEPLOY_SERVER);
+ }
+
public String getDeployFolder(String type) {
if( type.equals(DEPLOY_SERVER) ) {
- // TODO make sure this is correct?! Upstream APIs have this wrong
+ // TODO make sure this is correct?! Upstream APIs have this wrong for as7
+ IRuntime rt = getServer().getRuntime();
+ IPath p = rt.getLocation().append(AS7_STANDALONE).append(AS7_DEPLOYMENTS);
+ return ServerUtil.makeGlobal(rt, p).toString();
}
return getDeployFolder(this, type);
}
+ // Just force it to be in metadata location, for now
+ public String getTempDeployFolder() {
+ IPath p = JBossServerCorePlugin.getServerStateLocation(getServer()).
+ append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute();
+ if( !p.toFile().exists()) {
+ p.toFile().mkdirs();
+ }
+ return p.toString();
+ }
+
public static boolean supportsJBoss7MarkerDeployment(IServer server) {
boolean retval = (server.loadAdapter(IJBoss7Deployment.class, new NullProgressMonitor()) != null);
return retval;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -11,6 +11,7 @@
package org.jboss.ide.eclipse.as.core.server.internal.v7;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import org.eclipse.core.runtime.CoreException;
@@ -22,11 +23,26 @@
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.wst.server.core.IModule;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
+import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossBehaviorDelegate;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
public class JBoss7ServerBehavior extends JBossServerBehavior {
+ private static HashMap<String, Class> delegateClassMap;
+ static {
+ delegateClassMap = new HashMap<String, Class>();
+ delegateClassMap.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD, LocalJBoss7BehaviorDelegate.class);
+ }
+ public static void addDelegateMapping(String s, Class c) {
+ delegateClassMap.put(s, c);
+ }
+ protected HashMap<String, Class> getDelegateMap() {
+ return delegateClassMap;
+ }
+
+
public void stop(boolean force) {
setServerStopped();
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server.internal.v7;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossBehaviorDelegate;
+
+public class LocalJBoss7BehaviorDelegate extends LocalJBossBehaviorDelegate {
+ public IStatus canChangeState(String launchMode) {
+ return Status.CANCEL_STATUS;
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7ServerRuntime.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7ServerRuntime.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7ServerRuntime.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -10,14 +10,30 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.server.internal.v7;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.AbstractLocalJBossServerRuntime;
-public class LocalJBoss7ServerRuntime extends LocalJBossServerRuntime {
- // TODO
+public class LocalJBoss7ServerRuntime extends AbstractLocalJBossServerRuntime {
@Override
+ public void setDefaults(IProgressMonitor monitor) {
+ super.setDefaults(monitor);
+ }
+ @Override
public IStatus validate() {
return Status.OK_STATUS;
}
+
+ @Override
+ public String getDefaultRunArgs() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getDefaultRunVMArgs() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -26,6 +26,9 @@
public static final String FOLDER_LOG = "log"; //$NON-NLS-1$
public static final String ENDORSED = "endorsed"; //$NON-NLS-1$
public static final String NATIVE = "native"; //$NON-NLS-1$
+ public static final String AS7_STANDALONE = "standalone";//$NON-NLS-1$
+ public static final String AS7_DEPLOYMENTS = "deployments";//$NON-NLS-1$
+
public static final String[] JBOSS_TEMPORARY_FOLDERS = new String[] { WORK, DATA, FOLDER_TMP, FOLDER_LOG};
public static final String TWIDDLE_JAR = "twiddle.jar"; //$NON-NLS-1$
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -37,20 +37,34 @@
.append(serverID.replace(' ', '_'));
}
+ @Deprecated
public static IPath makeRelative(IJBossServerRuntime rt, IPath p) {
+ if( rt.getRuntime() != null )
+ return makeRelative(rt.getRuntime(), p);
+ return p;
+ }
+
+ public static IPath makeRelative(IRuntime rt, IPath p) {
if( p.isAbsolute() && rt != null) {
- if(rt.getRuntime().getLocation().isPrefixOf(p)) {
- int size = rt.getRuntime().getLocation().toOSString().length();
+ if(rt.getLocation().isPrefixOf(p)) {
+ int size = rt.getLocation().toOSString().length();
return new Path(p.toOSString().substring(size)).makeRelative();
}
}
return p;
}
+ @Deprecated
public static IPath makeGlobal(IJBossServerRuntime rt, IPath p) {
+ if( rt.getRuntime() != null )
+ return makeGlobal(rt.getRuntime(), p);
+ return p;
+ }
+
+ public static IPath makeGlobal(IRuntime rt, IPath p) {
if( !p.isAbsolute() ) {
- if( rt != null && rt.getRuntime() != null && rt.getRuntime().getLocation() != null ) {
- return rt.getRuntime().getLocation().append(p).makeAbsolute();
+ if( rt != null && rt.getLocation() != null ) {
+ return rt.getLocation().append(p).makeAbsolute();
}
return p.makeAbsolute();
}
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-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -55,6 +55,7 @@
public static String rwf_Explanation;
public static String rwf_NameInUse;
public static String rwf_homeMissingFiles;
+ public static String rwf_jboss7homeNotValid;
public static String rwf_homeIncorrectVersion;
public static String rwf_nameTextBlank;
public static String rwf_homeDirBlank;
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-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2011-04-28 07:20:06 UTC (rev 30895)
@@ -14,6 +14,7 @@
rwf_Explanation=A JBoss Server runtime references a JBoss installation directory.\nIt can be used to set up classpaths for projects which depend on this runtime,\nas well as by a "server" which will be able to start and stop instances of JBoss.
rwf_NameInUse=Runtime name already in use
rwf_homeMissingFiles=The home directory does not exist or is missing the run.jar.
+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_nameTextBlank=The name field must not be blank
rwf_homeDirBlank=The directory field must not be blank
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -372,9 +372,9 @@
JBossServer jbs = ServerConverter.getJBossServer(page.getServer().getOriginal());
String newDir = getHelper().getAttribute(IDeployableServer.DEPLOY_DIRECTORY,
- jbs == null ? "" : jbs.getDeployFolder(jbs, getDeployType()));
+ jbs == null ? "" : jbs.getDeployFolder());
String newTemp = getHelper().getAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY,
- jbs == null ? "" : jbs.getTempDeployFolder(jbs, getDeployType()));
+ jbs == null ? "" : jbs.getTempDeployFolder());
deployText.removeModifyListener(deployListener);
deployText.setText(newDir);
deployText.addModifyListener(deployListener);
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7ServerWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7ServerWizardFragment.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7ServerWizardFragment.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -0,0 +1,98 @@
+package org.jboss.ide.eclipse.as.ui.wizards;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.TaskModel;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.ui.Messages;
+
+public class JBoss7ServerWizardFragment extends JBossRuntimeWizardFragment {
+
+ @Override
+ public boolean hasComposite() {
+ return true;
+ }
+
+ @Override
+ protected void updateModels() {
+ // Do nothing
+ }
+
+ @Override
+ protected void createWidgets(Composite main) {
+ createExplanation(main);
+ createNameComposite(main);
+ createHomeComposite(main);
+ }
+
+ protected void fillWidgets() {
+ IRuntime rt = (IRuntime)getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+ if (rt != null) {
+ try {
+ fillNameWidgets(rt);
+ fillHomeDir(rt);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ @Override
+ protected void updatePage() {
+ // Do Nothing
+ updateErrorMessage();
+ }
+
+ protected String getErrorString() {
+ if (nameText == null)
+ // not yet initialized. no errors
+ return null;
+
+ if (getRuntime(name) != null)
+ return Messages.rwf_NameInUse;
+
+ if (!isHomeValid())
+ return Messages.rwf_homeMissingFiles;
+
+ if (name == null || name.equals("")) //$NON-NLS-1$
+ return Messages.rwf_nameTextBlank;
+
+ return null;
+ }
+
+ @Override
+ protected boolean isHomeValid() {
+ if( homeDir == null || homeDir.equals("") || !(new File(homeDir).exists()))
+ return false;
+ return true;
+ }
+
+ @Override
+ protected String getVersionString(File loc) {
+ // TODO clean this up for later
+ return "7.0";
+ }
+
+ @Override
+ public void performFinish(IProgressMonitor monitor) throws CoreException {
+ IRuntime rt = (IRuntime)getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+ ((IRuntimeWorkingCopy)rt).setLocation(new Path(homeDir));
+ }
+
+ @Override
+ public void exit() {
+ IRuntime r = (IRuntime) getTaskModel()
+ .getObject(TaskModel.TASK_RUNTIME);
+ IRuntimeWorkingCopy runtimeWC = r.isWorkingCopy() ? ((IRuntimeWorkingCopy) r)
+ : r.createWorkingCopy();
+
+ runtimeWC.setName(name);
+ runtimeWC.setLocation(new Path(homeDir));
+ getTaskModel().putObject(TaskModel.TASK_RUNTIME, runtimeWC);
+ }
+}
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-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -95,49 +95,52 @@
*/
public class JBossRuntimeWizardFragment extends WizardFragment {
- private IWizardHandle handle;
- private boolean beenEntered = false;
+ protected IWizardHandle handle;
+ protected boolean beenEntered = false;
- private Label nameLabel, homeDirLabel,
+ protected Label nameLabel, homeDirLabel,
installedJRELabel, explanationLabel;
- private Text nameText, homeDirText;
- private Combo jreCombo;
- private int jreComboIndex;
- private Button homeDirButton, jreButton;
- private Composite nameComposite, homeDirComposite, jreComposite;
- private String name, homeDir;
+ protected Text nameText, homeDirText;
+ protected Combo jreCombo;
+ protected int jreComboIndex;
+ protected Button homeDirButton, jreButton;
+ protected Composite nameComposite, homeDirComposite, jreComposite;
+ protected String name, homeDir;
// Configuration stuff
- private Composite configComposite;
- private Group configGroup;
- private Label configDirLabel;
- private Text configDirText;
- private JBossConfigurationTableViewer configurations;
- private Button configCopy, configBrowse, configDelete;
- private String configDirTextVal;
+ protected Composite configComposite;
+ protected Group configGroup;
+ protected Label configDirLabel;
+ protected Text configDirText;
+ protected JBossConfigurationTableViewer configurations;
+ protected Button configCopy, configBrowse, configDelete;
+ protected String configDirTextVal;
// jre fields
protected List<IVMInstall> installedJREs;
protected String[] jreNames;
protected int defaultVMIndex;
- private IVMInstall selectedVM;
- private String originalName;
+ protected IVMInstall selectedVM;
+ protected String originalName;
public Composite createComposite(Composite parent, IWizardHandle handle) {
this.handle = handle;
-
Composite main = new Composite(parent, SWT.NONE);
main.setLayout(new FormLayout());
+ updateModels();
+ createWidgets(main);
+ fillWidgets();
+ updateWizardHandle(parent);
+ return main;
+ }
+
+ protected void updateModels() {
updateJREs();
- createExplanation(main);
- createNameComposite(main);
- createHomeComposite(main);
- createJREComposite(main);
- createConfigurationComposite(main);
- fillWidgets();
-
+ }
+
+ protected void updateWizardHandle(Composite parent) {
// make modifications to parent
IRuntime r = (IRuntime) getTaskModel()
.getObject(TaskModel.TASK_RUNTIME);
@@ -151,8 +154,15 @@
handle.setImageDescriptor(getImageDescriptor());
handle.setDescription(description);
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "org.jboss.ide.eclipse.as.doc.user.new_server_runtime"); //$NON-NLS-1$
- return main;
}
+
+ protected void createWidgets(Composite main) {
+ createExplanation(main);
+ createNameComposite(main);
+ createHomeComposite(main);
+ createJREComposite(main);
+ createConfigurationComposite(main);
+ }
protected boolean isEAP() {
IRuntime rt = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
@@ -164,61 +174,72 @@
return JBossServerUISharedImages.getImageDescriptor(imageKey);
}
- private void fillWidgets() {
- boolean canEdit = true;
-
- IJBossServerRuntime rt = getRuntime();
- if (rt != null) {
- originalName = rt.getRuntime().getName();
- nameText.setText(originalName);
- name = originalName;
+ protected void fillNameWidgets(IRuntime rt) {
+ originalName = rt.getName();
+ nameText.setText(originalName);
+ name = originalName;
+ }
+
+ protected void fillHomeDir(IRuntime rt) {
+ if( rt.getLocation() == null ) {
+ // new runtime creation
+ Preferences prefs = JBossServerUIPlugin.getDefault().getPluginPreferences();
+ String value = prefs.getString(IPreferenceKeys.RUNTIME_HOME_PREF_KEY_PREFIX + rt.getRuntimeType().getId());
- if( rt.getRuntime().getLocation() == null ) {
- // new runtime creation
- Preferences prefs = JBossServerUIPlugin.getDefault().getPluginPreferences();
- String value = prefs.getString(IPreferenceKeys.RUNTIME_HOME_PREF_KEY_PREFIX + rt.getRuntime().getRuntimeType().getId());
-
- String locationDefault = Platform.getOS().equals(Platform.WS_WIN32)
- ? "c:/program files/jboss-" : "/usr/bin/jboss-"; //$NON-NLS-1$ //$NON-NLS-2$
- String version = rt.getRuntime().getRuntimeType().getVersion();
- locationDefault += version + ".x"; //$NON-NLS-1$
-
- homeDir = (value != null && value.length() != 0) ? value : locationDefault;
- } else {
- // old runtime, load from it
- homeDir = rt.getRuntime().getLocation().toOSString();
- }
- homeDirText.setText(homeDir);
-
- ((IRuntimeWorkingCopy)rt.getRuntime()).setLocation(new Path(homeDir));
- String dirText = rt.getConfigLocation();
- configDirText.setText(dirText == null ? IConstants.SERVER : dirText);
- configurations.setConfiguration(rt.getJBossConfiguration() == null
- ? IConstants.DEFAULT_CONFIGURATION : rt.getJBossConfiguration());
-
- if (rt.isUsingDefaultJRE()) {
- jreCombo.select(0);
- } else {
- IVMInstall install = rt.getVM();
- if( install != null ) {
- String vmName = install.getName();
- String[] jres = jreCombo.getItems();
- for (int i = 0; i < jres.length; i++) {
- if (vmName.equals(jres[i]))
- jreCombo.select(i);
- }
+ String locationDefault = Platform.getOS().equals(Platform.WS_WIN32)
+ ? "c:/program files/jboss-" : "/usr/bin/jboss-"; //$NON-NLS-1$ //$NON-NLS-2$
+ String version = rt.getRuntimeType().getVersion();
+ locationDefault += version + ".x"; //$NON-NLS-1$
+ homeDir = (value != null && value.length() != 0) ? value : locationDefault;
+ } else {
+ // old runtime, load from it
+ homeDir = rt.getLocation().toOSString();
+ }
+ homeDirText.setText(homeDir);
+
+ ((IRuntimeWorkingCopy)rt).setLocation(new Path(homeDir));
+ homeDirText.setEditable(true);
+ homeDirButton.setEnabled(true);
+ }
+
+ protected void fillConfigWidgets(IJBossServerRuntime jbsrt) {
+ String dirText = jbsrt.getConfigLocation();
+ configDirText.setText(dirText == null ? IConstants.SERVER : dirText);
+ configurations.setConfiguration(jbsrt.getJBossConfiguration() == null
+ ? IConstants.DEFAULT_CONFIGURATION : jbsrt.getJBossConfiguration());
+ configurations.getTable().setVisible(true);
+ }
+
+ protected void fillJREWidgets(IJBossServerRuntime jbsrt) {
+ if (jbsrt.isUsingDefaultJRE()) {
+ jreCombo.select(0);
+ } else {
+ IVMInstall install = jbsrt.getVM();
+ if( install != null ) {
+ String vmName = install.getName();
+ String[] jres = jreCombo.getItems();
+ for (int i = 0; i < jres.length; i++) {
+ if (vmName.equals(jres[i]))
+ jreCombo.select(i);
}
}
- jreComboIndex = jreCombo.getSelectionIndex();
- homeDirText.setEditable(canEdit);
- homeDirButton.setEnabled(canEdit);
- configurations.getTable().setVisible(canEdit);
- if( jreCombo.getSelectionIndex() < 0 && jreCombo.getItemCount() > 0)
- jreCombo.select(0);
}
+ jreComboIndex = jreCombo.getSelectionIndex();
+ if( jreCombo.getSelectionIndex() < 0 && jreCombo.getItemCount() > 0)
+ jreCombo.select(0);
}
+
+ protected void fillWidgets() {
+ IJBossServerRuntime rt = getRuntime();
+ if (rt != null) {
+ fillNameWidgets(rt.getRuntime());
+ fillHomeDir(rt.getRuntime());
+ fillConfigWidgets(rt);
+ fillJREWidgets(rt);
+ }
+ }
- private IJBossServerRuntime getRuntime() {
+ protected IJBossServerRuntime getRuntime() {
IRuntime r = (IRuntime) getTaskModel()
.getObject(TaskModel.TASK_RUNTIME);
IJBossServerRuntime ajbsrt = null;
@@ -230,7 +251,7 @@
return ajbsrt;
}
- private void createExplanation(Composite main) {
+ protected void createExplanation(Composite main) {
explanationLabel = new Label(main, SWT.WRAP);
FormData data = new FormData();
data.top = new FormAttachment(0, 5);
@@ -240,7 +261,7 @@
explanationLabel.setText(Messages.rwf_Explanation);
}
- private void createNameComposite(Composite main) {
+ protected void createNameComposite(Composite main) {
// Create our name composite
nameComposite = new Composite(main, SWT.NONE);
@@ -276,7 +297,7 @@
nameText.setLayoutData(nameTextData);
}
- private void createHomeComposite(Composite main) {
+ protected void createHomeComposite(Composite main) {
// Create our composite
homeDirComposite = new Composite(main, SWT.NONE);
@@ -332,7 +353,7 @@
homeDirButton.setLayoutData(buttonData);
}
- private void createJREComposite(Composite main) {
+ protected void createJREComposite(Composite main) {
// Create our composite
jreComposite = new Composite(main, SWT.NONE);
@@ -401,7 +422,7 @@
}
- private void createConfigurationComposite(Composite main) {
+ protected void createConfigurationComposite(Composite main) {
UIUtil u = new UIUtil(); // top bottom left right
configComposite = new Composite(main, SWT.NONE);
configComposite.setLayoutData(u.createFormData(
@@ -539,7 +560,7 @@
}
// Launchable only from UI thread
- private void updatePage() {
+ protected void updatePage() {
String folder;
if (!isHomeValid()) {
configurations.getControl().setEnabled(false);
@@ -566,7 +587,7 @@
updateErrorMessage();
}
- private void updateErrorMessage() {
+ protected void updateErrorMessage() {
String error = getErrorString();
if (error == null) {
String warn = getWarningString();
@@ -601,9 +622,6 @@
if (name == null || name.equals("")) //$NON-NLS-1$
return Messages.rwf_nameTextBlank;
- if (homeDir == null || homeDir.equals("")) //$NON-NLS-1$
- return Messages.rwf_homeDirBlank;
-
if (jreComboIndex < 0)
return Messages.rwf_NoVMSelected;
@@ -613,20 +631,25 @@
return null;
}
- private String getWarningString() {
+ protected String getWarningString() {
if( getHomeVersionWarning() != null )
return getHomeVersionWarning();
return null;
}
protected boolean isHomeValid() {
- if( homeDir == null || !(new File(homeDir).exists())) return false;
+ if( homeDir == null || homeDir.equals("") || !(new File(homeDir).exists())) return false;
return new Path(homeDir).append("bin").append("run.jar").toFile().exists(); //$NON-NLS-1$ //$NON-NLS-2$
}
+ protected String getVersionString(File loc) {
+ String version = new ServerBeanLoader().getFullServerVersion(loc);
+ return version;
+ }
+
protected String getHomeVersionWarning() {
File loc = new File(homeDir, JBossServerType.AS.getSystemJarPath());
- String version = new ServerBeanLoader().getFullServerVersion(loc);
+ String version = getVersionString(loc);
IRuntime rt = (IRuntime) getTaskModel().getObject(
TaskModel.TASK_RUNTIME);
String v = rt.getRuntimeType().getVersion();
@@ -641,7 +664,7 @@
return version.startsWith(v) ? null : NLS.bind(Messages.rwf_homeIncorrectVersion, v, version);
}
- private void browseHomeDirClicked() {
+ protected void browseHomeDirClicked() {
File file = new File(homeDir);
if (!file.exists()) {
file = null;
@@ -756,7 +779,7 @@
return true;
}
- private IRuntime getRuntime(String runtimeName) {
+ protected IRuntime getRuntime(String runtimeName) {
if (runtimeName.equals(originalName))
return null; // name is same as original. No clash.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2011-04-28 07:20:06 UTC (rev 30895)
@@ -34,13 +34,22 @@
typeIds="org.jboss.ide.eclipse.as.runtime.32,org.jboss.ide.eclipse.as.runtime.40,org.jboss.ide.eclipse.as.runtime.42,org.jboss.ide.eclipse.as.runtime.50,org.jboss.ide.eclipse.as.runtime.51,org.jboss.ide.eclipse.as.runtime.eap.43,org.jboss.ide.eclipse.as.runtime.eap.50,org.jboss.ide.eclipse.as.runtime.60"
id="org.jboss.ide.eclipse.as.ui.JBossRuntimeWizardFragment"/>
<fragment
+ class="org.jboss.ide.eclipse.as.ui.wizards.JBoss7ServerWizardFragment"
+ id="org.jboss.ide.eclipse.as.ui.jboss7ServerWizardFragment"
+ typeIds="org.jboss.ide.eclipse.as.runtime.70"/>
+ <fragment
class="org.jboss.ide.eclipse.as.ui.wizards.JBossServerWizardFragment"
id="org.jboss.ide.eclipse.as.ui.jbossServerWizardFragment"
- typeIds="%AllJBossServerTypes"/>
+ typeIds="org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43,org.jboss.ide.eclipse.as.eap.50,org.jboss.ide.eclipse.as.60"/>
+ <!--
<fragment
+ class="org.jboss.ide.eclipse.as.ui.wizards.JBoss7ServerWizardFragment"
+ id="org.jboss.ide.eclipse.as.ui.jboss7ServerWizardFragment"
+ typeIds="org.jboss.ide.eclipse.as.70"/> -->
+ <fragment
class="org.jboss.ide.eclipse.as.ui.wizards.StrippedServerWizardFragment"
id="org.jboss.ide.eclipse.as.ui.strippedServerWizardFragment"
- typeIds="org.jboss.ide.eclipse.as.systemCopyServer,org.jboss.ide.eclipse.as.70"/>
+ typeIds="org.jboss.ide.eclipse.as.systemCopyServer"/>
</extension>
<extension point="org.eclipse.ui.startup">
@@ -175,7 +184,7 @@
id="org.jboss.ide.eclipse.as.ui.editor.passwordSection"
insertionId="org.eclipse.wst.server.editor.overview.left"
order="10"
- typeIds="%AllJBossServerTypes"/>
+ typeIds="%JBossServer6AndBelow"/>
<section
class="org.jboss.ide.eclipse.as.ui.editor.ServerModeSection"
id="org.jboss.ide.eclipse.as.ui.editor.serverModeSection"
14 years, 11 months
JBoss Tools SVN: r30894 - in trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core: scanner and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-27 21:22:05 -0400 (Wed, 27 Apr 2011)
New Revision: 30894
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeanDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeansDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SeamDefinitionBuilder.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java
Log:
JBIDE-3120
https://issues.jboss.org/browse/JBIDE-3120
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeanDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeanDefinition.java 2011-04-28 01:19:47 UTC (rev 30893)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeanDefinition.java 2011-04-28 01:22:05 UTC (rev 30894)
@@ -15,7 +15,6 @@
import org.eclipse.jdt.core.IType;
import org.jboss.tools.cdi.seam.config.core.scanner.SAXElement;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXNode;
/**
*
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeansDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeansDefinition.java 2011-04-28 01:19:47 UTC (rev 30893)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeansDefinition.java 2011-04-28 01:22:05 UTC (rev 30894)
@@ -15,7 +15,6 @@
import java.util.Map;
import java.util.Set;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXElement;
import org.jboss.tools.cdi.seam.config.core.scanner.SAXNode;
/**
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SeamDefinitionBuilder.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SeamDefinitionBuilder.java 2011-04-28 01:19:47 UTC (rev 30893)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SeamDefinitionBuilder.java 2011-04-28 01:22:05 UTC (rev 30894)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.cdi.seam.config.core.scanner;
import java.io.ByteArrayInputStream;
@@ -15,7 +25,6 @@
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDICoreNature;
import org.jboss.tools.cdi.core.IJavaAnnotation;
-import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
import org.jboss.tools.cdi.internal.core.impl.AnnotationLiteral;
import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
import org.jboss.tools.cdi.seam.config.core.CDISeamConfigConstants;
@@ -28,6 +37,11 @@
import org.jboss.tools.cdi.seam.config.core.definition.SeamParameterDefinition;
import org.jboss.tools.cdi.seam.config.core.util.Util;
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
public class SeamDefinitionBuilder {
static int IN_ANNOTATION_TYPE = 1;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java 2011-04-28 01:19:47 UTC (rev 30893)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java 2011-04-28 01:22:05 UTC (rev 30894)
@@ -23,7 +23,6 @@
import org.jboss.tools.cdi.core.IParametedType;
import org.jboss.tools.cdi.core.IRootDefinitionContext;
import org.jboss.tools.cdi.seam.config.core.CDISeamConfigConstants;
-import org.jboss.tools.cdi.seam.config.core.definition.SeamBeanDefinition;
import org.jboss.tools.cdi.seam.config.core.definition.SeamMethodDefinition;
import org.jboss.tools.cdi.seam.config.core.definition.SeamParameterDefinition;
import org.jboss.tools.cdi.seam.config.core.scanner.SAXElement;
14 years, 11 months
JBoss Tools SVN: r30893 - in trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test: projects/CDIConfigTest and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-27 21:19:47 -0400 (Wed, 27 Apr 2011)
New Revision: 30893
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/lib/seam-solder.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/MethodBean.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/MethodBean2.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/Qualifier1.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/Qualifier2.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test606/
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test606/MyBean.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test606/MyQualifier.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/MyImpl.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/MyInterface.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/SomeBean.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/META-INF/MANIFEST.MF
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/.classpath
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/META-INF/beans.xml
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/ExtensionTest.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/SeamDefinitionsTest.java
Log:
JBIDE-3120
https://issues.jboss.org/browse/JBIDE-3120
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/META-INF/MANIFEST.MF 2011-04-28 01:18:04 UTC (rev 30892)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/META-INF/MANIFEST.MF 2011-04-28 01:19:47 UTC (rev 30893)
@@ -19,6 +19,7 @@
org.eclipse.ltk.core.refactoring,
org.jboss.tools.jst.web.kb,
org.jboss.tools.cdi.xml,
+ org.jboss.tools.cdi.seam.solder.core,
org.eclipse.jst.standard.schemas
Export-Package: org.jboss.tools.cdi.seam.config.core.test
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/.classpath
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/.classpath 2011-04-28 01:18:04 UTC (rev 30892)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/.classpath 2011-04-28 01:19:47 UTC (rev 30893)
@@ -5,5 +5,6 @@
<classpathentry kind="lib" path="lib/cdi-api.jar"/>
<classpathentry kind="lib" path="lib/javax.inject.jar"/>
<classpathentry kind="lib" path="lib/seam-config-xml.jar"/>
+ <classpathentry kind="lib" path="lib/seam-solder.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/lib/seam-solder.jar
===================================================================
(Binary files differ)
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/lib/seam-solder.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/META-INF/beans.xml
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/META-INF/beans.xml 2011-04-28 01:18:04 UTC (rev 30892)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/META-INF/beans.xml 2011-04-28 01:19:47 UTC (rev 30893)
@@ -7,6 +7,9 @@
xmlns:test603="urn:java:org.jboss.test603"
xmlns:test6041="urn:java:org.jboss.test6041"
xmlns:test6042="urn:java:org.jboss.test6042"
+ xmlns:test605="urn:java:org.jboss.test605"
+ xmlns:test606="urn:java:org.jboss.test606"
+ xmlns:test607="urn:java:org.jboss.test607"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd">
<config:MyAnnotation>
<s:Qualifier1/>
@@ -83,4 +86,54 @@
</test6042:horse>
</test6042:Knight>
+<test605:MethodBean>
+ <test605:doStuff>
+ <s:Produces/>
+ </test605:doStuff>
+
+ <test605:doStuff>
+ <s:Produces/>
+ <test605:Qualifier1/>
+ <s:parameters>
+ <s:Long>
+ <test605:Qualifier2/>
+ </s:Long>
+ </s:parameters>
+ </test605:doStuff>
+
+ <test605:doStuff>
+ <s:Produces/>
+ <test605:Qualifier1/>
+ <s:parameters>
+ <s:array dimensions="2">
+ <test605:Qualifier2/>
+ <s:Long/>
+ </s:array>
+ </s:parameters>
+ </test605:doStuff>
+</test605:MethodBean>
+
+<test605:MethodBean2>
+ <test605:method>
+ <s:array>
+ <s:String/>
+ </s:array>
+ </test605:method>
+</test605:MethodBean2>
+
+<test606:MyBean>
+ <s:parameters>
+ <s:Integer>
+ <test606:MyQualifier/>
+ </s:Integer>
+ </s:parameters>
+</test606:MyBean>
+
+<test607:SomeBean>
+ <test607:someField>
+ <s:Inject/>
+ <s:Exact>org.jboss.test607.MyInterface</s:Exact>
+ </test607:someField>
+</test607:SomeBean>
+
</beans>
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/MethodBean.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/MethodBean.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/MethodBean.java 2011-04-28 01:19:47 UTC (rev 30893)
@@ -0,0 +1,16 @@
+package org.jboss.test605;
+
+public class MethodBean {
+
+ public int doStuff() {
+ return 1;
+ }
+
+ public long doStuff(long c) {
+ return c + 1;
+ }
+
+ public void doStuff(long[][] beans) {
+
+ }
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/MethodBean.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/MethodBean2.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/MethodBean2.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/MethodBean2.java 2011-04-28 01:19:47 UTC (rev 30893)
@@ -0,0 +1,9 @@
+package org.jboss.test605;
+
+public class MethodBean2 {
+
+ public void method(String[] s) {
+
+ }
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/MethodBean2.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/Qualifier1.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/Qualifier1.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/Qualifier1.java 2011-04-28 01:19:47 UTC (rev 30893)
@@ -0,0 +1,21 @@
+package org.jboss.test605;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Qualifier
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface Qualifier1 {
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/Qualifier1.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/Qualifier2.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/Qualifier2.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/Qualifier2.java 2011-04-28 01:19:47 UTC (rev 30893)
@@ -0,0 +1,21 @@
+package org.jboss.test605;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Qualifier
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface Qualifier2 {
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test605/Qualifier2.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test606/MyBean.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test606/MyBean.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test606/MyBean.java 2011-04-28 01:19:47 UTC (rev 30893)
@@ -0,0 +1,9 @@
+package org.jboss.test606;
+
+public class MyBean {
+
+ public MyBean(int count) {
+
+ }
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test606/MyBean.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test606/MyQualifier.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test606/MyQualifier.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test606/MyQualifier.java 2011-04-28 01:19:47 UTC (rev 30893)
@@ -0,0 +1,21 @@
+package org.jboss.test606;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Qualifier
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface MyQualifier {
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test606/MyQualifier.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/MyImpl.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/MyImpl.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/MyImpl.java 2011-04-28 01:19:47 UTC (rev 30893)
@@ -0,0 +1,5 @@
+package org.jboss.test607;
+
+public class MyImpl implements MyInterface {
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/MyImpl.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/MyInterface.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/MyInterface.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/MyInterface.java 2011-04-28 01:19:47 UTC (rev 30893)
@@ -0,0 +1,5 @@
+package org.jboss.test607;
+
+public interface MyInterface {
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/MyInterface.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/SomeBean.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/SomeBean.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/SomeBean.java 2011-04-28 01:19:47 UTC (rev 30893)
@@ -0,0 +1,5 @@
+package org.jboss.test607;
+
+public class SomeBean {
+ MyImpl someField;
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/src/org/jboss/test607/SomeBean.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/ExtensionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/ExtensionTest.java 2011-04-28 01:18:04 UTC (rev 30892)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/ExtensionTest.java 2011-04-28 01:19:47 UTC (rev 30893)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.cdi.seam.config.core.test;
import java.io.IOException;
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/SeamDefinitionsTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/SeamDefinitionsTest.java 2011-04-28 01:18:04 UTC (rev 30892)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/SeamDefinitionsTest.java 2011-04-28 01:19:47 UTC (rev 30893)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.cdi.seam.config.core.test;
import java.io.IOException;
@@ -10,6 +20,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IMemberValuePair;
+import org.eclipse.jdt.core.IMethod;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.ICDIProject;
@@ -21,6 +32,9 @@
import org.jboss.tools.cdi.seam.config.core.definition.SeamBeanDefinition;
import org.jboss.tools.cdi.seam.config.core.definition.SeamBeansDefinition;
import org.jboss.tools.cdi.seam.config.core.definition.SeamFieldDefinition;
+import org.jboss.tools.cdi.seam.config.core.definition.SeamMethodDefinition;
+import org.jboss.tools.cdi.seam.config.core.definition.SeamParameterDefinition;
+import org.jboss.tools.cdi.seam.solder.core.CDISeamSolderConstants;
import org.jboss.tools.common.text.ITextSourceReference;
/**
@@ -259,4 +273,149 @@
}
+ /**
+<test605:MethodBean>
+ <test605:doStuff>
+ <s:Produces/>
+ </test605:doStuff>
+
+ <test605:doStuff>
+ <s:Produces/>
+ <test605:Qualifier1/>
+ <s:parameters>
+ <s:Long>
+ <test605:Qualifier2/>
+ </s:Long>
+ </s:parameters>
+ </test605:doStuff>
+
+ <test605:doStuff>
+ <s:Produces/>
+ <test605:Qualifier1/>
+ <s:parameters>
+ <s:array dimensions="2">
+ <test605:Qualifier2/>
+ <s:Long/>
+ </s:array>
+ </s:parameters>
+ </test605:doStuff>
+</test605:MethodBean>
+ */
+ public void testConfiguringMethods() {
+ ICDIProject cdi = CDICorePlugin.getCDIProject(project, true);
+ ConfigDefinitionContext context = (ConfigDefinitionContext)getConfigExtension(cdi).getContext();
+ SeamBeansDefinition d = getBeansDefinition(context, "src/META-INF/beans.xml");
+
+ Set<SeamBeanDefinition> ds = findBeanDefinitionByTagName(d, "test605:MethodBean");
+ assertEquals(1, ds.size());
+ SeamBeanDefinition b = ds.iterator().next();
+ List<SeamMethodDefinition> ms = b.getMethods();
+ assertEquals(3, ms.size());
+
+ SeamMethodDefinition noParam = ms.get(0);
+ assertEquals(0, noParam.getParameters().size());
+ assertNotNull(noParam.getAnnotation(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME));
+
+ SeamMethodDefinition oneParam = ms.get(1);
+ assertEquals(1, oneParam.getParameters().size());
+ assertNotNull(oneParam.getAnnotation(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME));
+ assertNotNull(oneParam.getAnnotation("org.jboss.test605.Qualifier1"));
+ SeamParameterDefinition param = oneParam.getParameters().get(0);
+ assertEquals(0, param.getDimensions());
+ assertEquals("java.lang.Long", param.getType().getFullyQualifiedName());
+ assertNotNull(param.getAnnotation("org.jboss.test605.Qualifier2"));
+
+ SeamMethodDefinition oneArrayParam = ms.get(2);
+ assertEquals(1, oneParam.getParameters().size());
+ assertNotNull(oneArrayParam.getAnnotation(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME));
+ assertNotNull(oneArrayParam.getAnnotation("org.jboss.test605.Qualifier1"));
+ param = oneArrayParam.getParameters().get(0);
+ assertEquals(2, param.getDimensions());
+ assertEquals("java.lang.Long", param.getType().getFullyQualifiedName());
+ assertNotNull(param.getAnnotation("org.jboss.test605.Qualifier2"));
+
+ }
+
+ /**
+<test605:MethodBean2>
+ <test605:method>
+ <s:array>
+ <test605:String/>
+ </s:array>
+ </test605:method>
+</test605:MethodBean2>
+ */
+ public void testConfiguringMethods2() {
+ ICDIProject cdi = CDICorePlugin.getCDIProject(project, true);
+ ConfigDefinitionContext context = (ConfigDefinitionContext)getConfigExtension(cdi).getContext();
+ SeamBeansDefinition d = getBeansDefinition(context, "src/META-INF/beans.xml");
+
+ Set<SeamBeanDefinition> ds = findBeanDefinitionByTagName(d, "test605:MethodBean2");
+ assertEquals(1, ds.size());
+ SeamBeanDefinition b = ds.iterator().next();
+ List<SeamMethodDefinition> ms = b.getMethods();
+ assertEquals(1, ms.size());
+
+ SeamMethodDefinition m = ms.get(0);
+ assertEquals(1, m.getParameters().size());
+ SeamParameterDefinition param = m.getParameters().get(0);
+ assertEquals(1, param.getDimensions());
+ assertEquals("java.lang.String", param.getType().getFullyQualifiedName());
+
+ }
+
+ /**
+<test606:MyBean>
+ <s:parameters>
+ <s:Integer>
+ <test606:MyQualifier/>
+ </s:Integer>
+ </s:parameters>
+</test606:MyBean>
+ */
+ public void testConfiguringConstructor() throws CoreException {
+ ICDIProject cdi = CDICorePlugin.getCDIProject(project, true);
+ ConfigDefinitionContext context = (ConfigDefinitionContext)getConfigExtension(cdi).getContext();
+ SeamBeansDefinition d = getBeansDefinition(context, "src/META-INF/beans.xml");
+
+ Set<SeamBeanDefinition> ds = findBeanDefinitionByTagName(d, "test606:MyBean");
+ assertEquals(1, ds.size());
+ SeamBeanDefinition b = ds.iterator().next();
+ List<SeamMethodDefinition> ms = b.getMethods();
+ assertEquals(1, ms.size());
+
+ SeamMethodDefinition m = ms.get(0);
+ IMethod jm = m.getMethod();
+ assertTrue(jm.isConstructor());
+ assertEquals(1, m.getParameters().size());
+ SeamParameterDefinition param = m.getParameters().get(0);
+ assertEquals(0, param.getDimensions());
+ assertEquals("java.lang.Integer", param.getType().getFullyQualifiedName());
+
+ }
+
+ /**
+ *
+ * @throws CoreException
+ */
+ public void testOverridingTypeOfAnInjectionPoint() throws CoreException {
+ ICDIProject cdi = CDICorePlugin.getCDIProject(project, true);
+ ConfigDefinitionContext context = (ConfigDefinitionContext)getConfigExtension(cdi).getContext();
+ SeamBeansDefinition d = getBeansDefinition(context, "src/META-INF/beans.xml");
+
+ Set<SeamBeanDefinition> ds = findBeanDefinitionByTagName(d, "test607:SomeBean");
+ assertEquals(1, ds.size());
+ SeamBeanDefinition b = ds.iterator().next();
+ SeamFieldDefinition f = b.getField("someField");
+ assertNotNull(f);
+ IJavaAnnotation inject = f.getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
+ assertNotNull(inject);
+ IJavaAnnotation exact = f.getAnnotation(CDISeamSolderConstants.EXACT_ANNOTATION_TYPE_NAME);
+ assertNotNull(exact);
+ IMemberValuePair[] ps = exact.getMemberValuePairs();
+ assertEquals(1, ps.length);
+ assertEquals("org.jboss.test607.MyInterface", ps[0].getValue());
+
+ }
+
}
14 years, 11 months
JBoss Tools SVN: r30892 - trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-27 21:18:04 -0400 (Wed, 27 Apr 2011)
New Revision: 30892
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java
Log:
JBIDE-3120
https://issues.jboss.org/browse/JBIDE-3120
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java 2011-04-28 01:11:23 UTC (rev 30891)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java 2011-04-28 01:18:04 UTC (rev 30892)
@@ -38,7 +38,16 @@
public static Map<String, String> EE_TYPES = new HashMap<String, String>();
static {
- String[] JAVA_LANG = {"Integer", "Short", "Long", "String", "Character", "Byte", "Boolean"};
+ EE_TYPES.put("int", "java.lang.Integer");
+ EE_TYPES.put("short", "java.lang.Short");
+ EE_TYPES.put("long", "java.lang.Long");
+ EE_TYPES.put("char", "java.lang.Character");
+ EE_TYPES.put("byte", "java.lang.Byte");
+ EE_TYPES.put("boolean", "java.lang.Boolean");
+ EE_TYPES.put("double", "java.lang.Double");
+ EE_TYPES.put("float", "java.lang.Float");
+
+ String[] JAVA_LANG = {"Integer", "Short", "Long", "String", "Character", "Byte", "Boolean", "Double", "Float"};
for (String s: JAVA_LANG) EE_TYPES.put(s, "java.lang." + s);
String[] JAVA_UTIL = {"List", "Map", "Set"};
14 years, 11 months
JBoss Tools SVN: r30891 - in trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core: definition and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-27 21:11:23 -0400 (Wed, 27 Apr 2011)
New Revision: 30891
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/CDISeamConfigConstants.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeanDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamMethodDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamParameterDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/Location.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXAttribute.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXParser.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SeamDefinitionBuilder.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java
Log:
JBIDE-3120
https://issues.jboss.org/browse/JBIDE-3120
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/CDISeamConfigConstants.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/CDISeamConfigConstants.java 2011-04-27 23:43:35 UTC (rev 30890)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/CDISeamConfigConstants.java 2011-04-28 01:11:23 UTC (rev 30891)
@@ -12,6 +12,11 @@
import org.jboss.tools.cdi.core.CDIConstants;
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
public interface CDISeamConfigConstants extends CDIConstants {
public String SEAM_BEANS_XML = "seam-beans.xml";
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeanDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeanDefinition.java 2011-04-27 23:43:35 UTC (rev 30890)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeanDefinition.java 2011-04-28 01:11:23 UTC (rev 30891)
@@ -65,4 +65,8 @@
return null;
}
+ public List<SeamMethodDefinition> getMethods() {
+ return methods;
+ }
+
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamMethodDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamMethodDefinition.java 2011-04-27 23:43:35 UTC (rev 30890)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamMethodDefinition.java 2011-04-28 01:11:23 UTC (rev 30891)
@@ -28,10 +28,19 @@
public void setMethod(IMethod method) {
this.method = method;
+ //TODO set parameter objects to parameters
}
+ public IMethod getMethod() {
+ return method;
+ }
+
public void addParameter(SeamParameterDefinition p) {
parameters.add(p);
}
+ public List<SeamParameterDefinition> getParameters() {
+ return parameters;
+ }
+
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamParameterDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamParameterDefinition.java 2011-04-27 23:43:35 UTC (rev 30890)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamParameterDefinition.java 2011-04-28 01:11:23 UTC (rev 30891)
@@ -31,11 +31,27 @@
}
public void setDimensions(String value) {
- dimentions = value;
+ dimentions = value == null ? null : value.trim();
}
public void setParameter(ILocalVariable parameter) {
this.parameter = parameter;
}
+ public int getDimensions() {
+ if(dimentions == null || dimentions.length() == 0) {
+ return 0;
+ }
+ try {
+ return Integer.parseInt(dimentions);
+ } catch (NumberFormatException e) {
+ //reporting is done by loader; do not report here.
+ return 0;
+ }
+ }
+
+ public IType getType() {
+ return type;
+ }
+
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/Location.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/Location.java 2011-04-27 23:43:35 UTC (rev 30890)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/Location.java 2011-04-28 01:11:23 UTC (rev 30891)
@@ -12,6 +12,11 @@
import org.jboss.tools.common.text.ITextSourceReference;
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
public class Location implements ITextSourceReference {
int start;
int length;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXAttribute.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXAttribute.java 2011-04-27 23:43:35 UTC (rev 30890)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXAttribute.java 2011-04-28 01:11:23 UTC (rev 30891)
@@ -12,6 +12,11 @@
import org.jboss.tools.common.text.ITextSourceReference;
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
public class SAXAttribute extends SAXText {
private String name;
private ITextSourceReference nameLocation;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXParser.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXParser.java 2011-04-27 23:43:35 UTC (rev 30890)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXParser.java 2011-04-28 01:11:23 UTC (rev 30891)
@@ -22,6 +22,11 @@
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.helpers.XMLReaderFactory;
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
public class SAXParser extends SAXValidator {
XMLReader createParser1(DefaultHandler handler) {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SeamDefinitionBuilder.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SeamDefinitionBuilder.java 2011-04-27 23:43:35 UTC (rev 30890)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SeamDefinitionBuilder.java 2011-04-28 01:11:23 UTC (rev 30891)
@@ -115,6 +115,11 @@
def.setModifies(c);
continue;
}
+ if(Util.isParameters(c)) {
+ SeamMethodDefinition md = scanConstructor(c, type);
+ if(md != null) def.addMethod(md);
+ continue;
+ }
}
IType t = Util.resolveType(c, project);
if(t != null) {
@@ -131,7 +136,8 @@
if(m instanceof IField) {
def.addField(scanField(c, (IField)m));
} else if(m instanceof IMethod) {
- def.addMethod(scanMethod(element, (IMethod)m));
+ SeamMethodDefinition md = scanMethod(c, type);
+ if(md != null) def.addMethod(md);
} else {
result.addUnresolvedNode(c, CDISeamConfigConstants.ERROR_UNRESOLVED_MEMBER);
}
@@ -241,15 +247,14 @@
}
}
- private SeamMethodDefinition scanMethod(SAXElement element, IMethod method) {
+ private SeamMethodDefinition scanMethod(SAXElement element, IType type) {
SeamMethodDefinition def = new SeamMethodDefinition();
def.setNode(element);
- def.setMethod(method);
List<SAXElement> es = element.getChildElements();
for (SAXElement c: es) {
if(!Util.isConfigRelevant(c)) continue;
if(Util.isParameters(c)) {
- List<SAXElement> ps = element.getChildElements();
+ List<SAXElement> ps = c.getChildElements();
for (SAXElement p: ps) {
SeamParameterDefinition pd = scanParameter(p);
if(pd != null) def.addParameter(pd);
@@ -268,9 +273,46 @@
}
}
+ IMethod method = null;
+ try {
+ method = Util.findMethod(def, type, element.getLocalName(), context.getRootContext());
+ } catch (JavaModelException e) {
+ CDISeamConfigCorePlugin.getDefault().logError(e);
+ }
+ if(method != null) {
+ def.setMethod(method);
+ }
return def;
}
+ private SeamMethodDefinition scanConstructor(SAXElement element, IType type) {
+ SeamMethodDefinition def = new SeamMethodDefinition();
+ def.setNode(element);
+ if(Util.isParameters(element)) {
+ List<SAXElement> ps = element.getChildElements();
+ for (SAXElement p: ps) {
+ SeamParameterDefinition pd = scanParameter(p);
+ if(pd != null) def.addParameter(pd);
+ }
+ } else if(Util.isArray(element)) {
+ SeamParameterDefinition pd = scanParameter(element);
+ if(pd != null) def.addParameter(pd);
+ }
+ IJavaAnnotation inject = createInject();
+ def.addAnnotation(inject);
+ IMethod method = null;
+ try {
+ method = Util.findMethod(def, type, null, context.getRootContext());
+ } catch (JavaModelException e) {
+ CDISeamConfigCorePlugin.getDefault().logError(e);
+ }
+ if(method != null) {
+ def.setMethod(method);
+ }
+
+ return def;
+ }
+
private SeamParameterDefinition scanParameter(SAXElement element) {
if(!Util.isConfigRelevant(element)) return null;
SeamParameterDefinition def = new SeamParameterDefinition();
@@ -278,13 +320,15 @@
if(Util.isArray(element)) {
if(element.hasAttribute(CDISeamConfigConstants.ATTR_DIMENSIONS)) {
def.setDimensions(element.getAttribute(CDISeamConfigConstants.ATTR_DIMENSIONS).getValue());
+ } else {
+ def.setDimensions("1");
}
List<SAXElement> es = element.getChildElements();
for (SAXElement c: es) {
if(!Util.isConfigRelevant(c)) continue;
IType type = Util.resolveType(c, project);
if(type == null) {
- result.addUnresolvedNode(element, CDISeamConfigConstants.ERROR_UNRESOLVED_TYPE);
+ result.addUnresolvedNode(c, CDISeamConfigConstants.ERROR_UNRESOLVED_TYPE);
continue;
}
TypeCheck typeCheck = new TypeCheck(type, c);
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java 2011-04-27 23:43:35 UTC (rev 30890)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java 2011-04-28 01:11:23 UTC (rev 30891)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.cdi.seam.config.core.util;
import java.util.HashMap;
@@ -8,11 +18,22 @@
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
import org.jboss.tools.cdi.core.CDICoreNature;
+import org.jboss.tools.cdi.core.IParametedType;
+import org.jboss.tools.cdi.core.IRootDefinitionContext;
import org.jboss.tools.cdi.seam.config.core.CDISeamConfigConstants;
+import org.jboss.tools.cdi.seam.config.core.definition.SeamBeanDefinition;
+import org.jboss.tools.cdi.seam.config.core.definition.SeamMethodDefinition;
+import org.jboss.tools.cdi.seam.config.core.definition.SeamParameterDefinition;
import org.jboss.tools.cdi.seam.config.core.scanner.SAXElement;
import org.jboss.tools.cdi.seam.config.core.scanner.SAXText;
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
public class Util implements CDISeamConfigConstants {
public static Map<String, String> EE_TYPES = new HashMap<String, String>();
@@ -49,6 +70,12 @@
String[] JAVAX_INTERCEPTOR = {"AroundInvoke", "AroundTimeout", "ExcludeClassInterceptors", "ExcludeDefaultInterceptors",
"Interceptor", "InterceptorBinding", "Interceptors", "InvocationContext"};
for (String s: JAVAX_INTERCEPTOR) EE_TYPES.put(s, "javax.interceptor." + s);
+
+ //It is not clear.
+ // In Seam3 doc, item 6.7. Overriding the type of an injection point is devoted to @Exact,
+ // but item 6.1 does not mentions its package in namespace urn:java:ee.
+ String[] SEAM_SOLDER = {"Exact"};
+ for (String s: SEAM_SOLDER) EE_TYPES.put(s, "org.jboss.seam.solder.core." + s);
}
@@ -151,4 +178,38 @@
return t != null && t.getValue() != null && t.getValue().trim().length() > 0;
}
+ /**
+ *
+ * @param def
+ * @param type
+ * @param name method name or null for constructor
+ * @return
+ */
+ public static IMethod findMethod(SeamMethodDefinition def, IType type, String name, IRootDefinitionContext context) throws JavaModelException {
+ IMethod[] ms = type.getMethods();
+ for (IMethod m: ms) {
+ if((name == null && m.isConstructor()) || name.equals(m.getElementName())) {
+ if(sameParameterTypes(def, m, context)) return m;
+ }
+ }
+ return null;
+ }
+
+ static boolean sameParameterTypes(SeamMethodDefinition def, IMethod m, IRootDefinitionContext context) throws JavaModelException {
+ String[] paramTypes = m.getParameterTypes();
+ if(paramTypes.length != def.getParameters().size()) return false;
+ if(paramTypes.length == 0) return true;
+ for (int i = 0; i < paramTypes.length; i++) {
+ String paramType = paramTypes[i];
+ SeamParameterDefinition p = def.getParameters().get(i);
+ if(p.getDimensions() != Signature.getArrayCount(paramType)) {
+ return false;
+ }
+ IParametedType pt = context.getProject().getTypeFactory().getParametedType(m, paramType);
+ if(pt == null || p.getType() == null) return false;
+ if(!pt.getType().getFullyQualifiedName().equals(p.getType().getFullyQualifiedName())) return false;
+ }
+ return true;
+ }
+
}
14 years, 11 months
JBoss Tools SVN: r30890 - trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-04-27 19:43:35 -0400 (Wed, 27 Apr 2011)
New Revision: 30890
Modified:
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/TestProjectProvider.java
Log:
https://issues.jboss.org/browse/JBIDE-8788
Modified: trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/TestProjectProvider.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/TestProjectProvider.java 2011-04-27 23:39:07 UTC (rev 30889)
+++ trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/TestProjectProvider.java 2011-04-27 23:43:35 UTC (rev 30890)
@@ -24,6 +24,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.jboss.tools.tests.TestsPlugin;
/**
* Test plugins may define test projects to be added
@@ -88,10 +89,10 @@
ResourcesUtils.setBuildAutomatically(oldAutoBuilding);
}
} catch (CoreException ex) {
- ILog log = Platform.getLog(Platform.getBundle("org.jboss.tools.common.test"));
+ ILog log = Platform.getLog(Platform.getBundle(TestsPlugin.ID));
IStatus error = new Status(
IStatus.ERROR,
- "org.jboss.tools.common.test",
+ "org.jboss.tools.test",
"Exception occurs during project deletion",ex);
log.log(error);
}
14 years, 11 months