JBoss Tools SVN: r33765 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-08-10 09:22:45 -0400 (Wed, 10 Aug 2011)
New Revision: 33765
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java
Log:
[JBIDE-9492] replaced fixed mgmt port number by constant
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java 2011-08-10 13:15:56 UTC (rev 33764)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java 2011-08-10 13:22:45 UTC (rev 33765)
@@ -64,12 +64,11 @@
}
private int getManagementPort(IServer server) {
- JBoss7Server jbossServer = (JBoss7Server) server.loadAdapter(JBoss7Server.class, new NullProgressMonitor());
- if( server != null )
+ if( server != null ) {
+ JBoss7Server jbossServer = (JBoss7Server) server.loadAdapter(JBoss7Server.class, new NullProgressMonitor());
return jbossServer.getManagementPort();
- // TODO: provide this default in a single place (currently it is spread across the
- // behavior and this poller). This port is already offered as constant in AS7Manager#MGMT_PORT
- return 9999;
+ }
+ return IJBoss7ManagerService.MGMT_PORT;
}
public boolean isComplete() throws PollingException, RequiresInfoException {
14 years, 8 months
JBoss Tools SVN: r33764 - in trunk/as: plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core and 12 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-08-10 09:15:56 -0400 (Wed, 10 Aug 2011)
New Revision: 33764
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/IJBoss7DeploymentResult.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/IJBoss7ManagerService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7DeploymentState.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManagerServiceProxy.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManagerUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManangerConnectException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManangerException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ServerState.java
Removed:
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/IJBoss7DeploymentResult.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7DeploymentState.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.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/JBoss7ManangerConnectException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangerException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerState.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.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/META-INF/MANIFEST.MF
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/internal/management/as7/AS7Manager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DeploymentOperationResult.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/util/AS7ManagerUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7BehaviourDelegate.java
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/JBossManagementServiceTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/utils/AS7ManagerTestUtils.java
trunk/as/tests/org.jboss.ide.eclipse.as.test/META-INF/MANIFEST.MF
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java
Log:
[JBIDE-9500] corrected package naming, package export/hiding, moved classes to correct place (from core to managent.as7)
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2011-08-10 13:15:56 UTC (rev 33764)
@@ -44,3 +44,4 @@
.
Bundle-Vendor: %Bundle-Vendor.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.jboss.ide.eclipse.as.management.as7
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -92,8 +92,6 @@
public static String ExtensionManager_could_not_load_publishers;
public static String PublishRenameFailure;
- public static String JBoss7ServerState_noEnumForString;
-
static {
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties 2011-08-10 13:15:56 UTC (rev 33764)
@@ -70,5 +70,3 @@
JMXScannerCanceled=JBossTools was unable to contact the JBoss deployment scanner in a reasonable amount of time. This step has been skipped.
ConnectingToServerViaJMX=Connecting to {0} via JMX
ExtensionManager_could_not_load_publishers=Could not load publishers
-
-JBoss7ServerState_noEnumForString="No JBoss7ServerState enum for string {0}"
Deleted: 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/IJBoss7ManagerService.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBoss7ManagerService.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -1,159 +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;
-
-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;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ServerState;
-
-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;
-
- /**
- * Returns the state of the server
- *
- * @param host the server to query
- * @param port the port to communicate on
- * @return the state of the server
- *
- * @throws Exception
- */
- public JBoss7ServerState getServerState(String host, int port) throws Exception;
-
- /**
- * Returns <code>true</code> if the server is running, <code>false</code>
- * otherwise.
- *
- * @param host the server to to query
- * @param port the port to communicate on
- * @return true if it's running, false otherwise
- * @throws Exception
- */
- public boolean isRunning(String host, int port) throws Exception;
-
- @Deprecated
- public JBoss7ServerState getServerState(String host) throws Exception;
-
- /**
- * Stops the given server
- *
- * @throws JBoss7ManangerException
- * @throws Exception
- */
- public void stop(String host, int port) throws Exception;
-
- @Deprecated
- 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/IJBoss7DeploymentResult.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7DeploymentResult.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7DeploymentResult.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -1,19 +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.core.server.internal.v7;
-
-import org.eclipse.core.runtime.IStatus;
-
-public interface IJBoss7DeploymentResult {
-
- public abstract IStatus getStatus() throws JBoss7ManangerException;
-
-}
\ No newline at end of file
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7DeploymentState.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7DeploymentState.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7DeploymentState.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -1,22 +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;
-
-
-/**
- * An enum that reflects the state of a deployment.
- *
- * @author André Dietisheim
- */
-public enum JBoss7DeploymentState {
- STARTED ,
- STOPPED;
-}
\ No newline at end of file
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -20,12 +20,15 @@
import org.eclipse.core.runtime.Status;
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.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller2;
import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
import org.jboss.ide.eclipse.as.core.server.internal.ServerStatePollerType;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManagerUtil.IServiceAware;
+import org.jboss.ide.eclipse.as.management.as7.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ManagerUtil;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ManangerConnectException;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ServerState;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ManagerUtil.IServiceAware;
/**
* @author André Dietisheim
Deleted: 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.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -1,97 +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 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;
-
-/**
- * @author André Dietisheim
- */
-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 JBoss7ServerState getServerState(String host, int port) throws Exception {
- return checkedGetService().getServerState(host, port);
- }
-
- public boolean isRunning(String host, int port) throws Exception {
- try {
- return checkedGetService().isRunning(host, port);
- } catch (Exception e) {
- return false;
- }
- }
-
- @Deprecated
- public JBoss7ServerState getServerState(String host) throws Exception {
- return checkedGetService().getServerState(host);
- }
-
- public void stop(String host, int port) throws Exception {
- checkedGetService().stop(host, port);
- }
-
- @Deprecated
- 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();
- }
-
-}
Deleted: 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-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -1,61 +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 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 {
-
- private static final String JBOSS7_RUNTIME = "org.jboss.ide.eclipse.as.runtime.70"; //$NON-NLS-1$
-
- public static IJBoss7ManagerService getService(IServer server) throws Exception {
- BundleContext context = JBossServerCorePlugin.getContext();
- JBoss7ManagerServiceProxy proxy = new JBoss7ManagerServiceProxy(context, getRequiredVersion(server));
- proxy.open();
- return proxy;
- }
-
- private static String getRequiredVersion(IServer server) {
- String id = server.getRuntime().getRuntimeType().getId();
- if (JBOSS7_RUNTIME.equals(id)) {
- return IJBoss7ManagerService.AS_VERSION_700;
- }
- return null;
- }
-
- public static void dispose(IJBoss7ManagerService service) {
- if (service != null) {
- service.dispose();
- }
- }
-
- public static <RESULT> RESULT executeWithService(IServiceAware<RESULT> serviceAware, IServer server) throws Exception {
- IJBoss7ManagerService service = null;
- try {
- service = JBoss7ManagerUtil.getService(server);
- return serviceAware.execute(service);
- } finally {
- if (service != null) {
- service.dispose();
- }
- }
- }
-
- public static interface IServiceAware<RESULT> {
-
- public RESULT execute(IJBoss7ManagerService service) throws Exception;
-
- }
-
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangerConnectException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangerConnectException.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangerConnectException.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.ide.eclipse.as.core.server.internal.v7;
-
-/**
- * @author André Dietisheim
- */
-public class JBoss7ManangerConnectException extends JBoss7ManangerException {
-
- private static final long serialVersionUID = 1L;
-
- public JBoss7ManangerConnectException(Throwable cause) {
- super(cause);
- }
-
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangerException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangerException.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangerException.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.ide.eclipse.as.core.server.internal.v7;
-
-/**
- * @author André Dietisheim
- */
-public class JBoss7ManangerException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public JBoss7ManangerException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public JBoss7ManangerException(Throwable cause) {
- super(cause);
- }
-
- public JBoss7ManangerException(String message) {
- super(message);
- }
-
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerState.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerState.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerState.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -1,41 +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.core.server.internal.v7;
-
-import java.text.MessageFormat;
-
-import org.jboss.ide.eclipse.as.core.Messages;
-
-/**
- * @author André Dietisheim
- */
-public enum JBoss7ServerState {
- STARTING, RUNNING, RESTART_REQUIRED;
-
- public static JBoss7ServerState valueOfIgnoreCase(String stateString) {
- JBoss7ServerState matchingState = null;
- if (stateString != null && stateString.length() > 0) {
- for (JBoss7ServerState availableState : values()) {
- if (stateString.equalsIgnoreCase(availableState.name())) {
- matchingState = availableState;
- break;
- }
- }
- }
- if (matchingState == null) {
- throw new IllegalArgumentException(MessageFormat.format(
- Messages.JBoss7ServerState_noEnumForString,
- stateString));
- }
-
- return matchingState;
- }
-}
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-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -17,11 +17,12 @@
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.extensions.polling.WebPortPoller;
-import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossBehaviorDelegate;
import org.jboss.ide.eclipse.as.core.util.PollThreadUtils;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.management.as7.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ManagerUtil;
public class LocalJBoss7BehaviorDelegate extends LocalJBossBehaviorDelegate {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF 2011-08-10 13:15:56 UTC (rev 33764)
@@ -5,7 +5,7 @@
Bundle-Version: 2.3.0.qualifier
Bundle-Activator: org.jboss.ide.eclipse.as.internal.management.as7.Activator
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
- org.jboss.ide.eclipse.as.core
+ org.eclipse.wst.server.core;bundle-version="1.1.302"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: .,
@@ -20,5 +20,6 @@
xnio-api-3.0.0.Beta3.jar,
xnio-nio-3.0.0.Beta3.jar
Service-Component: META-INF/jboss-management-service.xml
-Export-Package: org.jboss.ide.eclipse.as.internal.management.as7;x-friends:="org.jboss.ide.eclipse.as.management.as7.tests"
+Export-Package: org.jboss.ide.eclipse.as.internal.management.as7;x-friends:="org.jboss.ide.eclipse.as.management.as7.tests",
+ org.jboss.ide.eclipse.as.management.as7
Bundle-Vendor: JBoss by Red Hat
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-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/jboss-management-service.xml 2011-08-10 13:15:56 UTC (rev 33764)
@@ -2,7 +2,7 @@
<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.internal.management.as7.JBoss7ManagerService"/>
<service>
- <provide interface="org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService"/>
+ <provide interface="org.jboss.ide.eclipse.as.management.as7.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/internal/management/as7/AS7Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -36,11 +36,11 @@
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
import org.jboss.as.protocol.old.StreamUtils;
import org.jboss.dmr.ModelNode;
-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;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ServerState;
import org.jboss.ide.eclipse.as.internal.management.as7.util.AS7ManagerUtil;
+import org.jboss.ide.eclipse.as.management.as7.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7DeploymentState;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ManangerException;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ServerState;
/**
* @author André Dietisheim
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -13,6 +13,8 @@
import org.eclipse.osgi.util.NLS;
public class AS7Messages extends NLS {
+ public static String JBoss7ServerState_noEnumForString;
+
public static String ModuleStateEvaluationFailed;
public static String OperationOnAddressFailed;
public static String FailedToBuildOperation;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.properties 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.properties 2011-08-10 13:15:56 UTC (rev 33764)
@@ -1,3 +1,5 @@
+JBoss7ServerState_noEnumForString="No JBoss7ServerState enum for string {0}"
+
ModuleStateEvaluationFailed=Could not evaluate state for deployment {0}
OperationOnAddressFailed=Could not execute {0} for {1}. Failure was {2}.
FailedToBuildOperation=Failed to build operation.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DeploymentOperationResult.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DeploymentOperationResult.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DeploymentOperationResult.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -20,8 +20,8 @@
import org.jboss.as.controller.client.helpers.standalone.DeploymentAction;
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentActionResult;
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.management.as7.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ManangerException;
/**
* A class that holds the status of a deployment operation.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -13,10 +13,10 @@
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;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ServerState;
+import org.jboss.ide.eclipse.as.management.as7.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.management.as7.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7DeploymentState;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ServerState;
/**
* @author Rob Stryker
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/util/AS7ManagerUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/util/AS7ManagerUtil.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/util/AS7ManagerUtil.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -30,10 +30,10 @@
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
import org.jboss.dmr.Property;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
import org.jboss.ide.eclipse.as.internal.management.as7.AS7Messages;
import org.jboss.ide.eclipse.as.internal.management.as7.DefaultOperationRequestBuilder;
import org.jboss.ide.eclipse.as.internal.management.as7.OperationFormatException;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ManangerException;
/**
* Various utility methods to deal with the as7 management api.
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/IJBoss7DeploymentResult.java (from rev 33712, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7DeploymentResult.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/IJBoss7DeploymentResult.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/IJBoss7DeploymentResult.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.core.runtime.IStatus;
+
+public interface IJBoss7DeploymentResult {
+
+ public abstract IStatus getStatus() throws JBoss7ManangerException;
+
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/IJBoss7DeploymentResult.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/IJBoss7ManagerService.java (from rev 33712, 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.management.as7/src/org/jboss/ide/eclipse/as/management/as7/IJBoss7ManagerService.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/IJBoss7ManagerService.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * 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;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+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$
+
+ public static final int MGMT_PORT = 9999;
+
+ /**
+ * 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;
+
+ /**
+ * Returns the state of the server
+ *
+ * @param host the server to query
+ * @param port the port to communicate on
+ * @return the state of the server
+ *
+ * @throws Exception
+ */
+ public JBoss7ServerState getServerState(String host, int port) throws Exception;
+
+ /**
+ * Returns <code>true</code> if the server is running, <code>false</code>
+ * otherwise.
+ *
+ * @param host the server to to query
+ * @param port the port to communicate on
+ * @return true if it's running, false otherwise
+ * @throws Exception
+ */
+ public boolean isRunning(String host, int port) throws Exception;
+
+ @Deprecated
+ public JBoss7ServerState getServerState(String host) throws Exception;
+
+ /**
+ * Stops the given server
+ *
+ * @throws JBoss7ManangerException
+ * @throws Exception
+ */
+ public void stop(String host, int port) throws Exception;
+
+ @Deprecated
+ public void stop(String host) throws Exception;
+
+ public void dispose();
+}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7DeploymentState.java (from rev 33712, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7DeploymentState.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7DeploymentState.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7DeploymentState.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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;
+
+
+/**
+ * An enum that reflects the state of a deployment.
+ *
+ * @author André Dietisheim
+ */
+public enum JBoss7DeploymentState {
+ STARTED ,
+ STOPPED;
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7DeploymentState.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManagerServiceProxy.java (from rev 33758, 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/JBoss7ManagerServiceProxy.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManagerServiceProxy.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * 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;
+
+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;
+
+/**
+ * @author André Dietisheim
+ */
+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 JBoss7ServerState getServerState(String host, int port) throws Exception {
+ return checkedGetService().getServerState(host, port);
+ }
+
+ public boolean isRunning(String host, int port) throws Exception {
+ try {
+ return checkedGetService().isRunning(host, port);
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ @Deprecated
+ public JBoss7ServerState getServerState(String host) throws Exception {
+ return checkedGetService().getServerState(host);
+ }
+
+ public void stop(String host, int port) throws Exception {
+ checkedGetService().stop(host, port);
+ }
+
+ @Deprecated
+ 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.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManagerServiceProxy.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManagerUtil.java (from rev 33712, 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.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManagerUtil.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManagerUtil.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.internal.management.as7.Activator;
+import org.osgi.framework.BundleContext;
+
+public class JBoss7ManagerUtil {
+
+ private static final String JBOSS7_RUNTIME = "org.jboss.ide.eclipse.as.runtime.70"; //$NON-NLS-1$
+
+ public static IJBoss7ManagerService getService(IServer server) throws Exception {
+ BundleContext context = Activator.getContext();
+ JBoss7ManagerServiceProxy proxy = new JBoss7ManagerServiceProxy(context, getRequiredVersion(server));
+ proxy.open();
+ return proxy;
+ }
+
+ private static String getRequiredVersion(IServer server) {
+ String id = server.getRuntime().getRuntimeType().getId();
+ if (JBOSS7_RUNTIME.equals(id)) {
+ return IJBoss7ManagerService.AS_VERSION_700;
+ }
+ return null;
+ }
+
+ public static void dispose(IJBoss7ManagerService service) {
+ if (service != null) {
+ service.dispose();
+ }
+ }
+
+ public static <RESULT> RESULT executeWithService(IServiceAware<RESULT> serviceAware, IServer server) throws Exception {
+ IJBoss7ManagerService service = null;
+ try {
+ service = JBoss7ManagerUtil.getService(server);
+ return serviceAware.execute(service);
+ } finally {
+ if (service != null) {
+ service.dispose();
+ }
+ }
+ }
+
+ public static interface IServiceAware<RESULT> {
+
+ public RESULT execute(IJBoss7ManagerService service) throws Exception;
+
+ }
+
+}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManangerConnectException.java (from rev 33712, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangerConnectException.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManangerConnectException.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManangerConnectException.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.ide.eclipse.as.management.as7;
+
+/**
+ * @author André Dietisheim
+ */
+public class JBoss7ManangerConnectException extends JBoss7ManangerException {
+
+ private static final long serialVersionUID = 1L;
+
+ public JBoss7ManangerConnectException(Throwable cause) {
+ super(cause);
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManangerConnectException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManangerException.java (from rev 33712, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangerException.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManangerException.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ManangerException.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.ide.eclipse.as.management.as7;
+
+/**
+ * @author André Dietisheim
+ */
+public class JBoss7ManangerException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public JBoss7ManangerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public JBoss7ManangerException(Throwable cause) {
+ super(cause);
+ }
+
+ public JBoss7ManangerException(String message) {
+ super(message);
+ }
+
+}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ServerState.java (from rev 33712, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerState.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ServerState.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ServerState.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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;
+
+import java.text.MessageFormat;
+
+import org.jboss.ide.eclipse.as.internal.management.as7.AS7Messages;
+
+/**
+ * @author André Dietisheim
+ */
+public enum JBoss7ServerState {
+ STARTING, RUNNING, RESTART_REQUIRED;
+
+ public static JBoss7ServerState valueOfIgnoreCase(String stateString) {
+ JBoss7ServerState matchingState = null;
+ if (stateString != null && stateString.length() > 0) {
+ for (JBoss7ServerState availableState : values()) {
+ if (stateString.equalsIgnoreCase(availableState.name())) {
+ matchingState = availableState;
+ break;
+ }
+ }
+ }
+ if (matchingState == null) {
+ throw new IllegalArgumentException(MessageFormat.format(
+ AS7Messages.JBoss7ServerState_noEnumForString,
+ stateString));
+ }
+
+ return matchingState;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/JBoss7ServerState.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/META-INF/MANIFEST.MF 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/META-INF/MANIFEST.MF 2011-08-10 13:15:56 UTC (rev 33764)
@@ -28,3 +28,4 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.jboss.ide.eclipse.as.rse.core
Bundle-Localization: plugin
+Import-Package: org.jboss.ide.eclipse.as.management.as7
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7BehaviourDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7BehaviourDelegate.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7BehaviourDelegate.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -19,10 +19,10 @@
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
-import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManagerUtil;
import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7Server;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.management.as7.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ManagerUtil;
public class RSEJBoss7BehaviourDelegate extends RSEBehaviourDelegate {
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerIntegrationTest.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerIntegrationTest.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -23,11 +23,11 @@
import java.net.UnknownHostException;
import java.util.concurrent.ExecutionException;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ServerState;
import org.jboss.ide.eclipse.as.internal.management.as7.AS7Manager;
import org.jboss.ide.eclipse.as.internal.management.as7.tests.utils.AS7ManagerTestUtils;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7DeploymentState;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ManangerException;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ServerState;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/JBossManagementServiceTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/JBossManagementServiceTest.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/JBossManagementServiceTest.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -14,7 +14,7 @@
import java.net.UnknownHostException;
-import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.management.as7.IJBoss7ManagerService;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/utils/AS7ManagerTestUtils.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/utils/AS7ManagerTestUtils.java 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/utils/AS7ManagerTestUtils.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -25,9 +25,9 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
import org.jboss.ide.eclipse.as.internal.management.as7.AS7Manager;
+import org.jboss.ide.eclipse.as.management.as7.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ManangerException;
import org.osgi.framework.Bundle;
/**
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/META-INF/MANIFEST.MF 2011-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/META-INF/MANIFEST.MF 2011-08-10 13:15:56 UTC (rev 33764)
@@ -56,3 +56,4 @@
org.jboss.ide.eclipse.as.test.util,
org.jboss.ide.eclipse.as.test.util.jdt,
org.jboss.ide.eclipse.as.test.util.wtp
+Import-Package: org.jboss.ide.eclipse.as.management.as7
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-08-10 13:05:14 UTC (rev 33763)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java 2011-08-10 13:15:56 UTC (rev 33764)
@@ -17,12 +17,12 @@
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.JBoss7DeploymentState;
-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.core.server.internal.v7.JBoss7ServerState;
+import org.jboss.ide.eclipse.as.management.as7.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.management.as7.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7DeploymentState;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ManagerServiceProxy;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ManangerException;
+import org.jboss.ide.eclipse.as.management.as7.JBoss7ServerState;
import org.jboss.ide.eclipse.as.test.ASTest;
import org.junit.Test;
import org.osgi.framework.BundleContext;
14 years, 8 months
JBoss Tools SVN: r33763 - trunk/ws/tests/org.jboss.tools.ws.ui.bot.test.
by jbosstools-commits@lists.jboss.org
Author: lzoubek(a)redhat.com
Date: 2011-08-10 09:05:14 -0400 (Wed, 10 Aug 2011)
New Revision: 33763
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/build.properties
Log:
ws bot tests: add resources to build
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/build.properties
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/build.properties 2011-08-10 12:42:58 UTC (rev 33762)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/build.properties 2011-08-10 13:05:14 UTC (rev 33763)
@@ -2,4 +2,5 @@
resources/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ resources/
14 years, 8 months
JBoss Tools SVN: r33762 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext.
by jbosstools-commits@lists.jboss.org
Author: lzoubek(a)redhat.com
Date: 2011-08-10 08:42:58 -0400 (Wed, 10 Aug 2011)
New Revision: 33762
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java
Log:
swtbotext: log more
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java 2011-08-10 12:40:32 UTC (rev 33761)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java 2011-08-10 12:42:58 UTC (rev 33762)
@@ -367,14 +367,14 @@
+ klass.getCanonicalName();
log.info("Determine whether test classes meet configuration");
NamedSuite suite = new NamedSuite(klass,new RequirementAwareRunnerBuilder(config), suiteName);
+ // when no class mathces given config, do not init it
if (suite.getRunnerCount()>0) {
- log.info("Suite (configuration) '"+suiteName+"' initialized with "+suite.getRunnerCount()+" runners.");
- log.info(suite.getRunnerCount());
+ log.info("Configuration '"+config.getPropName()+"' initialized with "+suite.getRunnerCount()+" runners.");
runners.add(suite);
config.initialize();
}
else {
- log.info("Suite (configuration) '"+suiteName+"' skipped, no runners");
+ log.info("Configuration '"+config.getPropName()+"' skipped, no runners");
}
} catch (Exception ex) {
log.error("Error loading test configuration", ex);
14 years, 8 months
JBoss Tools SVN: r33761 - in trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext: config and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: lzoubek(a)redhat.com
Date: 2011-08-10 08:40:32 -0400 (Wed, 10 Aug 2011)
New Revision: 33761
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ESBBean.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/RuntimeBean.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ServerBean.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java
Log:
swtbotext: optimize multi-config test execution (do not download runtimes when no test runs against given config, do not run test on all configs when it does not require any runtime)
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java 2011-08-10 12:07:22 UTC (rev 33760)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java 2011-08-10 12:40:32 UTC (rev 33761)
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
@@ -44,7 +45,7 @@
final static DoAfterAllTestsRunListener cleanUp = new DoAfterAllTestsRunListener();
final Filter categoryFilter;
-
+
public static class CategoryFilter extends Filter {
public static CategoryFilter include(Class<?> categoryType) {
return new CategoryFilter(categoryType, null);
@@ -55,8 +56,8 @@
public CategoryFilter(Class<?> includedCategory,
Class<?> excludedCategory) {
- fIncluded= includedCategory;
- fExcluded= excludedCategory;
+ fIncluded = includedCategory;
+ fExcluded = excludedCategory;
}
@Override
@@ -75,7 +76,7 @@
}
private boolean hasCorrectCategoryAnnotation(Description description) {
- List<Class<?>> categories= categories(description);
+ List<Class<?>> categories = categories(description);
if (categories.isEmpty())
return fIncluded == null;
for (Class<?> each : categories)
@@ -88,25 +89,26 @@
}
private List<Class<?>> categories(Description description) {
- ArrayList<Class<?>> categories= new ArrayList<Class<?>>();
+ ArrayList<Class<?>> categories = new ArrayList<Class<?>>();
categories.addAll(Arrays.asList(directCategories(description)));
- //categories.addAll(Arrays.asList(directCategories(parentDescription(description))));
+ // categories.addAll(Arrays.asList(directCategories(parentDescription(description))));
return categories;
}
private Description parentDescription(Description description) {
// TODO: how heavy are we cringing?
- return Description.createSuiteDescription(description.getTestClass());
+ return Description.createSuiteDescription(description
+ .getTestClass());
}
private Class<?>[] directCategories(Description description) {
- Category annotation= description.getAnnotation(Category.class);
+ Category annotation = description.getAnnotation(Category.class);
if (annotation == null)
return new Class<?>[0];
return annotation.value();
}
- }
-
+ }
+
class ReqAwareClassRunner extends BlockJUnit4ClassRunner {
private final TestConfiguration config;
private final List<RequirementBase> requirements;
@@ -117,26 +119,31 @@
super(klass);
this.requirements = requirements;
this.config = config;
-
+
try {
filter(categoryFilter);
} catch (NoTestsRemainException e) {
// TODO Auto-generated catch block
throw new InitializationError(e);
}
-
+
}
+ public List<RequirementBase> getRequirements() {
+ return Collections.unmodifiableList(this.requirements);
+ }
+
@Override
protected List<FrameworkMethod> computeTestMethods() {
- List<FrameworkMethod> testMethods = getTestClass().getAnnotatedMethods(Test.class);
+ List<FrameworkMethod> testMethods = getTestClass()
+ .getAnnotatedMethods(Test.class);
for (FrameworkMethod method : testMethods) {
method.getAnnotation(Category.class);
}
return testMethods;
-
+
}
-
+
@Override
public void run(RunNotifier notifier) {
// planned test counter must know about all tests (methods) within a
@@ -196,15 +203,25 @@
if (!this.config.equals(TestConfigurator.currentConfig)) {
TestConfigurator.currentConfig = this.config;
}
- log.info("class "+klass.getCanonicalName());
- List<RequirementBase> reqs = TestConfigurator.getClassRequirements(klass);
+ log.info("class " + klass.getCanonicalName());
+ List<RequirementBase> reqs = TestConfigurator
+ .getClassRequirements(klass);
if (reqs != null) {
- SWTBotTestRequires anno = klass.getAnnotation(SWTBotTestRequires.class);
- if (anno!=null && anno.runOnce() && cleanUp.isClassPlanned(klass)) {
- // class is already planned to run and contains annotation runOnce
- log.info("runOnce=true, class already planned");
- log.info("Skipped");
- return null;
+ if (cleanUp.isClassPlanned(klass)) {
+ if (TestConfigurator.isRequiresRunOnce(klass)) {
+ // class is already scheduled to run and contains
+ // annotation runOnce
+ log.info("runOnce=true, class already planned");
+ log.info("Skipped");
+ return null;
+ }
+ if (!TestConfigurator.isRequiresAnyRuntime(klass)) {
+ // class is scheduled and does not require any runtime, thus
+ // no need to run it against other configuration
+ log.info("no runtimes required + class already planned");
+ log.info("Skipped");
+ return null;
+ }
}
log.info("OK");
// increment number of tests planned to run by 1 (class contains
@@ -222,7 +239,8 @@
/**
* listener which listens to test runs, does some cleanup after all tests
- * have run it also holds set of all classes which run (usefull for runOnce annotation)
+ * have run it also holds set of all classes which run (usefull for runOnce
+ * annotation)
*
* @author lzoubek
*
@@ -238,13 +256,15 @@
public void incrPlanned() {
testsAboutToRun += 1;
}
+
/**
* adds class to the list of skipped classes
+ *
* @param klass
*/
public void addSkippedClass(Class<?> klass) {
skippedClasses.add(klass.getName());
-
+
}
public void incrPlanned(int amount) {
@@ -262,24 +282,31 @@
public int getFinished() {
return testsFinished;
}
+
private Set<String> classes = new HashSet<String>();
+
/**
* adds class to runList - as it is planned to run
+ *
* @param klass
*/
public void addClass(Class<?> klass) {
classes.add(klass.getName());
}
+
public boolean isClassPlanned(Class<?> klass) {
return classes.contains(klass.getName());
}
+
/**
* set of classes that has been skipped (annotations not met etc)
*/
private Set<String> skippedClasses = new TreeSet<String>();
+
private void reportSkippedClasses() {
Set<String> finalized = new TreeSet<String>();
- // lets figure out if a class that has been at least once skipped was not planned
+ // lets figure out if a class that has been at least once skipped
+ // was not planned
for (String clazz : skippedClasses) {
if (!classes.contains(clazz)) {
finalized.add(clazz);
@@ -288,17 +315,18 @@
if (!finalized.isEmpty()) {
log.info("Several test classes have been skipped, see head of log to figure out why it happened");
for (String clazz : finalized) {
- log.info(" * "+clazz);
+ log.info(" * " + clazz);
}
}
}
+
@Override
public void testFinished(Description description) throws Exception {
incrFinished();
log.info("Finished test : " + description.getDisplayName());
log.info("Finished tests : " + getFinished() + "/" + getPlanned());
if (getFinished() >= getPlanned()) {
- log.info("All tests finished, performing cleanup requirements ");
+ log.info("All tests finished, performing cleanup requirements ");
try {
RequirementBase.createStopServer().fulfill();
RequirementBase.createStopDBServer().fulfill();
@@ -329,7 +357,7 @@
public RequirementAwareSuite(Class<?> klass) throws Throwable {
super(klass, Collections.<Runner> emptyList());
log.info("Loading test configurations");
-
+
for (Entry<Object, Object> entry : TestConfigurator.multiProperties
.entrySet()) {
try {
@@ -338,23 +366,30 @@
String suiteName = config.getPropName() + " - "
+ klass.getCanonicalName();
log.info("Determine whether test classes meet configuration");
- runners.add(new NamedSuite(klass,
- new RequirementAwareRunnerBuilder(config), suiteName));
+ NamedSuite suite = new NamedSuite(klass,new RequirementAwareRunnerBuilder(config), suiteName);
+ if (suite.getRunnerCount()>0) {
+ log.info("Suite (configuration) '"+suiteName+"' initialized with "+suite.getRunnerCount()+" runners.");
+ log.info(suite.getRunnerCount());
+ runners.add(suite);
+ config.initialize();
+ }
+ else {
+ log.info("Suite (configuration) '"+suiteName+"' skipped, no runners");
+ }
} catch (Exception ex) {
log.error("Error loading test configuration", ex);
- throw ex;
+ throw ex;
}
}
-
+
try {
categoryFilter = new CategoryFilter(getIncludedCategory(klass),
- getExcludedCategory(klass));
+ getExcludedCategory(klass));
filter(categoryFilter);
-
+
} catch (NoTestsRemainException e) {
throw new InitializationError(e);
}
-
}
@Override
@@ -370,21 +405,28 @@
super(klass, builder);
this.suiteName = name;
}
+ /**
+ * gets count of test runners within this suite
+ * @return
+ */
+ public int getRunnerCount() {
+ return getChildren().size();
+ }
@Override
protected String getName() {
return suiteName;
}
+ }
- }
-
private Class<?> getIncludedCategory(Class<?> klass) {
- IncludeCategory annotation= klass.getAnnotation(IncludeCategory.class);
+ IncludeCategory annotation = klass.getAnnotation(IncludeCategory.class);
return annotation == null ? null : annotation.value();
}
private Class<?> getExcludedCategory(Class<?> klass) {
- ExcludeCategory annotation= klass.getAnnotation(ExcludeCategory.class);
+ ExcludeCategory annotation = klass.getAnnotation(ExcludeCategory.class);
return annotation == null ? null : annotation.value();
}
+
}
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ESBBean.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ESBBean.java 2011-08-10 12:07:22 UTC (rev 33760)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ESBBean.java 2011-08-10 12:40:32 UTC (rev 33761)
@@ -5,10 +5,6 @@
this.key = TestConfigurator.Keys.ESB;
}
- public static ESBBean fromString(String propValue, String url) throws Exception {
- return (ESBBean)fromString(propValue, url, new ESBBean());
- }
-
public static ESBBean fromString(String propValue) throws Exception {
return (ESBBean)fromString(propValue, new ESBBean());
}
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/RuntimeBean.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/RuntimeBean.java 2011-08-10 12:07:22 UTC (rev 33760)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/RuntimeBean.java 2011-08-10 12:40:32 UTC (rev 33761)
@@ -36,16 +36,14 @@
}
}
- protected static RuntimeBean fromString(String propValue, String url, RuntimeBean bean) throws Exception {
- bean = fromString(propValue, bean);
- if (bean!=null && url!=null) {
+ protected void getRuntime(String url) throws Exception {
+ if (url!=null) {
String runtimeFile = downloadRuntime(url);
if (runtimeFile!=null) {
- File runtimeHomeAbs = new File(bean.runtimeHome).getAbsoluteFile();
+ File runtimeHomeAbs = new File(runtimeHome).getAbsoluteFile();
FileHelper.unzipArchive(new File(runtimeFile), runtimeHomeAbs.getParentFile());
}
}
- return bean;
}
@Override
public String toString() {
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ServerBean.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ServerBean.java 2011-08-10 12:07:22 UTC (rev 33760)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ServerBean.java 2011-08-10 12:40:32 UTC (rev 33761)
@@ -21,15 +21,14 @@
* home of app server located in remote system
*/
public String remoteHome;
- public static ServerBean fromString(String propValue, String url) throws Exception {
- ServerBean bean = fromString(propValue);
- if (bean!=null && url!=null) {
+ public void getRuntime (String url) throws Exception {
+ if (url!=null) {
String runtimeFile = downloadRuntime(url);
if (runtimeFile!=null) {
// where to unzip it?
File runtimeOutput;
- File runtimeHomeAbs = new File(bean.runtimeHome).getAbsoluteFile();
- if (TestConfigurator.Values.SERVER_TYPE_JBOSSAS.equals(bean.type)) {
+ File runtimeHomeAbs = new File(runtimeHome).getAbsoluteFile();
+ if (TestConfigurator.Values.SERVER_TYPE_JBOSSAS.equals(type)) {
runtimeOutput=runtimeHomeAbs.getParentFile();
}
else {
@@ -38,7 +37,6 @@
FileHelper.unzipArchive(new File(runtimeFile), runtimeOutput);
}
}
- return bean;
}
/**
* creates bean instance from property string
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java 2011-08-10 12:07:22 UTC (rev 33760)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java 2011-08-10 12:40:32 UTC (rev 33761)
@@ -65,15 +65,13 @@
substSystemProperties();
java = JavaBean.fromString(getProperty(Keys.JAVA));
printConfig(Keys.JAVA, java);
- server = ServerBean.fromString(getProperty(Keys.SERVER),
- getProperty(Keys.SERVER + TestConfigurator.RUNTIME_URL_SUFFIX));
+ server = ServerBean.fromString(getProperty(Keys.SERVER));
printConfig(Keys.SERVER, server);
remoteSystem = RemoteSystemBean.fromString(getProperty(Keys.RS));
printConfig(Keys.RS, remoteSystem);
seam = SeamBean.fromString(getProperty(Keys.SEAM));
printConfig(Keys.SEAM, seam);
- esb = ESBBean.fromString(getProperty(Keys.ESB),
- getProperty(Keys.ESB + TestConfigurator.RUNTIME_URL_SUFFIX));
+ esb = ESBBean.fromString(getProperty(Keys.ESB));
printConfig(Keys.ESB, esb);
jbpm = JBPMBean.fromString(getProperty(Keys.JBPM));
printConfig(Keys.JBPM, jbpm);
@@ -81,8 +79,26 @@
printConfig(Keys.DB, db);
secureStorage = SecureStorage.fromString(Keys.SS, getProperty(Keys.SS));
printConfig("Secure Storage", secureStorage);
+ }
+ /**
+ * initializes this configuration - runtimes, downloaded, homes checked
+ */
+ public void initialize() throws Exception {
+ getRuntime(server);
+ getRuntime(esb);
+ getRuntime(seam);
checkConfig();
}
+ /**
+ * attempts to get (download) runtime zip for given bean
+ * @param bean
+ * @throws Exception
+ */
+ private void getRuntime(RuntimeBean bean) throws Exception {
+ if (bean!=null) {
+ bean.getRuntime(getProperty(bean.key+TestConfigurator.RUNTIME_URL_SUFFIX));
+ }
+ }
/**
* replaces system properties in configuration property values
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2011-08-10 12:07:22 UTC (rev 33760)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2011-08-10 12:40:32 UTC (rev 33761)
@@ -80,12 +80,12 @@
boolean loadDefault = true;
try {
- Pattern configMatch = Pattern.compile("nomatch");
+ Pattern configMatch = Pattern.compile("");
try {
- configMatch = Pattern.compile(System.getProperty(CONFIGURATIONS_IGNORE, "nomatch"));
+ configMatch = Pattern.compile(System.getProperty(CONFIGURATIONS_IGNORE, ""));
}
catch (Exception ex) {
- log.error("Error parsing property "+CONFIGURATIONS_IGNORE,ex);
+ log.error("Error parsing regex property "+CONFIGURATIONS_IGNORE,ex);
}
// try to load from file first
String propFile = System.getProperty(SWTBOT_TEST_PROPERTIES_FILE,
@@ -316,8 +316,35 @@
}
return RequirementBase.prepareDB();
}
-
/**
+ * returns true if given class requires any of all possible runtimes
+ * @param klass
+ * @return
+ */
+ public static boolean isRequiresAnyRuntime(Class<?> klass) {
+ SWTBotTestRequires an = klass
+ .getAnnotation(SWTBotTestRequires.class);
+ if (an==null) {
+ return false;
+ }
+ return an.db().required() || an.esb().required()
+ || an.jbpm().required() || an.seam().required()
+ || an.server().required();
+ }
+ /**
+ * returns true if given class has {@link SWTBotTestRequires#runOnce()} annotation set to true
+ * @param klass
+ * @return
+ */
+ public static boolean isRequiresRunOnce(Class<?> klass) {
+ SWTBotTestRequires an = klass
+ .getAnnotation(SWTBotTestRequires.class);
+ if (an==null) {
+ return false;
+ }
+ return an.runOnce();
+ }
+ /**
* returns list of requirements if given class (Test) can run, all this is
* done by exploring class'es annotations (see {@link SWTBotTestRequires}) and check against
* current configuration
14 years, 8 months
JBoss Tools SVN: r33760 - in trunk: ws/tests/org.jboss.tools.ws.ui.bot.test and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2011-08-10 08:07:22 -0400 (Wed, 10 Aug 2011)
New Revision: 33760
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/Rest.java.ws
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/.project
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/.project
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/jbt/SampleWSTest.java
Log:
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/.project
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/.project 2011-08-10 11:00:15 UTC (rev 33759)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/.project 2011-08-10 12:07:22 UTC (rev 33760)
@@ -42,4 +42,11 @@
<nature>org.jboss.tools.jst.web.kb.kbnature</nature>
<nature>org.jboss.tools.cdi.core.cdinature</nature>
</natures>
+ <linkedResources>
+ <link>
+ <name>lib-src</name>
+ <type>2</type>
+ <location>/home/jjankovi/Dokumenty/Trunk-svn/trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src</location>
+ </link>
+ </linkedResources>
</projectDescription>
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/.project
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/.project 2011-08-10 11:00:15 UTC (rev 33759)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/.project 2011-08-10 12:07:22 UTC (rev 33760)
@@ -43,4 +43,16 @@
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
+ <linkedResources>
+ <link>
+ <name>lib-src</name>
+ <type>2</type>
+ <location>/home/jjankovi/Dokumenty/Trunk-svn/trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src</location>
+ </link>
+ <link>
+ <name>lib-src-1</name>
+ <type>2</type>
+ <location>/home/jjankovi/Dokumenty/Trunk-svn/trunk/tests/plugins/org.jboss.tools.tests/src</location>
+ </link>
+ </linkedResources>
</projectDescription>
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/Rest.java.ws
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/Rest.java.ws (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/Rest.java.ws 2011-08-10 12:07:22 UTC (rev 33760)
@@ -0,0 +1,49 @@
+package rest.sample;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+@Path("/RESTSample")
+public class Sample {
+
+ @GET()
+ @Produces("text/plain")
+ public String method1() {
+ return "Hello World!";
+ }
+
+
+
+ @GET()
+ @Path("{name}")
+ @Produces("text/plain")
+ public String method2(@PathParam("name")String name) {
+ return "Hello " + name;
+ }
+
+ @POST()
+ @Path("PostMethod")
+ @Produces("text/plain")
+ public void method3() {
+
+ }
+
+ @PUT()
+ @Path("PutMethod")
+ public void method4() {
+
+ }
+
+
+ @DELETE()
+ @Path("DeleteMethod")
+ public void method5() {
+
+ }
+
+}
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java 2011-08-10 11:00:15 UTC (rev 33759)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java 2011-08-10 12:07:22 UTC (rev 33760)
@@ -36,6 +36,7 @@
* Suite duration: aprox. 13min
*
* @author Lukas Jungmann
+ * @author jjankovi
*/
@SuiteClasses({
SampleWSTest.class,
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/jbt/SampleWSTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/jbt/SampleWSTest.java 2011-08-10 11:00:15 UTC (rev 33759)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/jbt/SampleWSTest.java 2011-08-10 12:07:22 UTC (rev 33760)
@@ -11,9 +11,11 @@
package org.jboss.tools.ws.ui.bot.test.jbt;
import java.io.IOException;
+import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -22,15 +24,13 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
-import org.jboss.tools.ui.bot.ext.entity.JavaProjectEntity;
import org.jboss.tools.ws.ui.bot.test.uiutils.actions.NewSampleWSWizardAction;
import org.jboss.tools.ws.ui.bot.test.uiutils.actions.TreeItemAction;
import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.SampleWSWizard;
@@ -38,6 +38,7 @@
import org.jboss.tools.ws.ui.bot.test.utils.WSClient;
import org.jboss.tools.ws.ui.bot.test.wtp.WSTestBase;
import org.junit.AfterClass;
+import org.junit.Ignore;
import org.junit.Test;
@SWTBotTestRequires(server =
@@ -96,26 +97,13 @@
createDD(project);
}
assertTrue(dd.exists());
- createSampleRESTWS(project, "RESTSample", "rest.sample", "Sample", "RESTApp");
+ createSampleRESTWS(project, "RESTSample", "rest.sample", "Sample", "RESTApp");
checkRESTService(project, "RESTSample", "rest.sample", "Sample", "Hello World!", "RESTApp");
- }
+ }
-
-
- /*
- * Adding Rest support through context menu is available from JBT 3.3.0 M2
- */
- @Test
- public void testImportRestSupport() {
- String projectName = "RestLessProject";
- JavaProjectEntity javaProject = new JavaProjectEntity();
- javaProject.setProjectName(projectName);
- eclipse.createJavaProject(javaProject);
- SWTBotTree tree = projectExplorer.bot().tree();
- assertTrue("Project " + projectName + " was not created properly",
- SWTEclipseExt.treeContainsItemWithLabel(tree, projectName));
- SWTBotTreeItem ti = tree.expandNode(projectName);
-
+ private void addRestSupport(String project) {
+ SWTBotTree tree = projectExplorer.bot().tree();
+ SWTBotTreeItem ti = tree.expandNode(project);
new TreeItemAction(ti, "Configure","Add JAX-RS 1.1 support...").run();
bot.sleep(500);
util.waitForNonIgnoredJobs();
@@ -123,8 +111,47 @@
ti.getNode("RESTful Web Services");
}catch (WidgetNotFoundException exc) {
fail("REST support was not configured properly");
+ }
+ }
+
+ private void checkRestSupport(String project, String servName) {
+ SWTBotTree tree = projectExplorer.bot().tree();
+ SWTBotTreeItem ti = tree.expandNode(project,"RESTful Web Services");
+ ArrayList<String> nodes = (ArrayList<String>)ti.getNodes();
+
+
+ assertTrue("Should be 2 GET services instead of " +
+ numberOfService(nodes,"GET"), numberOfService(nodes,"GET") == 2);
+ assertTrue("Should be 1 DELETE service instead of " +
+ numberOfService(nodes,"DELETE"), numberOfService(nodes,"DELETE") == 1);
+ assertTrue("Should be 1 POST service instead of " +
+ numberOfService(nodes,"POST"), numberOfService(nodes,"POST") == 1);
+ assertTrue("Should be 1 PUT service instead of " +
+ numberOfService(nodes,"PUT"), numberOfService(nodes,"PUT") == 1);
+
+
+ assertTrue("Node's form should be {GET /RESTSample} instead of {" +
+ nodes.get(0) + "}",nodes.get(0).equals("GET /" + servName));
+ assertTrue("Node's form should be {DELETE /RESTSample/DeleteMethod} instead of {" +
+ nodes.get(1) + "}",nodes.get(1).equals("DELETE /" + servName + "/DeleteMethod"));
+ assertTrue("Node's form should be {POST /RESTSample/PostMethod} instead of {" +
+ nodes.get(2) + "}",nodes.get(2).equals("POST /" + servName + "/PostMethod"));
+ assertTrue("Node's form should be {PUT /RESTSample/PutMethod} instead of {" +
+ nodes.get(3) + "}",nodes.get(3).equals("PUT /" + servName + "/PutMethod"));
+ assertTrue("Node's form should be {GET /RESTSample/{name}} instead of {" +
+ nodes.get(4) + "}",nodes.get(4).equals("GET /" + servName + "/{name}"));
+
+ }
+
+ private int numberOfService(ArrayList<String> services, String serviceType) {
+ int count = 0;
+ for (String service: services) {
+ if (service.contains(serviceType)) {
+ count++;
+ }
}
- }
+ return count;
+ }
private void createDD(String project) {
SWTBotTree tree = projectExplorer.bot().tree();
@@ -136,31 +163,33 @@
util.waitForNonIgnoredJobs();
bot.sleep(1500);
}
-
- // createSampleSOAPWS(getWsProjectName(), "HelloService", "sample", "SampleService");
- //createSampleService(Type.SOAP, project, name, pkg, cls, null);
+
private void createSampleSOAPWS(String project, String name, String pkg, String cls) {
createSampleService(Type.SOAP, project, name, pkg, cls, null);
}
-
- //checkSOAPService(getWsProjectName(), "HelloService", "sample", "SampleService", "You");
+
private void checkSOAPService(String project, String svcName, String svcPkg, String svcClass, String msgContent) {
checkService(Type.SOAP, project, svcName, svcPkg, svcClass, msgContent, null);
}
private void checkRESTService(String project, String svcName, String svcPkg, String svcClass, String msgContent, String appCls) {
checkService(Type.REST, project, svcName, svcPkg, svcClass, msgContent, appCls);
+ addRestSupport(project);
+ checkRestSupport(project,svcName);
}
private void createSampleRESTWS(String project, String name, String pkg, String cls, String appCls) {
- createSampleService(Type.REST, project, name, pkg, cls, appCls);
+ SWTBotEditor ed = createSampleService(Type.REST, project, name, pkg, cls, appCls);
+ SWTBotEclipseEditor st = ed.toTextEditor();
+ st.selectRange(0, 0, st.getText().length());
+ InputStream javasrc = SampleWSTest.class.getResourceAsStream("/resources/jbossws/Rest.java.ws");
+ String code = readStream(javasrc);
+ st.setText(code);
+ ed.save();
}
-
-
- // createSampleSOAPWS(getWsProjectName(), "HelloService", "sample", "SampleService");
- //createSampleService(Type.SOAP, project, name, pkg, cls, null);
- private void createSampleService(Type type, String project, String name, String pkg, String cls, String appCls) {
+
+ private SWTBotEditor createSampleService(Type type, String project, String name, String pkg, String cls, String appCls) {
SampleWSWizard w = new NewSampleWSWizardAction(type).run();
w.setProjectName(project).setServiceName(name);
w.setPackageName(pkg).setClassName(cls);
@@ -169,6 +198,7 @@
}
w.finish();
util.waitForNonIgnoredJobs();
+ return bot.editorByTitle(cls + ".java");
}
private void checkService(Type type, String project, String svcName, String svcPkg, String svcClass, String msgContent, String appCls) {
14 years, 8 months
JBoss Tools SVN: r33759 - trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test.
by jbosstools-commits@lists.jboss.org
Author: psrna
Date: 2011-08-10 07:00:15 -0400 (Wed, 10 Aug 2011)
New Revision: 33759
Modified:
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/build.properties
Log:
test projects added to bin.include in bpel bot test
Modified: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/build.properties
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/build.properties 2011-08-10 09:59:47 UTC (rev 33758)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/build.properties 2011-08-10 11:00:15 UTC (rev 33759)
@@ -1,6 +1,8 @@
output.. = bin/
bin.includes = .,\
- META-INF/
+ META-INF/,\
+ projects/,\
+ test_project.zip
source.. = src/
src.includes = META-INF/,\
.,\
14 years, 8 months
JBoss Tools SVN: r33758 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-08-10 05:59:47 -0400 (Wed, 10 Aug 2011)
New Revision: 33758
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java
Log:
added copyright header and author comment
Modified: 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.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java 2011-08-10 09:56:27 UTC (rev 33757)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java 2011-08-10 09:59:47 UTC (rev 33758)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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;
@@ -9,6 +19,9 @@
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.util.tracker.ServiceTracker;
+/**
+ * @author André Dietisheim
+ */
public class JBoss7ManagerServiceProxy extends ServiceTracker<IJBoss7ManagerService, IJBoss7ManagerService>
implements IJBoss7ManagerService {
14 years, 8 months
JBoss Tools SVN: r33757 - in trunk/as: plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-08-10 05:56:27 -0400 (Wed, 10 Aug 2011)
New Revision: 33757
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/Activator.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DeploymentOperationResult.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/ModelDescriptionConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/util/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/util/AS7ManagerUtil.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/AS7Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/AS7Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/Activator.java
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/AS7ManagerUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentOperationResult.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/ModelDescriptionConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF
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/internal/management/as7/CommandFormatException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/CommandLineException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DefaultOperationRequestAddress.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DefaultOperationRequestBuilder.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/OperationFormatException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/OperationRequestAddress.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/OperationRequestBuilder.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/ValidatingOperationCallbackHandler.java
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/utils/AS7ManagerTestUtils.java
Log:
[JBIDE-9500] corrected package structure to reflect what's being exported/hidden
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF 2011-08-10 09:14:55 UTC (rev 33756)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF 2011-08-10 09:56:27 UTC (rev 33757)
@@ -3,7 +3,7 @@
Bundle-Name: JBoss AS7 management API
Bundle-SymbolicName: org.jboss.ide.eclipse.as.management.as7
Bundle-Version: 2.3.0.qualifier
-Bundle-Activator: org.jboss.ide.eclipse.as.management.as7.Activator
+Bundle-Activator: org.jboss.ide.eclipse.as.internal.management.as7.Activator
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.jboss.ide.eclipse.as.core
Bundle-ActivationPolicy: lazy
@@ -20,5 +20,5 @@
xnio-api-3.0.0.Beta3.jar,
xnio-nio-3.0.0.Beta3.jar
Service-Component: META-INF/jboss-management-service.xml
-Export-Package: org.jboss.ide.eclipse.as.management.as7.deployment;x-friends:="org.jboss.ide.eclipse.as.management.as7.tests"
+Export-Package: org.jboss.ide.eclipse.as.internal.management.as7;x-friends:="org.jboss.ide.eclipse.as.management.as7.tests"
Bundle-Vendor: JBoss by Red Hat
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-08-10 09:14:55 UTC (rev 33756)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/jboss-management-service.xml 2011-08-10 09:56:27 UTC (rev 33757)
@@ -1,6 +1,6 @@
<?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.JBoss7ManagerService"/>
+ <implementation class="org.jboss.ide.eclipse.as.internal.management.as7.JBoss7ManagerService"/>
<service>
<provide interface="org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService"/>
</service>
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java (from rev 33714, 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/internal/management/as7/AS7Manager.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * 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.internal.management.as7;
+
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.ADDRESS;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.DEPLOYMENT;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.ENABLED;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.FAILURE_DESCRIPTION;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.NAME;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.OP;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.READ_RESOURCE_OPERATION;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.RESULT;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.SERVER_STATE;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.SHUTDOWN;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.UnknownHostException;
+import java.util.concurrent.Future;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.helpers.standalone.DeploymentAction;
+import org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
+import org.jboss.as.protocol.old.StreamUtils;
+import org.jboss.dmr.ModelNode;
+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;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ServerState;
+import org.jboss.ide.eclipse.as.internal.management.as7.util.AS7ManagerUtil;
+
+/**
+ * @author André Dietisheim
+ */
+public class AS7Manager {
+
+ public static final int MGMT_PORT = 9999;
+
+ private ModelControllerClient client;
+ private ServerDeploymentManager manager;
+
+ 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);
+ }
+
+ public IJBoss7DeploymentResult undeploySync(String name, IProgressMonitor monitor)
+ throws JBoss7ManangerException {
+ IJBoss7DeploymentResult result = undeploy(name);
+ result.getStatus();
+ return result;
+ }
+
+ public IJBoss7DeploymentResult deploySync(String name, File file, IProgressMonitor monitor)
+ throws JBoss7ManangerException {
+ IJBoss7DeploymentResult result = deploy(name, file);
+ result.getStatus();
+ return result;
+ }
+
+ public IJBoss7DeploymentResult undeploy(String name) throws JBoss7ManangerException {
+ try {
+ DeploymentPlanBuilder builder = manager.newDeploymentPlan();
+ builder = builder.undeploy(name).andRemoveUndeployed();
+ return new DeploymentOperationResult(builder.getLastAction(), manager.execute(builder.build()));
+ } catch (Exception e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ public IJBoss7DeploymentResult remove(String name) throws JBoss7ManangerException {
+ try {
+ DeploymentPlanBuilder builder = manager.newDeploymentPlan();
+ builder = builder.remove(name);
+ return new DeploymentOperationResult(builder.getLastAction(), manager.execute(builder.build()));
+ } catch (Exception e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ public IJBoss7DeploymentResult deploy(File file) throws JBoss7ManangerException {
+ return deploy(file.getName(), file);
+ }
+
+ public IJBoss7DeploymentResult add(String name, File file) throws JBoss7ManangerException {
+ try {
+ return execute(manager.newDeploymentPlan().add(name, file));
+ } catch (IOException e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ public IJBoss7DeploymentResult deploy(String name, File file) throws JBoss7ManangerException {
+ try {
+ return execute(manager.newDeploymentPlan().add(name, file).andDeploy());
+ } catch (IOException e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ public IJBoss7DeploymentResult replace(File file) throws JBoss7ManangerException {
+ return replace(file.getName(), file);
+ }
+
+ public IJBoss7DeploymentResult replace(String name, File file) throws JBoss7ManangerException {
+ try {
+ return execute(manager.newDeploymentPlan().replace(name, file));
+ } catch (IOException e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ public JBoss7DeploymentState getDeploymentState(String name) throws JBoss7ManangerException {
+ ModelNode request = new ModelNode();
+ request.get(OP).set(READ_RESOURCE_OPERATION);
+ request.get(ADDRESS).add(DEPLOYMENT, name);
+ ModelNode result = execute(request);
+
+ Boolean enabled = AS7ManagerUtil.getBooleanProperty(ENABLED, result);
+ if (enabled == null) {
+ throw new JBoss7ManangerException(
+ NLS.bind(AS7Messages.ModuleStateEvaluationFailed, name));
+ } else if (enabled) {
+ return JBoss7DeploymentState.STARTED;
+ } else {
+ return JBoss7DeploymentState.STOPPED;
+ }
+ }
+
+ /**
+ * Shuts the server down.
+ *
+ * @throws JBoss7ManangerException
+ */
+ public void stopServer() throws JBoss7ManangerException {
+ ModelNode request = new ModelNode();
+ request.get(OP).set(SHUTDOWN);
+ quietlyExecute(request);
+ }
+
+ public JBoss7ServerState getServerState() throws JBoss7ManangerException {
+ ModelNode request = new ModelNode();
+ request.get(OP).set(READ_ATTRIBUTE_OPERATION);
+ request.get(NAME).set(SERVER_STATE);
+ ModelNode response = execute(request);
+ return toJBoss7ServerState(response);
+ }
+
+ public boolean isRunning() {
+ try {
+ return getServerState() == JBoss7ServerState.RUNNING;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ private JBoss7ServerState toJBoss7ServerState(ModelNode response) throws JBoss7ManangerException {
+ try {
+ return JBoss7ServerState.valueOfIgnoreCase(response.asString());
+ } catch (IllegalArgumentException e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ public void dispose() {
+ StreamUtils.safeClose(client);
+ }
+
+ private ModelNode execute(ModelNode node) throws JBoss7ManangerException {
+ try {
+ 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) }
+ ));
+ }
+ return response.get(RESULT);
+ } catch (Exception e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ public void quietlyExecute(ModelNode node) throws JBoss7ManangerException {
+ try {
+ client.execute(node);
+ } catch (Exception e) {
+ if (!isConnectionCloseException(e)) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+ }
+
+ private boolean isConnectionCloseException(Exception e) {
+ return e instanceof IOException
+ && e.getMessage() != null
+ && e.getMessage().indexOf("Channel closed") > -1;
+ }
+
+ private IJBoss7DeploymentResult execute(DeploymentPlanBuilder builder) throws JBoss7ManangerException {
+ try {
+ DeploymentAction action = builder.getLastAction();
+ Future<ServerDeploymentPlanResult> planResult = manager.execute(builder.build());
+ return new DeploymentOperationResult(action, planResult);
+ } catch (Exception e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+}
\ No newline at end of file
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.java (from rev 33712, trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/AS7Messages.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.internal.management.as7;
+
+import org.eclipse.osgi.util.NLS;
+
+public class AS7Messages extends NLS {
+ public static String ModuleStateEvaluationFailed;
+ public static String OperationOnAddressFailed;
+ public static String FailedToBuildOperation;
+ public static String OperationOutcomeToString;
+ public static String OperationOnUnitNotExecuted;
+ public static String OperationOnUnitFailed;
+ public static String OperationOnUnitRolledBack;
+ public static String OperationNotExecConfigRequiresRestart;
+ static {
+ NLS.initializeMessages("org.jboss.ide.eclipse.as.management.as7.AS7Messages", //$NON-NLS-1$
+ AS7Messages.class);
+ }
+
+}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.properties (from rev 33712, trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/AS7Messages.properties)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.properties (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Messages.properties 2011-08-10 09:56:27 UTC (rev 33757)
@@ -0,0 +1,8 @@
+ModuleStateEvaluationFailed=Could not evaluate state for deployment {0}
+OperationOnAddressFailed=Could not execute {0} for {1}. Failure was {2}.
+FailedToBuildOperation=Failed to build operation.
+OperationOutcomeToString=Operation outcome is {0}.
+OperationOnUnitNotExecuted=The operation {0} was not executed on unit {1}
+OperationOnUnitFailed=The operation {0} failed for unit {1}
+OperationOnUnitRolledBack=The operation {0} for unit {1} was rolled back
+OperationNotExecConfigRequiresRestart=The operation {0} was not executed on unit {1}. The server configuration was changed though and the server needs to be restarted.
\ No newline at end of file
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/Activator.java (from rev 33712, trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/Activator.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/Activator.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/Activator.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -0,0 +1,54 @@
+package org.jboss.ide.eclipse.as.internal.management.as7;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.management.as7"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ public static BundleContext getContext() {
+ return plugin.getBundle().getBundleContext();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/CommandFormatException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/CommandFormatException.java 2011-08-09 08:44:16 UTC (rev 33712)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/CommandFormatException.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.ide.eclipse.as.management.as7.internal;
+package org.jboss.ide.eclipse.as.internal.management.as7;
/**
* @author Alexey Loubyansky
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/CommandLineException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/CommandLineException.java 2011-08-09 08:44:16 UTC (rev 33712)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/CommandLineException.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.ide.eclipse.as.management.as7.internal;
+package org.jboss.ide.eclipse.as.internal.management.as7;
/**
* @author Alexey Loubyansky
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DefaultOperationRequestAddress.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/DefaultOperationRequestAddress.java 2011-08-09 08:44:16 UTC (rev 33712)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DefaultOperationRequestAddress.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.ide.eclipse.as.management.as7.internal;
+package org.jboss.ide.eclipse.as.internal.management.as7;
import java.util.ArrayList;
import java.util.Iterator;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DefaultOperationRequestBuilder.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/DefaultOperationRequestBuilder.java 2011-08-09 08:44:16 UTC (rev 33712)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DefaultOperationRequestBuilder.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.ide.eclipse.as.management.as7.internal;
+package org.jboss.ide.eclipse.as.internal.management.as7;
import java.io.IOException;
import java.util.Iterator;
@@ -28,7 +28,7 @@
import javax.security.auth.callback.UnsupportedCallbackException;
import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as.management.as7.internal.OperationRequestAddress.Node;
+import org.jboss.ide.eclipse.as.internal.management.as7.OperationRequestAddress.Node;
/**
*
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DeploymentOperationResult.java (from rev 33712, trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentOperationResult.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DeploymentOperationResult.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DeploymentOperationResult.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * 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.internal.management.as7;
+
+import java.text.MessageFormat;
+import java.util.concurrent.Future;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.as.controller.client.helpers.standalone.DeploymentAction;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentActionResult;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
+
+/**
+ * A class that holds the status of a deployment operation.
+ *
+ * @author André Dietisheim
+ *
+ */
+public class DeploymentOperationResult implements IJBoss7DeploymentResult {
+
+ private Future<ServerDeploymentPlanResult> planResult;
+ private DeploymentAction action;
+
+ DeploymentOperationResult(DeploymentAction action, Future<ServerDeploymentPlanResult> planResult) {
+ Assert.isNotNull(action);
+ this.action = action;
+ Assert.isNotNull(planResult);
+ this.planResult = planResult;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ide.eclipse.as.management.as7.deployment.IDeploymentResult#getStatus()
+ */
+ @Override
+ public IStatus getStatus() throws JBoss7ManangerException {
+ try {
+ ServerDeploymentActionResult actionResult = planResult.get().getDeploymentActionResult(action.getId());
+ return createStatus(action.getDeploymentUnitUniqueName(), action.getType().name(), actionResult);
+ } catch (Exception e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+
+ private IStatus createStatus(String deploymentName, String actionName, ServerDeploymentActionResult actionResult) {
+ if (actionResult == null) {
+ return null;
+ }
+
+ IStatus status = null;
+ switch (actionResult.getResult()) {
+ case NOT_EXECUTED:
+ status = createStatus(IStatus.ERROR, NLS.bind(
+ AS7Messages.OperationOnUnitNotExecuted,
+ actionName, deploymentName));
+ break;
+ case EXECUTED:
+ status = Status.OK_STATUS;
+ break;
+ case FAILED:
+ status = createStatus(IStatus.ERROR, NLS.bind(AS7Messages.OperationOnUnitFailed,
+ actionName, deploymentName));
+ break;
+ case ROLLED_BACK:
+ status = createStatus(IStatus.ERROR,
+ NLS.bind(AS7Messages.OperationOnUnitRolledBack,
+ actionName, deploymentName));
+ break;
+ case CONFIGURATION_MODIFIED_REQUIRES_RESTART:
+ status = createStatus(
+ IStatus.WARNING,
+ NLS.bind(AS7Messages.OperationNotExecConfigRequiresRestart,
+ actionName, deploymentName));
+ break;
+ }
+ return status;
+ }
+
+ private IStatus createStatus(int severity, String messagePattern, Object... messageArguments) {
+ return new Status(severity, Activator.getContext().getBundle().getSymbolicName(), MessageFormat.format(
+ messagePattern, messageArguments));
+ }
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/DeploymentOperationResult.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java (from rev 33717, trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * 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.internal.management.as7;
+
+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;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ServerState;
+
+/**
+ * @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);
+ }
+
+ @Deprecated
+ public JBoss7ServerState getServerState(String host) throws Exception {
+ return getServerState(host, AS7Manager.MGMT_PORT);
+ }
+
+ public JBoss7ServerState getServerState(String host, int port) throws Exception {
+ AS7Manager manager = new AS7Manager(host, port);
+ return manager.getServerState();
+ }
+
+ public boolean isRunning(String host, int port) throws Exception {
+ return new AS7Manager(host, port).isRunning();
+ }
+
+ @Deprecated
+ public void stop(String host) throws Exception {
+ stop(host, AS7Manager.MGMT_PORT);
+ }
+
+ public void stop(String host, int port) throws Exception {
+ new AS7Manager(host, port).stopServer();
+ }
+
+ @Override
+ public void dispose() {
+ }
+}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/ModelDescriptionConstants.java (from rev 33712, trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/ModelDescriptionConstants.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/ModelDescriptionConstants.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/ModelDescriptionConstants.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * 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.internal.management.as7;
+
+
+/**
+ * String constants frequently used in model descriptions.
+ *
+ * @author Brian Stansberry
+ */
+public class ModelDescriptionConstants {
+
+ // KEEP THESE IN ALPHABETICAL ORDER!
+
+ /** The key for {@link AttributeAccess.AccessType} fields. */
+ public static final String ACCESS_TYPE = "access-type";
+ public static final String ADD = "add";
+ public static final String ADD_OPERATION = "add-operation";
+ public static final String ADDRESS = "address";
+ public static final String ANY = "any";
+ public static final String ANY_ADDRESS = "any-address";
+ public static final String ANY_IPV4_ADDRESS = "any-ipv4-address";
+ public static final String ANY_IPV6_ADDRESS = "any-ipv6-address";
+ public static final String ATTRIBUTES = "attributes";
+ public static final String AUTO_START = "auto-start";
+ public static final String BYTES = "bytes";
+ public static final String CANCELLED = "cancelled";
+ public static final String CHILD_TYPE = "child-type";
+ public static final String CHILDREN = "children";
+ public static final String COMPOSITE = "composite";
+ public static final String CONCURRENT_GROUPS = "concurrent-groups";
+ public static final String CPU_AFFINITY = "cpu-affinity";
+ public static final String CRITERIA = "criteria";
+ public static final String COMPENSATING_OPERATION = "compensating-operation";
+ public static final String DEFAULT = "default";
+ public static final String DESCRIBE = "describe";
+ public static final String DEFAULT_INTERFACE = "default-interface";
+ public static final String DEPLOY = "deploy";
+ public static final String DEPLOYMENT = "deployment";
+ public static final String DEPLOYMENT_SCANNER = "deployment-scanner";
+ public static final String DESCRIPTION = "description";
+ public static final String DISABLE = "disable";
+ public static final String DOMAIN_CONTROLLER = "domain-controller";
+ public static final String DOMAIN_FAILURE_DESCRIPTION = "domain-failure-description";
+ public static final String DOMAIN_RESULTS = "domain-results";
+ public static final String ENABLE = "enable";
+ public static final String ENABLED = "enabled";
+ public static final String EXTENSION = "extension";
+ public static final String FAILED = "failed";
+ public static final String FAILURE_DESCRIPTION = "failure-description";
+ public static final String FIXED_PORT = "fixed-port";
+ public static final String FULL_REPLACE_DEPLOYMENT = "full-replace-deployment";
+ public static final String GRACEFUL_SHUTDOWN_TIMEOUT = "graceful-shutdown-timeout";
+ public static final String GROUP = "group";
+ public static final String HASH = "hash";
+ public static final String HEAD_COMMENT_ALLOWED = "head-comment-allowed";
+ public static final String HTTP_INTERFACE = "http-interface";
+ public static final String HOST = "host";
+ public static final String HOST_FAILURE_DESCRIPTION = "host-failure-description";
+ public static final String HOST_FAILURE_DESCRIPTIONS = "host-failure-descriptions";
+ public static final String IGNORED = "ignored";
+ public static final String INCLUDE = "include";
+ public static final String INCLUDES = "includes";
+ public static final String INCLUDE_RUNTIME = "include-runtime";
+ public static final String INET_ADDRESS = "inet-address";
+ public static final String INPUT_STREAM_INDEX = "input-stream-index";
+ public static final String INTERFACE = "interface";
+ public static final String IN_SERIES = "in-series";
+ public static final String JVM = "jvm";
+ public static final String JVM_TYPE = "type";
+ public static final String LOCAL = "local";
+ public static final String LOCALE = "locale";
+ public static final String MANAGEMENT_INTERFACES = "management-interfaces";
+ public static final String MASK = "mask";
+ public static final String MAX = "max";
+ public static final String MAX_FAILED_SERVERS = "max-failed-servers";
+ public static final String MAX_FAILURE_PERCENTAGE = "max-failure-percentage";
+ public static final String MAX_LENGTH = "max-length";
+ public static final String MAX_OCCURS = "max-occurs";
+ public static final String MAX_THREADS = "max-threads";
+ public static final String MIN = "min";
+ public static final String MIN_LENGTH = "min-length";
+ public static final String MIN_OCCURS = "min-occurs";
+ public static final String MIN_VALUE = "min-value";
+ public static final String MODEL_DESCRIPTION = "model-description";
+ public static final String MULTICAST_ADDRESS = "multicast-address";
+ public static final String MULTICAST_PORT = "multicast-port";
+ public static final String NAME = "name";
+ public static final String NAMESPACE = "namespace";
+ public static final String NAMESPACES = "namespaces";
+ public static final String NATIVE_INTERFACE = "native-interface";
+ public static final String NETWORK = "network";
+ public static final String NILLABLE = "nillable";
+ public static final String NOT = "not";
+ /** Use this as the standard operation name field in the operation *request* ModelNode */
+ public static final String OP = "operation";
+ /** Use this standard operation address field in the operation *request* ModelNode */
+ public static final String OP_ADDR = "address";
+ public static final String OPERATIONS = "operations";
+ public static final String OPERATION_HEADERS = "operation-headers";
+ /** Use this standard operation address field in the operation *description* ModelNode */
+ public static final String OPERATION_NAME = "operation-name";
+ public static final String OUTCOME = "outcome";
+ public static final String PATH = "path";
+ public static final String PORT = "port";
+ public static final String PORT_OFFSET = "port-offset";
+ public static final String PRIORITY = "priority";
+ public static final String PROFILE = "profile";
+ public static final String PROFILE_NAME = "profile-name";
+ public static final String READ_ATTRIBUTE_OPERATION = "read-attribute";
+ public static final String READ_CHILDREN_NAMES_OPERATION = "read-children-names";
+ public static final String READ_CHILDREN_TYPES_OPERATION = "read-children-types";
+ public static final String READ_CHILDREN_RESOURCES_OPERATION = "read-children-resources";
+ public static final String READ_CONFIG_AS_XML_OPERATION = "read-config-as-xml";
+ public static final String READ_OPERATION_DESCRIPTION_OPERATION = "read-operation-description";
+ public static final String READ_OPERATION_NAMES_OPERATION = "read-operation-names";
+ public static final String READ_RESOURCE_DESCRIPTION_OPERATION = "read-resource-description";
+ public static final String READ_RESOURCE_METRICS = "read-resource-metrics";
+ public static final String READ_RESOURCE_OPERATION = "read-resource";
+ public static final String REDEPLOY = "redeploy";
+ public static final String RELATIVE_TO = "relative-to";
+ public static final String REMOVE = "remove";
+ public static final String REMOTE = "remote";
+ public static final String REPLACE_DEPLOYMENT = "replace-deployment";
+ public static final String REPLY_PROPERTIES = "reply-properties";
+ public static final String REQUEST_PROPERTIES = "request-properties";
+ public static final String RECURSIVE = "recursive";
+ public static final String REQUIRED = "required";
+ public static final String RESPONSE = "response";
+ public static final String RESULT = "result";
+ public static final String ROLLBACK_ACROSS_GROUPS = "rollback-across-groups";
+ public static final String ROLLBACK_FAILURE_DESCRIPTION = "rollback-failure-description";
+ public static final String ROLLBACK_ON_RUNTIME_FAILURE = "rollback-on-runtime-failure";
+ public static final String ROLLED_BACK = "rolled-back";
+ public static final String ROLLING_TO_SERVERS = "rolling-to-servers";
+ public static final String ROLLOUT_PLAN = "rollout-plan";
+ public static final String RUNTIME_NAME = "runtime-name";
+ public static final String RUNNING_SERVER = "server";
+ public static final String SCANNER = "scanner";
+ public static final String SCAN_ENABLED = "scan-enabled";
+ public static final String SCAN_INTERVAL = "scan-interval";
+ public static final String SCHEMA_LOCATION = "schema-location";
+ public static final String SCHEMA_LOCATIONS = "schema-locations";
+ public static final String SERVER = "server";
+ public static final String SERVERS = "servers";
+ public static final String SERVER_CONFIG = "server-config";
+ public static final String SERVER_GROUP = "server-group";
+ public static final String SERVER_GROUPS = "server-groups";
+ public static final String SERVER_OPERATIONS = "server-operations";
+ public static final String SERVER_STATE = "server-state";
+ public static final String SHUTDOWN = "shutdown";
+ public static final String SOCKET_BINDING = "socket-binding";
+ public static final String SOCKET_BINDING_GROUP = "socket-binding-group";
+ public static final String SOCKET_BINDING_GROUP_NAME = "socket-binding-group-name";
+ public static final String SOCKET_BINDING_PORT_OFFSET = "socket-binding-port-offset";
+ public static final String START = "start";
+ public static final String STEPS = "steps";
+ /** The key for {@link AttributeAccess.Storage} fields. */
+ public static final String STORAGE = "storage";
+ public static final String SUBSYSTEM = "subsystem";
+ public static final String SUCCESS = "success";
+ public static final String SYSTEM_PROPERTY = "system-property";
+ public static final String SYSTEM_PROPERTIES = "system-properties";
+ public static final String TAIL_COMMENT_ALLOWED = "tail-comment-allowed";
+ public static final String TO_REPLACE = "to-replace";
+ public static final String TYPE = "type";
+ public static final String UNDEPLOY = "undeploy";
+ public static final String UPLOAD_DEPLOYMENT_BYTES = "upload-deployment-bytes";
+ public static final String UPLOAD_DEPLOYMENT_URL = "upload-deployment-url";
+ public static final String UPLOAD_DEPLOYMENT_STREAM = "upload-deployment-stream";
+ public static final String URL = "url";
+ public static final String VALUE = "value";
+ public static final String VALUE_TYPE = "value-type";
+ public static final String WRITE_ATTRIBUTE_OPERATION = "write-attribute";
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/ModelDescriptionConstants.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/OperationFormatException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationFormatException.java 2011-08-09 08:44:16 UTC (rev 33712)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/OperationFormatException.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.ide.eclipse.as.management.as7.internal;
+package org.jboss.ide.eclipse.as.internal.management.as7;
/**
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/OperationRequestAddress.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationRequestAddress.java 2011-08-09 08:44:16 UTC (rev 33712)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/OperationRequestAddress.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.ide.eclipse.as.management.as7.internal;
+package org.jboss.ide.eclipse.as.internal.management.as7;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/OperationRequestBuilder.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationRequestBuilder.java 2011-08-09 08:44:16 UTC (rev 33712)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/OperationRequestBuilder.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.ide.eclipse.as.management.as7.internal;
+package org.jboss.ide.eclipse.as.internal.management.as7;
import org.jboss.dmr.ModelNode;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/ValidatingOperationCallbackHandler.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/ValidatingOperationCallbackHandler.java 2011-08-09 08:44:16 UTC (rev 33712)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/ValidatingOperationCallbackHandler.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.ide.eclipse.as.management.as7.internal;
+package org.jboss.ide.eclipse.as.internal.management.as7;
import java.util.regex.Pattern;
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/util/AS7ManagerUtil.java (from rev 33712, trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7ManagerUtil.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/util/AS7ManagerUtil.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/util/AS7ManagerUtil.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * 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.internal.management.as7.util;
+
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.CHILD_TYPE;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.DEPLOYMENT;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.FAILURE_DESCRIPTION;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.OUTCOME;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.READ_CHILDREN_NAMES_OPERATION;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.REQUEST_PROPERTIES;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.RESULT;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.SUCCESS;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.osgi.util.NLS;
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.Operation;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+import org.jboss.dmr.Property;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
+import org.jboss.ide.eclipse.as.internal.management.as7.AS7Messages;
+import org.jboss.ide.eclipse.as.internal.management.as7.DefaultOperationRequestBuilder;
+import org.jboss.ide.eclipse.as.internal.management.as7.OperationFormatException;
+
+/**
+ * Various utility methods to deal with the as7 management api.
+ *
+ * @author Alexey Loubyansky
+ * @author André Dietisheim
+ */
+public class AS7ManagerUtil {
+
+ public static boolean isSuccess(ModelNode operationResult) {
+ if (operationResult != null) {
+ ModelNode outcome = operationResult.get(OUTCOME);
+ return outcome != null && outcome.asString().equals(SUCCESS);
+ }
+ return false;
+ }
+
+ public static String getFailureDescription(ModelNode operationResult) {
+ if (operationResult == null) {
+ return null;
+ }
+
+ ModelNode descr = operationResult.get(FAILURE_DESCRIPTION);
+ if (descr == null) {
+ return null;
+ }
+
+ return descr.asString();
+ }
+
+ public static List<String> getList(ModelNode operationResult) {
+ if (!operationResult.hasDefined(RESULT))
+ return Collections.emptyList();
+
+ List<ModelNode> nodeList = operationResult.get(RESULT).asList();
+ if (nodeList.isEmpty())
+ return Collections.emptyList();
+
+ List<String> list = new ArrayList<String>(nodeList.size());
+ for (ModelNode node : nodeList) {
+ list.add(node.asString());
+ }
+ return list;
+ }
+
+ public static List<String> getRequestPropertyNames(ModelNode operationResult) {
+ if (!operationResult.hasDefined(RESULT))
+ return Collections.emptyList();
+
+ ModelNode result = operationResult.get(RESULT);
+ if (!result.hasDefined(REQUEST_PROPERTIES))
+ return Collections.emptyList();
+
+ List<Property> nodeList = result.get(REQUEST_PROPERTIES).asPropertyList();
+ if (nodeList.isEmpty())
+ return Collections.emptyList();
+
+ List<String> list = new ArrayList<String>(nodeList.size());
+ for (Property node : nodeList) {
+ list.add(node.getName());
+ }
+ return list;
+ }
+
+ public static boolean isDeployed(String name, ModelControllerClient client) {
+ return getDeployments(client).contains(name);
+ }
+
+ public static List<String> getDeployments(ModelControllerClient client) {
+
+ DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+ final ModelNode request;
+ try {
+ builder.operationName(READ_CHILDREN_NAMES_OPERATION);
+ builder.addProperty(CHILD_TYPE, DEPLOYMENT);
+ request = builder.buildRequest();
+ } catch (OperationFormatException e) {
+ throw new IllegalStateException(AS7Messages.FailedToBuildOperation, e);
+ }
+
+ try {
+ ModelNode outcome = client.execute(request);
+ if (isSuccess(outcome)) {
+ return getList(outcome);
+ }
+ } catch (Exception e) {
+ }
+
+ return Collections.emptyList();
+ }
+
+ public static Boolean getBooleanProperty(String propertyName, ModelNode node) {
+ if (node == null) {
+ return null;
+ }
+ ModelNode valueNode = node.get(propertyName);
+ if (valueNode == null) {
+ return null;
+ }
+ String value = valueNode.toString();
+ if (value == null
+ || valueNode.getType() != ModelType.BOOLEAN) {
+ return null;
+ }
+ return Boolean.valueOf(value);
+ }
+
+ public static ModelNode execute(Operation operation, ModelControllerClient client) throws JBoss7ManangerException {
+ try {
+ ModelNode result = client.execute(operation);
+ if (result.hasDefined(OUTCOME)
+ && SUCCESS.equals(result.get(OUTCOME).asString())) {
+ return result.get(RESULT);
+ }
+ else if (result.hasDefined(FAILURE_DESCRIPTION)) {
+ throw new JBoss7ManangerException(result.get(FAILURE_DESCRIPTION).toString());
+ }
+ else {
+ throw new JBoss7ManangerException(NLS.bind(
+ AS7Messages.OperationOutcomeToString, result.get(OUTCOME).asString()));
+ }
+ } catch (IOException e) {
+ throw new JBoss7ManangerException(e);
+ }
+ }
+}
\ No newline at end of file
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/AS7Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/AS7Messages.java 2011-08-10 09:14:55 UTC (rev 33756)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/AS7Messages.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -1,29 +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;
-
-import org.eclipse.osgi.util.NLS;
-
-public class AS7Messages extends NLS {
- public static String ModuleStateEvaluationFailed;
- public static String OperationOnAddressFailed;
- public static String FailedToBuildOperation;
- public static String OperationOutcomeToString;
- public static String OperationOnUnitNotExecuted;
- public static String OperationOnUnitFailed;
- public static String OperationOnUnitRolledBack;
- public static String OperationNotExecConfigRequiresRestart;
- static {
- NLS.initializeMessages("org.jboss.ide.eclipse.as.management.as7.AS7Messages", //$NON-NLS-1$
- AS7Messages.class);
- }
-
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/AS7Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/AS7Messages.properties 2011-08-10 09:14:55 UTC (rev 33756)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/AS7Messages.properties 2011-08-10 09:56:27 UTC (rev 33757)
@@ -1,8 +0,0 @@
-ModuleStateEvaluationFailed=Could not evaluate state for deployment {0}
-OperationOnAddressFailed=Could not execute {0} for {1}. Failure was {2}.
-FailedToBuildOperation=Failed to build operation.
-OperationOutcomeToString=Operation outcome is {0}.
-OperationOnUnitNotExecuted=The operation {0} was not executed on unit {1}
-OperationOnUnitFailed=The operation {0} failed for unit {1}
-OperationOnUnitRolledBack=The operation {0} for unit {1} was rolled back
-OperationNotExecConfigRequiresRestart=The operation {0} was not executed on unit {1}. The server configuration was changed though and the server needs to be restarted.
\ No newline at end of file
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/Activator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/Activator.java 2011-08-10 09:14:55 UTC (rev 33756)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/Activator.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -1,54 +0,0 @@
-package org.jboss.ide.eclipse.as.management.as7;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.management.as7"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- public static BundleContext getContext() {
- return plugin.getBundle().getBundleContext();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
Deleted: 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-08-10 09:14:55 UTC (rev 33756)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -1,228 +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.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.FAILURE_DESCRIPTION;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.NAME;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.OP;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.READ_RESOURCE_OPERATION;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.RESULT;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.SERVER_STATE;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.SHUTDOWN;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.concurrent.Future;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osgi.util.NLS;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.helpers.standalone.DeploymentAction;
-import org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder;
-import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
-import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
-import org.jboss.as.protocol.old.StreamUtils;
-import org.jboss.dmr.ModelNode;
-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;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ServerState;
-import org.jboss.ide.eclipse.as.management.as7.AS7Messages;
-
-/**
- * @author André Dietisheim
- */
-public class AS7Manager {
-
- public static final int MGMT_PORT = 9999;
-
- private ModelControllerClient client;
- private ServerDeploymentManager manager;
-
- 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);
- }
-
- public IJBoss7DeploymentResult undeploySync(String name, IProgressMonitor monitor)
- throws JBoss7ManangerException {
- IJBoss7DeploymentResult result = undeploy(name);
- result.getStatus();
- return result;
- }
-
- public IJBoss7DeploymentResult deploySync(String name, File file, IProgressMonitor monitor)
- throws JBoss7ManangerException {
- IJBoss7DeploymentResult result = deploy(name, file);
- result.getStatus();
- return result;
- }
-
- public IJBoss7DeploymentResult undeploy(String name) throws JBoss7ManangerException {
- try {
- DeploymentPlanBuilder builder = manager.newDeploymentPlan();
- builder = builder.undeploy(name).andRemoveUndeployed();
- return new DeploymentOperationResult(builder.getLastAction(), manager.execute(builder.build()));
- } catch (Exception e) {
- throw new JBoss7ManangerException(e);
- }
- }
-
- public IJBoss7DeploymentResult remove(String name) throws JBoss7ManangerException {
- try {
- DeploymentPlanBuilder builder = manager.newDeploymentPlan();
- builder = builder.remove(name);
- return new DeploymentOperationResult(builder.getLastAction(), manager.execute(builder.build()));
- } catch (Exception e) {
- throw new JBoss7ManangerException(e);
- }
- }
-
- public IJBoss7DeploymentResult deploy(File file) throws JBoss7ManangerException {
- return deploy(file.getName(), file);
- }
-
- public IJBoss7DeploymentResult add(String name, File file) throws JBoss7ManangerException {
- try {
- return execute(manager.newDeploymentPlan().add(name, file));
- } catch (IOException e) {
- throw new JBoss7ManangerException(e);
- }
- }
-
- public IJBoss7DeploymentResult deploy(String name, File file) throws JBoss7ManangerException {
- try {
- return execute(manager.newDeploymentPlan().add(name, file).andDeploy());
- } catch (IOException e) {
- throw new JBoss7ManangerException(e);
- }
- }
-
- public IJBoss7DeploymentResult replace(File file) throws JBoss7ManangerException {
- return replace(file.getName(), file);
- }
-
- public IJBoss7DeploymentResult replace(String name, File file) throws JBoss7ManangerException {
- try {
- return execute(manager.newDeploymentPlan().replace(name, file));
- } catch (IOException e) {
- throw new JBoss7ManangerException(e);
- }
- }
-
- public JBoss7DeploymentState getDeploymentState(String name) throws JBoss7ManangerException {
- ModelNode request = new ModelNode();
- request.get(OP).set(READ_RESOURCE_OPERATION);
- request.get(ADDRESS).add(DEPLOYMENT, name);
- ModelNode result = execute(request);
-
- Boolean enabled = AS7ManagerUtil.getBooleanProperty(ENABLED, result);
- if (enabled == null) {
- throw new JBoss7ManangerException(
- NLS.bind(AS7Messages.ModuleStateEvaluationFailed, name));
- } else if (enabled) {
- return JBoss7DeploymentState.STARTED;
- } else {
- return JBoss7DeploymentState.STOPPED;
- }
- }
-
- /**
- * Shuts the server down.
- *
- * @throws JBoss7ManangerException
- */
- public void stopServer() throws JBoss7ManangerException {
- ModelNode request = new ModelNode();
- request.get(OP).set(SHUTDOWN);
- quietlyExecute(request);
- }
-
- public JBoss7ServerState getServerState() throws JBoss7ManangerException {
- ModelNode request = new ModelNode();
- request.get(OP).set(READ_ATTRIBUTE_OPERATION);
- request.get(NAME).set(SERVER_STATE);
- ModelNode response = execute(request);
- return toJBoss7ServerState(response);
- }
-
- public boolean isRunning() {
- try {
- return getServerState() == JBoss7ServerState.RUNNING;
- } catch (Exception e) {
- return false;
- }
- }
-
- private JBoss7ServerState toJBoss7ServerState(ModelNode response) throws JBoss7ManangerException {
- try {
- return JBoss7ServerState.valueOfIgnoreCase(response.asString());
- } catch (IllegalArgumentException e) {
- throw new JBoss7ManangerException(e);
- }
- }
-
- public void dispose() {
- StreamUtils.safeClose(client);
- }
-
- private ModelNode execute(ModelNode node) throws JBoss7ManangerException {
- try {
- 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) }
- ));
- }
- return response.get(RESULT);
- } catch (Exception e) {
- throw new JBoss7ManangerException(e);
- }
- }
-
- public void quietlyExecute(ModelNode node) throws JBoss7ManangerException {
- try {
- client.execute(node);
- } catch (Exception e) {
- if (!isConnectionCloseException(e)) {
- throw new JBoss7ManangerException(e);
- }
- }
- }
-
- private boolean isConnectionCloseException(Exception e) {
- return e instanceof IOException
- && e.getMessage() != null
- && e.getMessage().indexOf("Channel closed") > -1;
- }
-
- private IJBoss7DeploymentResult execute(DeploymentPlanBuilder builder) throws JBoss7ManangerException {
- try {
- DeploymentAction action = builder.getLastAction();
- Future<ServerDeploymentPlanResult> planResult = manager.execute(builder.build());
- return new DeploymentOperationResult(action, planResult);
- } catch (Exception e) {
- throw new JBoss7ManangerException(e);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7ManagerUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7ManagerUtil.java 2011-08-10 09:14:55 UTC (rev 33756)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7ManagerUtil.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -1,162 +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.CHILD_TYPE;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.DEPLOYMENT;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.FAILURE_DESCRIPTION;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.OUTCOME;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.READ_CHILDREN_NAMES_OPERATION;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.REQUEST_PROPERTIES;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.RESULT;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.SUCCESS;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.osgi.util.NLS;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.Operation;
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-import org.jboss.dmr.Property;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
-import org.jboss.ide.eclipse.as.management.as7.AS7Messages;
-import org.jboss.ide.eclipse.as.management.as7.internal.DefaultOperationRequestBuilder;
-import org.jboss.ide.eclipse.as.management.as7.internal.OperationFormatException;
-
-/**
- * Various utility methods to deal with the as7 management api.
- *
- * @author Alexey Loubyansky
- * @author André Dietisheim
- */
-public class AS7ManagerUtil {
-
- public static boolean isSuccess(ModelNode operationResult) {
- if (operationResult != null) {
- ModelNode outcome = operationResult.get(OUTCOME);
- return outcome != null && outcome.asString().equals(SUCCESS);
- }
- return false;
- }
-
- public static String getFailureDescription(ModelNode operationResult) {
- if (operationResult == null) {
- return null;
- }
-
- ModelNode descr = operationResult.get(FAILURE_DESCRIPTION);
- if (descr == null) {
- return null;
- }
-
- return descr.asString();
- }
-
- public static List<String> getList(ModelNode operationResult) {
- if (!operationResult.hasDefined(RESULT))
- return Collections.emptyList();
-
- List<ModelNode> nodeList = operationResult.get(RESULT).asList();
- if (nodeList.isEmpty())
- return Collections.emptyList();
-
- List<String> list = new ArrayList<String>(nodeList.size());
- for (ModelNode node : nodeList) {
- list.add(node.asString());
- }
- return list;
- }
-
- public static List<String> getRequestPropertyNames(ModelNode operationResult) {
- if (!operationResult.hasDefined(RESULT))
- return Collections.emptyList();
-
- ModelNode result = operationResult.get(RESULT);
- if (!result.hasDefined(REQUEST_PROPERTIES))
- return Collections.emptyList();
-
- List<Property> nodeList = result.get(REQUEST_PROPERTIES).asPropertyList();
- if (nodeList.isEmpty())
- return Collections.emptyList();
-
- List<String> list = new ArrayList<String>(nodeList.size());
- for (Property node : nodeList) {
- list.add(node.getName());
- }
- return list;
- }
-
- public static boolean isDeployed(String name, ModelControllerClient client) {
- return getDeployments(client).contains(name);
- }
-
- public static List<String> getDeployments(ModelControllerClient client) {
-
- DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
- final ModelNode request;
- try {
- builder.operationName(READ_CHILDREN_NAMES_OPERATION);
- builder.addProperty(CHILD_TYPE, DEPLOYMENT);
- request = builder.buildRequest();
- } catch (OperationFormatException e) {
- throw new IllegalStateException(AS7Messages.FailedToBuildOperation, e);
- }
-
- try {
- ModelNode outcome = client.execute(request);
- if (isSuccess(outcome)) {
- return getList(outcome);
- }
- } catch (Exception e) {
- }
-
- return Collections.emptyList();
- }
-
- public static Boolean getBooleanProperty(String propertyName, ModelNode node) {
- if (node == null) {
- return null;
- }
- ModelNode valueNode = node.get(propertyName);
- if (valueNode == null) {
- return null;
- }
- String value = valueNode.toString();
- if (value == null
- || valueNode.getType() != ModelType.BOOLEAN) {
- return null;
- }
- return Boolean.valueOf(value);
- }
-
- public static ModelNode execute(Operation operation, ModelControllerClient client) throws JBoss7ManangerException {
- try {
- ModelNode result = client.execute(operation);
- if (result.hasDefined(OUTCOME)
- && SUCCESS.equals(result.get(OUTCOME).asString())) {
- return result.get(RESULT);
- }
- else if (result.hasDefined(FAILURE_DESCRIPTION)) {
- throw new JBoss7ManangerException(result.get(FAILURE_DESCRIPTION).toString());
- }
- else {
- throw new JBoss7ManangerException(NLS.bind(
- AS7Messages.OperationOutcomeToString, result.get(OUTCOME).asString()));
- }
- } catch (IOException e) {
- throw new JBoss7ManangerException(e);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentOperationResult.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentOperationResult.java 2011-08-10 09:14:55 UTC (rev 33756)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentOperationResult.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -1,97 +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.text.MessageFormat;
-import java.util.concurrent.Future;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.jboss.as.controller.client.helpers.standalone.DeploymentAction;
-import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentActionResult;
-import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
-import org.jboss.ide.eclipse.as.management.as7.AS7Messages;
-import org.jboss.ide.eclipse.as.management.as7.Activator;
-
-/**
- * A class that holds the status of a deployment operation.
- *
- * @author André Dietisheim
- *
- */
-public class DeploymentOperationResult implements IJBoss7DeploymentResult {
-
- private Future<ServerDeploymentPlanResult> planResult;
- private DeploymentAction action;
-
- DeploymentOperationResult(DeploymentAction action, Future<ServerDeploymentPlanResult> planResult) {
- Assert.isNotNull(action);
- this.action = action;
- Assert.isNotNull(planResult);
- this.planResult = planResult;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.ide.eclipse.as.management.as7.deployment.IDeploymentResult#getStatus()
- */
- @Override
- public IStatus getStatus() throws JBoss7ManangerException {
- try {
- ServerDeploymentActionResult actionResult = planResult.get().getDeploymentActionResult(action.getId());
- return createStatus(action.getDeploymentUnitUniqueName(), action.getType().name(), actionResult);
- } catch (Exception e) {
- throw new JBoss7ManangerException(e);
- }
- }
-
- private IStatus createStatus(String deploymentName, String actionName, ServerDeploymentActionResult actionResult) {
- if (actionResult == null) {
- return null;
- }
-
- IStatus status = null;
- switch (actionResult.getResult()) {
- case NOT_EXECUTED:
- status = createStatus(IStatus.ERROR, NLS.bind(
- AS7Messages.OperationOnUnitNotExecuted,
- actionName, deploymentName));
- break;
- case EXECUTED:
- status = Status.OK_STATUS;
- break;
- case FAILED:
- status = createStatus(IStatus.ERROR, NLS.bind(AS7Messages.OperationOnUnitFailed,
- actionName, deploymentName));
- break;
- case ROLLED_BACK:
- status = createStatus(IStatus.ERROR,
- NLS.bind(AS7Messages.OperationOnUnitRolledBack,
- actionName, deploymentName));
- break;
- case CONFIGURATION_MODIFIED_REQUIRES_RESTART:
- status = createStatus(
- IStatus.WARNING,
- NLS.bind(AS7Messages.OperationNotExecConfigRequiresRestart,
- actionName, deploymentName));
- break;
- }
- return status;
- }
-
- private IStatus createStatus(int severity, String messagePattern, Object... messageArguments) {
- return new Status(severity, Activator.getContext().getBundle().getSymbolicName(), MessageFormat.format(
- messagePattern, messageArguments));
- }
-}
\ No newline at end of file
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java 2011-08-10 09:14:55 UTC (rev 33756)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -1,81 +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.IJBoss7ManagerService;
-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.JBoss7ServerState;
-
-/**
- * @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);
- }
-
- @Deprecated
- public JBoss7ServerState getServerState(String host) throws Exception {
- return getServerState(host, AS7Manager.MGMT_PORT);
- }
-
- public JBoss7ServerState getServerState(String host, int port) throws Exception {
- AS7Manager manager = new AS7Manager(host, port);
- return manager.getServerState();
- }
-
- public boolean isRunning(String host, int port) throws Exception {
- return new AS7Manager(host, port).isRunning();
- }
-
- @Deprecated
- public void stop(String host) throws Exception {
- stop(host, AS7Manager.MGMT_PORT);
- }
-
- public void stop(String host, int port) throws Exception {
- new AS7Manager(host, port).stopServer();
- }
-
- @Override
- public void dispose() {
- }
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/ModelDescriptionConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/ModelDescriptionConstants.java 2011-08-10 09:14:55 UTC (rev 33756)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/ModelDescriptionConstants.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -1,180 +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;
-
-
-/**
- * String constants frequently used in model descriptions.
- *
- * @author Brian Stansberry
- */
-public class ModelDescriptionConstants {
-
- // KEEP THESE IN ALPHABETICAL ORDER!
-
- /** The key for {@link AttributeAccess.AccessType} fields. */
- public static final String ACCESS_TYPE = "access-type";
- public static final String ADD = "add";
- public static final String ADD_OPERATION = "add-operation";
- public static final String ADDRESS = "address";
- public static final String ANY = "any";
- public static final String ANY_ADDRESS = "any-address";
- public static final String ANY_IPV4_ADDRESS = "any-ipv4-address";
- public static final String ANY_IPV6_ADDRESS = "any-ipv6-address";
- public static final String ATTRIBUTES = "attributes";
- public static final String AUTO_START = "auto-start";
- public static final String BYTES = "bytes";
- public static final String CANCELLED = "cancelled";
- public static final String CHILD_TYPE = "child-type";
- public static final String CHILDREN = "children";
- public static final String COMPOSITE = "composite";
- public static final String CONCURRENT_GROUPS = "concurrent-groups";
- public static final String CPU_AFFINITY = "cpu-affinity";
- public static final String CRITERIA = "criteria";
- public static final String COMPENSATING_OPERATION = "compensating-operation";
- public static final String DEFAULT = "default";
- public static final String DESCRIBE = "describe";
- public static final String DEFAULT_INTERFACE = "default-interface";
- public static final String DEPLOY = "deploy";
- public static final String DEPLOYMENT = "deployment";
- public static final String DESCRIPTION = "description";
- public static final String DISABLE = "disable";
- public static final String DOMAIN_CONTROLLER = "domain-controller";
- public static final String DOMAIN_FAILURE_DESCRIPTION = "domain-failure-description";
- public static final String DOMAIN_RESULTS = "domain-results";
- public static final String ENABLE = "enable";
- public static final String ENABLED = "enabled";
- public static final String EXTENSION = "extension";
- public static final String FAILED = "failed";
- public static final String FAILURE_DESCRIPTION = "failure-description";
- public static final String FIXED_PORT = "fixed-port";
- public static final String FULL_REPLACE_DEPLOYMENT = "full-replace-deployment";
- public static final String GRACEFUL_SHUTDOWN_TIMEOUT = "graceful-shutdown-timeout";
- public static final String GROUP = "group";
- public static final String HASH = "hash";
- public static final String HEAD_COMMENT_ALLOWED = "head-comment-allowed";
- public static final String HTTP_INTERFACE = "http-interface";
- public static final String HOST = "host";
- public static final String HOST_FAILURE_DESCRIPTION = "host-failure-description";
- public static final String HOST_FAILURE_DESCRIPTIONS = "host-failure-descriptions";
- public static final String IGNORED = "ignored";
- public static final String INCLUDE = "include";
- public static final String INCLUDES = "includes";
- public static final String INCLUDE_RUNTIME = "include-runtime";
- public static final String INET_ADDRESS = "inet-address";
- public static final String INPUT_STREAM_INDEX = "input-stream-index";
- public static final String INTERFACE = "interface";
- public static final String IN_SERIES = "in-series";
- public static final String JVM = "jvm";
- public static final String JVM_TYPE = "type";
- public static final String LOCAL = "local";
- public static final String LOCALE = "locale";
- public static final String MANAGEMENT_INTERFACES = "management-interfaces";
- public static final String MASK = "mask";
- public static final String MAX = "max";
- public static final String MAX_FAILED_SERVERS = "max-failed-servers";
- public static final String MAX_FAILURE_PERCENTAGE = "max-failure-percentage";
- public static final String MAX_LENGTH = "max-length";
- public static final String MAX_OCCURS = "max-occurs";
- public static final String MAX_THREADS = "max-threads";
- public static final String MIN = "min";
- public static final String MIN_LENGTH = "min-length";
- public static final String MIN_OCCURS = "min-occurs";
- public static final String MIN_VALUE = "min-value";
- public static final String MODEL_DESCRIPTION = "model-description";
- public static final String MULTICAST_ADDRESS = "multicast-address";
- public static final String MULTICAST_PORT = "multicast-port";
- public static final String NAME = "name";
- public static final String NAMESPACE = "namespace";
- public static final String NAMESPACES = "namespaces";
- public static final String NATIVE_INTERFACE = "native-interface";
- public static final String NETWORK = "network";
- public static final String NILLABLE = "nillable";
- public static final String NOT = "not";
- /** Use this as the standard operation name field in the operation *request* ModelNode */
- public static final String OP = "operation";
- /** Use this standard operation address field in the operation *request* ModelNode */
- public static final String OP_ADDR = "address";
- public static final String OPERATIONS = "operations";
- public static final String OPERATION_HEADERS = "operation-headers";
- /** Use this standard operation address field in the operation *description* ModelNode */
- public static final String OPERATION_NAME = "operation-name";
- public static final String OUTCOME = "outcome";
- public static final String PATH = "path";
- public static final String PORT = "port";
- public static final String PORT_OFFSET = "port-offset";
- public static final String PRIORITY = "priority";
- public static final String PROFILE = "profile";
- public static final String PROFILE_NAME = "profile-name";
- public static final String READ_ATTRIBUTE_OPERATION = "read-attribute";
- public static final String READ_CHILDREN_NAMES_OPERATION = "read-children-names";
- public static final String READ_CHILDREN_TYPES_OPERATION = "read-children-types";
- public static final String READ_CHILDREN_RESOURCES_OPERATION = "read-children-resources";
- public static final String READ_CONFIG_AS_XML_OPERATION = "read-config-as-xml";
- public static final String READ_OPERATION_DESCRIPTION_OPERATION = "read-operation-description";
- public static final String READ_OPERATION_NAMES_OPERATION = "read-operation-names";
- public static final String READ_RESOURCE_DESCRIPTION_OPERATION = "read-resource-description";
- public static final String READ_RESOURCE_METRICS = "read-resource-metrics";
- public static final String READ_RESOURCE_OPERATION = "read-resource";
- public static final String REDEPLOY = "redeploy";
- public static final String RELATIVE_TO = "relative-to";
- public static final String REMOVE = "remove";
- public static final String REMOTE = "remote";
- public static final String REPLACE_DEPLOYMENT = "replace-deployment";
- public static final String REPLY_PROPERTIES = "reply-properties";
- public static final String REQUEST_PROPERTIES = "request-properties";
- public static final String RECURSIVE = "recursive";
- public static final String REQUIRED = "required";
- public static final String RESPONSE = "response";
- public static final String RESULT = "result";
- public static final String ROLLBACK_ACROSS_GROUPS = "rollback-across-groups";
- public static final String ROLLBACK_FAILURE_DESCRIPTION = "rollback-failure-description";
- public static final String ROLLBACK_ON_RUNTIME_FAILURE = "rollback-on-runtime-failure";
- public static final String ROLLED_BACK = "rolled-back";
- public static final String ROLLING_TO_SERVERS = "rolling-to-servers";
- public static final String ROLLOUT_PLAN = "rollout-plan";
- public static final String RUNTIME_NAME = "runtime-name";
- public static final String RUNNING_SERVER = "server";
- public static final String SCHEMA_LOCATION = "schema-location";
- public static final String SCHEMA_LOCATIONS = "schema-locations";
- public static final String SERVER = "server";
- public static final String SERVERS = "servers";
- public static final String SERVER_CONFIG = "server-config";
- public static final String SERVER_GROUP = "server-group";
- public static final String SERVER_GROUPS = "server-groups";
- public static final String SERVER_OPERATIONS = "server-operations";
- public static final String SERVER_STATE = "server-state";
- public static final String SHUTDOWN = "shutdown";
- public static final String SOCKET_BINDING = "socket-binding";
- public static final String SOCKET_BINDING_GROUP = "socket-binding-group";
- public static final String SOCKET_BINDING_GROUP_NAME = "socket-binding-group-name";
- public static final String SOCKET_BINDING_PORT_OFFSET = "socket-binding-port-offset";
- public static final String START = "start";
- public static final String STEPS = "steps";
- /** The key for {@link AttributeAccess.Storage} fields. */
- public static final String STORAGE = "storage";
- public static final String SUBSYSTEM = "subsystem";
- public static final String SUCCESS = "success";
- public static final String SYSTEM_PROPERTY = "system-property";
- public static final String SYSTEM_PROPERTIES = "system-properties";
- public static final String TAIL_COMMENT_ALLOWED = "tail-comment-allowed";
- public static final String TO_REPLACE = "to-replace";
- public static final String TYPE = "type";
- public static final String UNDEPLOY = "undeploy";
- public static final String UPLOAD_DEPLOYMENT_BYTES = "upload-deployment-bytes";
- public static final String UPLOAD_DEPLOYMENT_URL = "upload-deployment-url";
- public static final String UPLOAD_DEPLOYMENT_STREAM = "upload-deployment-stream";
- public static final String URL = "url";
- public static final String VALUE = "value";
- public static final String VALUE_TYPE = "value-type";
- public static final String WRITE_ATTRIBUTE_OPERATION = "write-attribute";
-
-}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerIntegrationTest.java 2011-08-10 09:14:55 UTC (rev 33756)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerIntegrationTest.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -26,8 +26,8 @@
import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ServerState;
+import org.jboss.ide.eclipse.as.internal.management.as7.AS7Manager;
import org.jboss.ide.eclipse.as.internal.management.as7.tests.utils.AS7ManagerTestUtils;
-import org.jboss.ide.eclipse.as.management.as7.deployment.AS7Manager;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/utils/AS7ManagerTestUtils.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/utils/AS7ManagerTestUtils.java 2011-08-10 09:14:55 UTC (rev 33756)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/utils/AS7ManagerTestUtils.java 2011-08-10 09:56:27 UTC (rev 33757)
@@ -27,7 +27,7 @@
import org.eclipse.core.runtime.Platform;
import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
-import org.jboss.ide.eclipse.as.management.as7.deployment.AS7Manager;
+import org.jboss.ide.eclipse.as.internal.management.as7.AS7Manager;
import org.osgi.framework.Bundle;
/**
14 years, 8 months
JBoss Tools SVN: r33756 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-08-10 05:14:55 -0400 (Wed, 10 Aug 2011)
New Revision: 33756
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java
Log:
[JBIDE-9508] added exception to status object
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java 2011-08-10 06:56:40 UTC (rev 33755)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java 2011-08-10 09:14:55 UTC (rev 33756)
@@ -158,7 +158,7 @@
} catch(Exception e) {
Status s = new Status(IStatus.INFO, JBossServerCorePlugin.PLUGIN_ID,
"An attempt to reach the JBoss 7 Management Service on host " + server.getHost() //$NON-NLS-1$
- + " and port " + getManagementPort(server) + " has resulted in an exception"); //$NON-NLS-1$ //$NON-NLS-2$
+ + " and port " + getManagementPort(server) + " has resulted in an exception", e); //$NON-NLS-1$ //$NON-NLS-2$
return s;
}
}
14 years, 8 months