[jbosstools-commits] JBoss Tools SVN: r30773 - in trunk/as: org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests and 2 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Fri Apr 22 09:56:23 EDT 2011
Author: adietish
Date: 2011-04-22 09:56:22 -0400 (Fri, 22 Apr 2011)
New Revision: 30773
Added:
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/JBoss7ManangementException.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeployerException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentState.java
Modified:
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/META-INF/MANIFEST.MF
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementIntegrationTest.java
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementTestUtils.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7DeploymentManager.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/Deployable.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/DetypedDeployer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossDeploymentManager.java
Log:
[JBIDE-8769] exposed state checking in interface
Modified: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/META-INF/MANIFEST.MF 2011-04-22 13:03:21 UTC (rev 30772)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/META-INF/MANIFEST.MF 2011-04-22 13:56:22 UTC (rev 30773)
@@ -4,9 +4,10 @@
Bundle-SymbolicName: org.jboss.ide.eclipse.as.management.as7.tests
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.jboss.ide.eclipse.as.management.as7;bundle-version="1.0.0",
+Require-Bundle: org.jboss.ide.eclipse.as.management.as7;bundle-version="[1.0.0,2.0.0)",
+ org.jboss.ide.eclipse.as.core;bundle-version="[2.2.0,3.0.0)",
org.junit;bundle-version="[4.8.1,5.0.0)",
- org.eclipse.core.runtime;bundle-version="3.7.0",
- org.hamcrest;bundle-version="1.1.0"
+ org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
+ org.hamcrest;bundle-version="[1.1.0,2.0.0)"
Bundle-ClassPath: .,
wars/
Modified: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java 2011-04-22 13:03:21 UTC (rev 30772)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -29,7 +29,7 @@
import java.io.File;
import java.util.List;
-import org.jboss.ide.eclipse.as.management.as7.deployment.DeployerException;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangementException;
import org.jboss.ide.eclipse.as.management.as7.deployment.DetypedDeployer;
import org.junit.Test;
@@ -52,7 +52,7 @@
}
}
- @Test(expected = DeployerException.class)
+ @Test(expected = JBoss7ManangementException.class)
public void cannotDeployWarTwice() throws Exception {
File warFile = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.MINIMALISTIC_WAR);
try {
@@ -79,8 +79,8 @@
}
}
- @Test(expected = DeployerException.class)
- public void cannotUndeployNondeployed() throws DeployerException {
+ @Test(expected = JBoss7ManangementException.class)
+ public void cannotUndeployNondeployed() throws JBoss7ManangementException {
DetypedDeployer.undeploy("inexistant", JBossManagementTestUtils.HOST, JBossManagementTestUtils.MGMT_PORT);
}
Modified: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementIntegrationTest.java
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementIntegrationTest.java 2011-04-22 13:03:21 UTC (rev 30772)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementIntegrationTest.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -32,8 +32,8 @@
import java.net.UnknownHostException;
import java.util.concurrent.ExecutionException;
-import org.jboss.ide.eclipse.as.management.as7.deployment.DeployerException;
-import org.jboss.ide.eclipse.as.management.as7.deployment.DeploymentState;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangementException;
import org.jboss.ide.eclipse.as.management.as7.deployment.AS7Manager;
import org.junit.After;
import org.junit.Before;
@@ -92,7 +92,7 @@
}
@Ignore
- @Test(expected = DeployerException.class)
+ @Test(expected = JBoss7ManangementException.class)
public void cannotDeployWarTwice() throws Exception {
File warFile = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.MINIMALISTIC_WAR);
try {
@@ -104,8 +104,8 @@
}
@Ignore
- @Test(expected = DeployerException.class)
- public void cannotUndeployNondeployed() throws DeployerException, InterruptedException, ExecutionException {
+ @Test(expected = JBoss7ManangementException.class)
+ public void cannotUndeployNondeployed() throws JBoss7ManangementException, InterruptedException, ExecutionException {
JBossManagementTestUtils.waitUntilFinished(manager.undeploy("inexistant"));
}
@@ -128,35 +128,35 @@
}
@Test
- public void getEnabledStateIfDeploymentIsDeployed() throws URISyntaxException, IOException, DeployerException {
+ public void getEnabledStateIfDeploymentIsDeployed() throws URISyntaxException, IOException, JBoss7ManangementException {
String deploymentName = "testDeployment";
File warFile = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.MINIMALISTIC_WAR);
try {
JBossManagementTestUtils.waitUntilFinished(manager.deploy(deploymentName, warFile));
- DeploymentState state = manager.getDeploymentState(deploymentName);
+ JBoss7DeploymentState state = manager.getDeploymentState(deploymentName);
assertNotNull(state);
- assertThat(state, equalTo(DeploymentState.STARTED));
+ assertThat(state, equalTo(JBoss7DeploymentState.STARTED));
} finally {
JBossManagementTestUtils.quietlyUndeploy(deploymentName, manager);
}
}
@Test
- public void getDisabledStateIfDeploymentIsOnlyAdded() throws URISyntaxException, IOException, DeployerException {
+ public void getDisabledStateIfDeploymentIsOnlyAdded() throws URISyntaxException, IOException, JBoss7ManangementException {
String deploymentName = "testDeployment";
File warFile = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.MINIMALISTIC_WAR);
try {
JBossManagementTestUtils.waitUntilFinished(manager.add(deploymentName, warFile));
- DeploymentState state = manager.getDeploymentState(deploymentName);
+ JBoss7DeploymentState state = manager.getDeploymentState(deploymentName);
assertNotNull(state);
- assertThat(state, equalTo(DeploymentState.STOPPED));
+ assertThat(state, equalTo(JBoss7DeploymentState.STOPPED));
} finally {
JBossManagementTestUtils.quietlyRemove(deploymentName, manager);
}
}
- @Test(expected = DeployerException.class)
- public void getErrorIfDeploymentIsNotDeployed() throws URISyntaxException, IOException, DeployerException {
+ @Test(expected = JBoss7ManangementException.class)
+ public void getErrorIfDeploymentIsNotDeployed() throws URISyntaxException, IOException, JBoss7ManangementException {
String deploymentName = "testDeployment";
try {
manager.getDeploymentState(deploymentName);
Modified: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementTestUtils.java
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementTestUtils.java 2011-04-22 13:03:21 UTC (rev 30772)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementTestUtils.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -33,8 +33,8 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
-import org.jboss.ide.eclipse.as.management.as7.deployment.DeployerException;
-import org.jboss.ide.eclipse.as.management.as7.deployment.DeploymentOperationResult;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangementException;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
import org.jboss.ide.eclipse.as.management.as7.deployment.AS7Manager;
import org.osgi.framework.Bundle;
@@ -89,7 +89,7 @@
}
}
- public static void waitUntilFinished(DeploymentOperationResult result) throws DeployerException {
+ public static void waitUntilFinished(IJBoss7DeploymentResult result) throws JBoss7ManangementException {
result.getStatus(); // wait for operation to finish
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7DeploymentManager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7DeploymentManager.java 2011-04-22 13:03:21 UTC (rev 30772)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7DeploymentManager.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -25,7 +25,7 @@
* @return Not sure what to return yet
* @throws Exception
*/
- public Object deployAsync(String host, int port,
+ public IJBoss7DeploymentResult deployAsync(String host, int port,
String deploymentName, File file, IProgressMonitor monitor) throws Exception;
/**
@@ -40,7 +40,7 @@
* @return Not sure what to return yet
* @throws Exception
*/
- public Object deploySync(String host, int port,
+ public IJBoss7DeploymentResult deploySync(String host, int port,
String deploymentName, File file, IProgressMonitor monitor) throws Exception;
@@ -56,7 +56,7 @@
* @return Not sure what to return yet
* @throws Exception
*/
- public Object undeployAsync(String host, int port,
+ public IJBoss7DeploymentResult undeployAsync(String host, int port,
String deploymentName, boolean removeFile, IProgressMonitor monitor) throws Exception;
@@ -72,7 +72,7 @@
* @return Not sure what to return yet
* @throws Exception
*/
- public Object syncUndeploy(String host, int port,
+ public IJBoss7DeploymentResult syncUndeploy(String host, int port,
String deploymentName, boolean removeFile, IProgressMonitor monitor) throws Exception;
/**
@@ -85,6 +85,6 @@
* @return the state of the deployment
* @throws Exception
*/
- public Object getDeploymentState(String host, int port, String deploymentName) throws Exception;
+ public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception;
}
Added: 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 (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7DeploymentResult.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -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.core.server.internal.v7;
+
+import org.eclipse.core.runtime.IStatus;
+
+public interface IJBoss7DeploymentResult {
+
+ public abstract IStatus getStatus() throws JBoss7ManangementException;
+
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7DeploymentResult.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7DeploymentState.java (from rev 30771, trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentState.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7DeploymentState.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7DeploymentState.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * 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.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
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7DeploymentState.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangementException.java (from rev 30771, trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeployerException.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangementException.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangementException.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -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.core.server.internal.v7;
+
+/**
+ * @author André Dietisheim
+ */
+public class JBoss7ManangementException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public JBoss7ManangementException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public JBoss7ManangementException(Throwable cause) {
+ super(cause);
+ }
+
+ public JBoss7ManangementException(String message) {
+ super(message);
+ }
+
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java 2011-04-22 13:03:21 UTC (rev 30772)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -23,6 +23,7 @@
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.OP;
import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.READ_RESOURCE_OPERATION;
@@ -42,6 +43,9 @@
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
import org.jboss.as.protocol.StreamUtils;
import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangementException;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
/**
* @author André Dietisheim
@@ -56,104 +60,115 @@
this.manager = ServerDeploymentManager.Factory.create(client);
}
- public DeploymentOperationResult undeploySync(String name, IProgressMonitor monitor) throws DeployerException {
- DeploymentOperationResult result = undeploy(name);
+ public IJBoss7DeploymentResult undeploySync(String name, IProgressMonitor monitor)
+ throws JBoss7ManangementException {
+ IJBoss7DeploymentResult result = undeploy(name);
result.getStatus();
return result;
}
- public DeploymentOperationResult deploySync(String name, File file, IProgressMonitor monitor)
- throws DeployerException {
- DeploymentOperationResult result = deploy(name, file);
+ public IJBoss7DeploymentResult deploySync(String name, File file, IProgressMonitor monitor)
+ throws JBoss7ManangementException {
+ IJBoss7DeploymentResult result = deploy(name, file);
result.getStatus();
return result;
}
- public DeploymentOperationResult undeploy(String name) throws DeployerException {
+ public IJBoss7DeploymentResult undeploy(String name) throws JBoss7ManangementException {
try {
DeploymentPlanBuilder builder = manager.newDeploymentPlan();
builder = builder.undeploy(name).andRemoveUndeployed();
return new DeploymentOperationResult(builder.getLastAction(), manager.execute(builder.build()));
} catch (Exception e) {
- throw new DeployerException(e);
+ throw new JBoss7ManangementException(e);
}
}
- public DeploymentOperationResult remove(String name) throws DeployerException {
+ public IJBoss7DeploymentResult remove(String name) throws JBoss7ManangementException {
try {
DeploymentPlanBuilder builder = manager.newDeploymentPlan();
builder = builder.remove(name);
return new DeploymentOperationResult(builder.getLastAction(), manager.execute(builder.build()));
} catch (Exception e) {
- throw new DeployerException(e);
+ throw new JBoss7ManangementException(e);
}
}
- public DeploymentOperationResult deploy(File file) throws DeployerException {
+ public IJBoss7DeploymentResult deploy(File file) throws JBoss7ManangementException {
return deploy(file.getName(), file);
}
- public DeploymentOperationResult add(String name, File file) throws DeployerException {
+ public IJBoss7DeploymentResult add(String name, File file) throws JBoss7ManangementException {
try {
return execute(manager.newDeploymentPlan().add(name, file));
} catch (IOException e) {
- throw new DeployerException(e);
+ throw new JBoss7ManangementException(e);
}
}
- public DeploymentOperationResult deploy(String name, File file) throws DeployerException {
+ public IJBoss7DeploymentResult deploy(String name, File file) throws JBoss7ManangementException {
try {
return execute(manager.newDeploymentPlan().add(name, file).andDeploy());
} catch (IOException e) {
- throw new DeployerException(e);
+ throw new JBoss7ManangementException(e);
}
}
- public DeploymentOperationResult replace(File file) throws DeployerException {
+ public IJBoss7DeploymentResult replace(File file) throws JBoss7ManangementException {
return replace(file.getName(), file);
}
- public DeploymentOperationResult replace(String name, File file) throws DeployerException {
+ public IJBoss7DeploymentResult replace(String name, File file) throws JBoss7ManangementException {
try {
return execute(manager.newDeploymentPlan().replace(name, file));
} catch (IOException e) {
- throw new DeployerException(e);
+ throw new JBoss7ManangementException(e);
}
}
- public DeploymentState getDeploymentState(String name) throws DeployerException {
+ public JBoss7DeploymentState getDeploymentState(String name) throws JBoss7ManangementException {
ModelNode request = new ModelNode();
request.get(OP).set(READ_RESOURCE_OPERATION);
request.get(ADDRESS).add(DEPLOYMENT, name);
ModelNode result = execute(request);
- return DeploymentState.getForResultNode(result);
+
+ Boolean enabled = AS7ManagerUtil.getBooleanProperty(ENABLED, result);
+ if (enabled == null) {
+ throw new JBoss7ManangementException(
+ MessageFormat.format("Could not evaluate state for deployment {0}", name));
+ } else if (enabled) {
+ return JBoss7DeploymentState.STARTED;
+ } else {
+ return JBoss7DeploymentState.STOPPED;
+ }
+
}
public void dispose() {
StreamUtils.safeClose(client);
}
- private ModelNode execute(ModelNode node) throws DeployerException {
+ private ModelNode execute(ModelNode node) throws JBoss7ManangementException {
try {
ModelNode response = client.execute(node);
if (!AS7ManagerUtil.isSuccess(response)) {
- throw new DeployerException(
+ throw new JBoss7ManangementException(
MessageFormat.format("Could not execute {0} for {1}. Failure was {2}.", node.get(OP),
node.get(ADDRESS), response.get(FAILURE_DESCRIPTION)));
}
return response.get(RESULT);
} catch (Exception e) {
- throw new DeployerException(e);
+ throw new JBoss7ManangementException(e);
}
}
- private DeploymentOperationResult execute(DeploymentPlanBuilder builder) throws DeployerException {
+ private IJBoss7DeploymentResult execute(DeploymentPlanBuilder builder) throws JBoss7ManangementException {
try {
DeploymentAction action = builder.getLastAction();
Future<ServerDeploymentPlanResult> planResult = manager.execute(builder.build());
return new DeploymentOperationResult(action, planResult);
} catch (Exception e) {
- throw new DeployerException(e);
+ throw new JBoss7ManangementException(e);
}
}
}
Modified: 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-04-22 13:03:21 UTC (rev 30772)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7ManagerUtil.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -39,6 +39,7 @@
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.JBoss7ManangementException;
import org.jboss.ide.eclipse.as.management.as7.internal.DefaultOperationRequestBuilder;
import org.jboss.ide.eclipse.as.management.as7.internal.OperationFormatException;
@@ -148,7 +149,7 @@
return Boolean.valueOf(value);
}
- public static ModelNode execute(Operation operation, ModelControllerClient client) throws DeployerException {
+ public static ModelNode execute(Operation operation, ModelControllerClient client) throws JBoss7ManangementException {
try {
ModelNode result = client.execute(operation);
if (result.hasDefined(OUTCOME)
@@ -156,13 +157,13 @@
return result.get(RESULT);
}
else if (result.hasDefined(FAILURE_DESCRIPTION)) {
- throw new DeployerException(result.get(FAILURE_DESCRIPTION).toString());
+ throw new JBoss7ManangementException(result.get(FAILURE_DESCRIPTION).toString());
}
else {
- throw new DeployerException("Operation outcome is " + result.get(OUTCOME).asString());
+ throw new JBoss7ManangementException("Operation outcome is " + result.get(OUTCOME).asString());
}
} catch (IOException e) {
- throw new DeployerException(e);
+ throw new JBoss7ManangementException(e);
}
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/Deployable.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/Deployable.java 2011-04-22 13:03:21 UTC (rev 30772)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/Deployable.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -10,6 +10,7 @@
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.JBoss7ManangementException;
import org.jboss.ide.eclipse.as.management.as7.Activator;
public class Deployable {
@@ -42,7 +43,7 @@
return name;
}
- public IStatus getStatus() throws DeployerException {
+ public IStatus getStatus() throws JBoss7ManangementException {
if (resultFuture == null
|| action == null) {
return null;
@@ -52,7 +53,7 @@
ServerDeploymentActionResult actionResult = result.getDeploymentActionResult(action.getId());
return createStatus(action, actionResult);
} catch (Exception e) {
- throw new DeployerException(e);
+ throw new JBoss7ManangementException(e);
}
}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeployerException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeployerException.java 2011-04-22 13:03:21 UTC (rev 30772)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeployerException.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -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.management.as7.deployment;
-
-/**
- * @author André Dietisheim
- */
-public class DeployerException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public DeployerException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public DeployerException(Throwable cause) {
- super(cause);
- }
-
- public DeployerException(String message) {
- super(message);
- }
-
-}
Modified: 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-04-22 13:03:21 UTC (rev 30772)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentOperationResult.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -30,6 +30,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.JBoss7ManangementException;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
import org.jboss.ide.eclipse.as.management.as7.Activator;
/**
@@ -38,7 +40,7 @@
* @author André Dietisheim
*
*/
-public class DeploymentOperationResult {
+public class DeploymentOperationResult implements IJBoss7DeploymentResult {
private Future<ServerDeploymentPlanResult> planResult;
private DeploymentAction action;
@@ -50,12 +52,16 @@
this.planResult = planResult;
}
- public IStatus getStatus() throws DeployerException {
+ /* (non-Javadoc)
+ * @see org.jboss.ide.eclipse.as.management.as7.deployment.IDeploymentResult#getStatus()
+ */
+ @Override
+ public IStatus getStatus() throws JBoss7ManangementException {
try {
ServerDeploymentActionResult actionResult = planResult.get().getDeploymentActionResult(action.getId());
return createStatus(action.getDeploymentUnitUniqueName(), action.getType().name(), actionResult);
} catch (Exception e) {
- throw new DeployerException(e);
+ throw new JBoss7ManangementException(e);
}
}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentState.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentState.java 2011-04-22 13:03:21 UTC (rev 30772)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentState.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * 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.deployment;
-
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ENABLED;
-
-import org.jboss.dmr.ModelNode;
-
-/**
- * An enum that reflects the state of a deployment.
- *
- * @author André Dietisheim
- */
-public enum DeploymentState {
- STARTED {
- protected boolean matches(boolean enabled) {
- return enabled == true;
- }
- },
- STOPPED {
- protected boolean matches(boolean enabled) {
- return enabled == false;
- }
- };
-
- public static DeploymentState getForResultNode(ModelNode node) {
- Boolean enabled = AS7ManagerUtil.getBooleanProperty(ENABLED, node);
- if (enabled == null) {
- return null;
- }
-
- DeploymentState matchingState = null;
- for(DeploymentState state : values()) {
- if (state.matches(enabled)) {
- matchingState = state;
- }
- }
- return matchingState;
- }
-
- protected abstract boolean matches(boolean enabled);
-
-}
\ No newline at end of file
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java 2011-04-22 13:03:21 UTC (rev 30772)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -43,13 +43,14 @@
import org.jboss.as.controller.client.OperationBuilder;
import org.jboss.as.protocol.StreamUtils;
import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangementException;
/**
* @author André Dietisheim
*/
public class DetypedDeployer {
- public static void undeploy(String name, String host, int port) throws DeployerException {
+ public static void undeploy(String name, String host, int port) throws JBoss7ManangementException {
ModelControllerClient client = null;
try {
client = ModelControllerClient.Factory.create(host, port);
@@ -63,13 +64,13 @@
remove(name, host, port);
} catch (Exception e) {
- throw new DeployerException(e);
+ throw new JBoss7ManangementException(e);
} finally {
StreamUtils.safeClose(client);
}
}
- public static void remove(String name, String host, int port) throws DeployerException {
+ public static void remove(String name, String host, int port) throws JBoss7ManangementException {
ModelControllerClient client = null;
try {
client = ModelControllerClient.Factory.create(host, port);
@@ -80,17 +81,17 @@
request.get(ADDRESS).add(DEPLOYMENT, name);
client.execute(request);
} catch (Exception e) {
- throw new DeployerException(e);
+ throw new JBoss7ManangementException(e);
} finally {
StreamUtils.safeClose(client);
}
}
- public static void deploy(File file, String host, int port) throws DeployerException {
+ public static void deploy(File file, String host, int port) throws JBoss7ManangementException {
deploy(file.getName(), file, host, port);
}
- public static void deploy(String name, File file, String host, int port) throws DeployerException {
+ public static void deploy(String name, File file, String host, int port) throws JBoss7ManangementException {
ModelControllerClient client = null;
try {
client = ModelControllerClient.Factory.create(host, port);
@@ -110,13 +111,13 @@
throwOnFailure(result);
} catch (Exception e) {
- throw new DeployerException(e);
+ throw new JBoss7ManangementException(e);
} finally {
StreamUtils.safeClose(client);
}
}
- public static void replace(String name, File file, String host, int port) throws DeployerException {
+ public static void replace(String name, File file, String host, int port) throws JBoss7ManangementException {
ModelControllerClient client = null;
try {
client = ModelControllerClient.Factory.create(host, port);
@@ -134,7 +135,7 @@
throwOnFailure(result);
} catch (Exception e) {
- throw new DeployerException(e);
+ throw new JBoss7ManangementException(e);
} finally {
StreamUtils.safeClose(client);
}
@@ -154,9 +155,9 @@
return AS7ManagerUtil.getDeployments(client);
}
- private static void throwOnFailure(ModelNode result) throws DeployerException {
+ private static void throwOnFailure(ModelNode result) throws JBoss7ManangementException {
if (!AS7ManagerUtil.isSuccess(result)) {
- throw new DeployerException(AS7ManagerUtil.getFailureDescription(result));
+ throw new JBoss7ManangementException(AS7ManagerUtil.getFailureDescription(result));
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossDeploymentManager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossDeploymentManager.java 2011-04-22 13:03:21 UTC (rev 30772)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossDeploymentManager.java 2011-04-22 13:56:22 UTC (rev 30773)
@@ -25,37 +25,39 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentManager;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
/**
* @author Rob Stryker
*/
public class JBossDeploymentManager implements IJBoss7DeploymentManager {
- public DeploymentOperationResult deployAsync(String host, int port, String deploymentName,
+ 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 DeploymentOperationResult deploySync(String host, int port, String deploymentName,
+ 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 DeploymentOperationResult undeployAsync(String host, int port, String deploymentName,
+ 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 DeploymentOperationResult syncUndeploy(String host, int port, String 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 DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception {
+ public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception {
AS7Manager manager = new AS7Manager(host, port);
return manager.getDeploymentState(deploymentName);
More information about the jbosstools-commits
mailing list