[jbosstools-commits] JBoss Tools SVN: r30585 - in workspace/adietish: org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7 and 5 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Apr 15 06:01:21 EDT 2011


Author: adietish
Date: 2011-04-15 06:01:21 -0400 (Fri, 15 Apr 2011)
New Revision: 30585

Added:
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/Activator.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/Deployable.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/DeployerException.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/DeploymentManager.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/DetypedDeployer.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/JBossDeploymentManager.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/JBossManagementService.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/JbossManagementUtil.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/TypedDeployer.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/
Removed:
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Activator.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Deployable.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeployerException.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeploymentManager.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DetypedDeployer.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JBossDeploymentManager.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JBossManagementService.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JbossManagementUtil.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/TypedDeployer.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/operations/
Modified:
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentManagerIntegratonTest.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DetypedDeployerIntegrationTest.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/TypedDeployerIntegrationTest.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/META-INF/MANIFEST.MF
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/CommandFormatException.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/CommandLineException.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/DefaultOperationRequestAddress.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/DefaultOperationRequestBuilder.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/OperationFormatException.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/OperationRequestAddress.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/OperationRequestBuilder.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/ValidatingOperationCallbackHandler.java
Log:
corrected internal package name

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/META-INF/MANIFEST.MF
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/META-INF/MANIFEST.MF	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/META-INF/MANIFEST.MF	2011-04-15 10:01:21 UTC (rev 30585)
@@ -3,7 +3,7 @@
 Bundle-Name: Deployment
 Bundle-SymbolicName: org.jboss.ide.eclipse.as7.deployment
 Bundle-Version: 0.0.1.qualifier
-Bundle-Activator: org.jboss.ide.eclipse.as7.deployment.internal.Activator
+Bundle-Activator: org.jboss.ide.eclipse.as7.internal.deployment.Activator
 Require-Bundle: org.eclipse.core.runtime
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
@@ -24,7 +24,7 @@
  org.jboss.as.protocol.mgmt,
  org.jboss.dmr,
  org.jboss.ide.eclipse.as7.deployment,
- org.jboss.ide.eclipse.as7.deployment.internal,
+ org.jboss.ide.eclipse.as7.internal.deployment,
  org.jboss.logging,
  org.jboss.marshalling,
  org.jboss.marshalling.cloner,

Deleted: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Activator.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Activator.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Activator.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -1,30 +0,0 @@
-package org.jboss.ide.eclipse.as7.deployment.internal;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
-	private static BundleContext context;
-
-	public static BundleContext getContext() {
-		return context;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
-	 */
-	public void start(BundleContext bundleContext) throws Exception {
-		Activator.context = bundleContext;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
-	 */
-	public void stop(BundleContext bundleContext) throws Exception {
-		Activator.context = null;
-	}
-
-}

Deleted: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Deployable.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Deployable.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Deployable.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -1,94 +0,0 @@
-package org.jboss.ide.eclipse.as7.deployment.internal;
-
-import java.io.File;
-import java.text.MessageFormat;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-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;
-
-public class Deployable {
-
-	private String name;
-	private File file;
-	private Future<ServerDeploymentPlanResult> resultFuture;
-	private long timeout;
-	private DeploymentAction action;
-
-	protected Deployable(String name, File file, long timeout) {
-		this.name = name;
-		this.file = file;
-		this.timeout = timeout;
-	}
-
-	protected void setDeploymentAction(DeploymentAction action) {
-		this.action = action;
-	}
-
-	protected void setResultFuture(Future<ServerDeploymentPlanResult> resultFuture) {
-		this.resultFuture = resultFuture;
-	}
-
-	public File getFile() {
-		return file;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public IStatus getStatus() throws DeployerException {
-		if (resultFuture == null
-				|| action == null) {
-			return null;
-		}
-		try {
-			ServerDeploymentPlanResult result = resultFuture.get(timeout, TimeUnit.MILLISECONDS);
-			ServerDeploymentActionResult actionResult = result.getDeploymentActionResult(action.getId());
-			return createStatus(action, actionResult);
-		} catch (Exception e) {
-			throw new DeployerException(e);
-		}
-	}
-
-	private IStatus createStatus(DeploymentAction action, ServerDeploymentActionResult actionResult) {
-		if (actionResult == null) {
-			return null;
-		}
-
-		IStatus status = null;
-		switch (actionResult.getResult()) {
-		case NOT_EXECUTED:
-			status = createStatus(IStatus.ERROR, "The operation {0} was not executed on unit {1}", action
-					.getType().name(), getName());
-			break;
-		case EXECUTED:
-			status = Status.OK_STATUS;
-			break;
-		case FAILED:
-			status = createStatus(IStatus.ERROR, "The operation {0} failed for unit {1}", action.getType()
-					.name(), getName());
-			break;
-		case ROLLED_BACK:
-			status = createStatus(IStatus.ERROR, "The operation {0} for unit {1} was rolled back", action
-					.getType().name(), getName());
-			break;
-		case CONFIGURATION_MODIFIED_REQUIRES_RESTART:
-			status = createStatus(
-					IStatus.WARNING,
-					"The operation {0} was not executed on unit {1}. The server configuration was changed though and the server needs to be restarted",
-					action.getType().name(), getName());
-			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: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeployerException.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeployerException.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeployerException.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -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.as7.deployment.internal;
-
-/**
- * @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);
-	}
-
-}

Deleted: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeploymentManager.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeploymentManager.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeploymentManager.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -1,169 +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.as7.deployment.internal;
-
-import static org.jboss.as.protocol.StreamUtils.safeClose;
-
-import java.io.File;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder;
-import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
-
-/**
- * Used to deploy/undeploy deployments to a running <b>standalone</b>
- * application server
- * 
- * @author <a href="adietish at redhat.com">André Dietisheim</a>
- */
-public class DeploymentManager {
-
-	public static final long DEFAULT_TIMEOUT = 15000;
-
-	private final List<IDeploymentPlanBuilderOperation> deployments = new ArrayList<IDeploymentPlanBuilderOperation>();
-	private final ModelControllerClient client;
-	private final ServerDeploymentManager manager;
-	private long timeout = DEFAULT_TIMEOUT;
-
-	public DeploymentManager(String host, int port) throws UnknownHostException {
-		client = ModelControllerClient.Factory.create(host, port);
-		manager = ServerDeploymentManager.Factory.create(client);
-	}
-
-	public synchronized DeploymentManager deploy(File file) {
-		deployments.add(new DeployOperation(file));
-		return this;
-	}
-
-	public synchronized DeploymentManager deploy(String name, File file) {
-		deployments.add(new DeployOperation(name, file));
-		return this;
-	}
-
-	public synchronized DeploymentManager undeploy(String name) {
-		deployments.add(new UndeployOperation(name));
-		return this;
-	}
-
-	public synchronized DeploymentManager undeploy(File file) {
-		deployments.add(new UndeployOperation(file));
-		return this;
-	}
-
-	public synchronized void execute() throws DeployerException {
-		try {
-			DeploymentPlanBuilder builder = manager.newDeploymentPlan();
-			for (IDeploymentPlanBuilderOperation deployment : deployments) {
-				builder = deployment.addTo(builder);
-			}
-			manager.execute(builder.build()).get(timeout, TimeUnit.MILLISECONDS);
-		} catch (Exception e) {
-			throw new DeployerException(e);
-		}
-	}
-
-	public void setTimeout(long timeout) {
-		this.timeout = timeout;
-	}
-
-	public void dispose() {
-		safeClose(client);
-	}
-
-	private static class DeployOperation extends FileOperation {
-
-		private DeployOperation(File file) {
-			super(file);
-		}
-
-		private DeployOperation(String name, File file) {
-			super(name, file);
-		}
-
-		public synchronized DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception {
-			String name = getName();
-			return builder.add(name, getFile()).deploy(name);
-		}		
-	}
-	
-	private static class UndeployOperation extends FileOperation {
-
-		private UndeployOperation(File file) {
-			super(file);
-		}
-
-		private UndeployOperation(String name) {
-			super(name, null);
-		}
-
-		public synchronized DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception {
-			String name = getName();
-			return builder.undeploy(name).undeploy(name);
-		}
-	}
-	
-	private abstract static class FileOperation extends NamedOperation {
-
-		private File file;
-
-		private FileOperation(File file) {
-			this(null, file);
-		}
-
-		private FileOperation(String name, File file) {
-			super(name);
-			this.file = file;
-		}
-
-		protected File getFile() {
-			return file;
-		}
-
-		protected String getName() {
-			if (name != null) {
-				return name;
-			} else {
-				return file.getName();
-			}
-		}
-
-	}
-
-	private abstract static class NamedOperation implements IDeploymentPlanBuilderOperation {
-
-		protected String name;
-
-		private NamedOperation(String name) {
-			this.name = name;
-		}
-	}
-
-	private interface IDeploymentPlanBuilderOperation {
-
-		public DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception;
-
-	}
-}

Deleted: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DetypedDeployer.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DetypedDeployer.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DetypedDeployer.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -1,143 +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.as7.deployment.internal;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.List;
-import java.util.concurrent.CancellationException;
-
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.Operation;
-import org.jboss.as.controller.client.OperationBuilder;
-import org.jboss.as.protocol.StreamUtils;
-import org.jboss.dmr.ModelNode;
-
-/**
- * @author André Dietisheim
- */
-public class DetypedDeployer {
-
-	public static void undeploy(String name, String host, int port) throws DeployerException {
-		ModelControllerClient client = null;
-		try {
-			client = ModelControllerClient.Factory.create(host, port);
-			// undeploy
-			ModelNode request = new ModelNode();
-			request.get("operation").set("undeploy");
-			request.get("address").add("deployment", name);
-			ModelNode result = client.execute(request);
-			throwOnFailure(result);
-
-			// remove
-			request = new ModelNode();
-			request.get("operation").set("remove");
-			request.get("address").add("deployment", name);
-			result = client.execute(request);
-		} catch (Exception e) {
-			throw new DeployerException(e);
-		} finally {
-			StreamUtils.safeClose(client);
-		}
-	}
-
-	public static void deploy(File file, String host, int port) throws DeployerException {
-		deploy(file.getName(), file, host, port);
-	}
-
-	public static void deploy(String name, File file, String host, int port) throws DeployerException {
-		ModelControllerClient client = null;
-		try {
-			client = ModelControllerClient.Factory.create(host, port);
-
-			ModelNode request = new ModelNode();
-			request.get("operation").set("add");
-			request.get("address").add("deployment", name);
-			request.get("enabled").set(true);
-
-			OperationBuilder builder = OperationBuilder.Factory.create(request);
-			builder.addInputStream(new BufferedInputStream(new FileInputStream(file)));
-			Operation operation = builder.build();
-			request.get("input-stream-index").set(0);
-
-			ModelNode result = client.execute(operation);
-			System.out.println(result);
-
-			throwOnFailure(result);
-		} catch (Exception e) {
-			throw new DeployerException(e);
-		} finally {
-			StreamUtils.safeClose(client);
-		}
-	}
-
-	public static void replace(String name, File file, String host, int port) throws DeployerException {
-		ModelControllerClient client = null;
-		try {
-			client = ModelControllerClient.Factory.create(host, port);
-
-			ModelNode request = new ModelNode();
-			request.get("operation").set("full-replace-deployment");
-			request.get("name").set(name);
-
-			OperationBuilder builder = OperationBuilder.Factory.create(request);
-			builder.addInputStream(new BufferedInputStream(new FileInputStream(file)));
-			Operation operation = builder.build();
-			request.get("input-stream-index").set(0);
-
-			ModelNode result = client.execute(operation);
-
-			throwOnFailure(result);
-		} catch (Exception e) {
-			throw new DeployerException(e);
-		} finally {
-			StreamUtils.safeClose(client);
-		}
-	}
-
-	public static boolean isDeployed(String name, String host, int port) throws CancellationException, IOException {
-		ModelControllerClient client = ModelControllerClient.Factory.create(host, port);
-		try {
-			return JbossManagementUtil.isDeployed(name, client);
-		} finally {
-			StreamUtils.safeClose(client);
-		}
-	}
-
-	public static List<String> getDeployments(String host, int port) throws UnknownHostException {
-		ModelControllerClient client = ModelControllerClient.Factory.create(host, port);
-		return JbossManagementUtil.getDeployments(client);
-	}
-
-	private static void throwOnFailure(ModelNode result) throws DeployerException {
-		if (!JbossManagementUtil.isSuccess(result)) {
-			throw new DeployerException(JbossManagementUtil.getFailureDescription(result));
-		}
-	}
-
-	private DetypedDeployer() {
-		// inhibit instantiation
-	}
-}

Deleted: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JBossDeploymentManager.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JBossDeploymentManager.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JBossDeploymentManager.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -1,35 +0,0 @@
-package org.jboss.ide.eclipse.as7.deployment.internal;
-
-import java.io.File;
-import java.util.concurrent.Future;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.jboss.ide.eclipse.as7.deployment.IJBossDeploymentManager;
-
-public class JBossDeploymentManager implements IJBossDeploymentManager {
-
-	public Future asyncDeploy(String host, int port, String deploymentName,
-			File file, IProgressMonitor monitor) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public Object syncDeploy(String host, int port, String deploymentName,
-			File file, IProgressMonitor monitor) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public Future asyncUndeploy(String host, int port, String deploymentName,
-			boolean removeFile, IProgressMonitor monitor) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public Object syncUndeploy(String host, int port, String deploymentName,
-			boolean removeFile, IProgressMonitor monitor) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-}

Deleted: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JBossManagementService.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JBossManagementService.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JBossManagementService.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -1,25 +0,0 @@
-package org.jboss.ide.eclipse.as7.deployment.internal;
-
-import org.jboss.ide.eclipse.as7.deployment.IJBossDeploymentManager;
-import org.jboss.ide.eclipse.as7.deployment.IJBossManagementInterface;
-import org.jboss.ide.eclipse.as7.deployment.IJBossManagementService;
-
-public class JBossManagementService implements IJBossManagementService {
-
-	private IJBossDeploymentManager deploymentManager = null;
-	private IJBossManagementInterface manager = null;
-	
-	@Override
-	public IJBossDeploymentManager getDeploymentManager() {
-		if( deploymentManager == null )
-			deploymentManager = new JBossDeploymentManager();
-		return deploymentManager;
-	}
-
-	@Override
-	public IJBossManagementInterface getManagementInterface() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-}

Deleted: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JbossManagementUtil.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JbossManagementUtil.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JbossManagementUtil.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -1,166 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, 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.as7.deployment.internal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.Property;
-import org.jboss.ide.eclipse.as7.deployment.internal.operations.DefaultOperationRequestBuilder;
-import org.jboss.ide.eclipse.as7.deployment.internal.operations.OperationFormatException;
-
-/**
- *
- * @author Alexey Loubyansky
- */
-public class JbossManagementUtil {
-
-    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 byte[] getHash(ModelNode operationResult) {
-        if(!operationResult.hasDefined("result"))
-            return null;
-        return operationResult.get("result").asBytes();
-    }
-
-    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");
-            builder.addProperty("child-type", "deployment");
-            request = builder.buildRequest();
-        } catch (OperationFormatException e) {
-            throw new IllegalStateException("Failed to build operation", e);
-        }
-
-        try {
-            ModelNode outcome = client.execute(request);
-            if (isSuccess(outcome)) {
-                return getList(outcome);
-            }
-        } catch (Exception e) {
-        }
-
-        return Collections.emptyList();
-    }
-
-    public static List<String> getJmsResources(ModelControllerClient client, String type) {
-
-        DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
-        final ModelNode request;
-        try {
-            builder.addNode("subsystem", "jms");
-            builder.operationName("read-children-names");
-            builder.addProperty("child-type", type);
-            request = builder.buildRequest();
-        } catch (OperationFormatException e) {
-            throw new IllegalStateException("Failed to build operation", e);
-        }
-
-        try {
-            ModelNode outcome = client.execute(request);
-            if (isSuccess(outcome)) {
-                return getList(outcome);
-            }
-        } catch (Exception e) {
-        }
-
-        return Collections.emptyList();
-    }
-
-    public static boolean isTopic(ModelControllerClient client, String name) {
-        List<String> topics = getJmsResources(client, "topic");
-        return topics.contains(name);
-    }
-
-    public static boolean isQueue(ModelControllerClient client, String name) {
-        List<String> queues = getJmsResources(client, "queue");
-        return queues.contains(name);
-    }
-
-    public static boolean isConnectionFactory(ModelControllerClient client, String name) {
-        List<String> cf = getJmsResources(client, "connection-factory");
-        return cf.contains(name);
-    }
-}

Deleted: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/TypedDeployer.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/TypedDeployer.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/TypedDeployer.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -1,148 +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.as7.deployment.internal;
-
-import java.io.File;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.helpers.standalone.DeploymentPlan;
-import org.jboss.as.controller.client.helpers.standalone.InitialDeploymentPlanBuilder;
-import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
-import org.jboss.as.protocol.StreamUtils;
-
-/**
- * 
- * @author André Dietisheim
- */
-public class TypedDeployer {
-
-	public static void undeploySync(String name, String host, int port, IProgressMonitor monitor) throws DeployerException {
-		Future f = undeploy(name, host, port);
-		syncWait(f, monitor);
-	}	 
-	
-	public static void syncDeploy(String name, File file, String host, int port, IProgressMonitor monitor) throws DeployerException {
-		Future f = deploy(name, file, host, port);
-		syncWait(f, monitor);
-	}
-	
-	private static void syncWait(Future f, IProgressMonitor monitor) {
-		while(!f.isDone()) {
-			if( monitor.isCanceled()) {
-				f.cancel(true);
-				return;
-			}
-			try {
-				Thread.sleep(150);
-			} catch(InterruptedException ie) {
-			}
-		}
-	}
-	
-	public static Future undeploy(String name, String host, int port) throws DeployerException {
-		ModelControllerClient client = null;
-		try {
-			client = ModelControllerClient.Factory.create(host, port);
-			ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);
-			InitialDeploymentPlanBuilder builder = manager.newDeploymentPlan();
-
-			DeploymentPlan plan = builder.undeploy(name).andRemoveUndeployed().build();
-			return manager.execute(plan);
-		} catch (Exception e) {
-			throw new DeployerException(e);
-		} finally {
-			StreamUtils.safeClose(client);
-		}
-	}
-
-	public static Future deploy(File file, String host, int port) throws DeployerException {
-		return deploy(file.getName(), file, host, port);
-	}
-
-	public static Future deploy(String name, File file, String host, int port) throws DeployerException {
-		return internalDeploy(name, file, host, port, false);
-	}
-
-	public static Future replace(File file, String host, int port) throws DeployerException {
-		return replace(file.getName(), file, host, port);
-	}
-
-	public static Future replace(String name, File file, String host, int port) throws DeployerException {
-		return internalDeploy(name, file, host, port, true);
-	}
-
-	public static Future internalDeploy(String name, File file, String host, int port, boolean replace) throws DeployerException {
-		ModelControllerClient client = null;
-		try {
-			client = ModelControllerClient.Factory.create(host, port);
-			ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);
-			InitialDeploymentPlanBuilder builder = manager.newDeploymentPlan();
-
-			DeploymentPlan plan = null;
-			if( replace )
-				plan = builder.replace(name, file).build();
-			else 
-				plan = builder.add(name, file).deploy(name).build();
-				
-			return manager.execute(plan);
-		} catch (Exception e) {
-			throw new DeployerException(e);
-		} finally {
-			StreamUtils.safeClose(client);
-		}
-	}
-	
-	
-	//
-	// public static boolean isDeployed(String name, String host, int port)
-	// throws CancellationException, IOException {
-	// ModelControllerClient client = ModelControllerClient.Factory.create(host,
-	// port);
-	// try {
-	// return Util.isDeployed(name, client);
-	// } finally {
-	// StreamUtils.safeClose(client);
-	// }
-	// }
-	//
-	// public static List<String> getDeployments(String host, int port) throws
-	// UnknownHostException {
-	// ModelControllerClient client = ModelControllerClient.Factory.create(host,
-	// port);
-	// return Util.getDeployments(client);
-	// }
-	//
-	// private static void throwOnFailure(ModelNode result) throws
-	// DeployerException {
-	// if (!Util.isSuccess(result)) {
-	// throw new DeployerException(Util.getFailureDescription(result));
-	// }
-	// }
-
-	private TypedDeployer() {
-		// inhibit instantiation
-	}
-
-}

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/Activator.java (from rev 30584, workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Activator.java)
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/Activator.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/Activator.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -0,0 +1,30 @@
+package org.jboss.ide.eclipse.as7.internal.deployment;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+	private static BundleContext context;
+
+	public static BundleContext getContext() {
+		return context;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext bundleContext) throws Exception {
+		Activator.context = bundleContext;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext bundleContext) throws Exception {
+		Activator.context = null;
+	}
+
+}


Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/Activator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/Deployable.java (from rev 30584, workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Deployable.java)
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/Deployable.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/Deployable.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -0,0 +1,94 @@
+package org.jboss.ide.eclipse.as7.internal.deployment;
+
+import java.io.File;
+import java.text.MessageFormat;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+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;
+
+public class Deployable {
+
+	private String name;
+	private File file;
+	private Future<ServerDeploymentPlanResult> resultFuture;
+	private long timeout;
+	private DeploymentAction action;
+
+	protected Deployable(String name, File file, long timeout) {
+		this.name = name;
+		this.file = file;
+		this.timeout = timeout;
+	}
+
+	protected void setDeploymentAction(DeploymentAction action) {
+		this.action = action;
+	}
+
+	protected void setResultFuture(Future<ServerDeploymentPlanResult> resultFuture) {
+		this.resultFuture = resultFuture;
+	}
+
+	public File getFile() {
+		return file;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public IStatus getStatus() throws DeployerException {
+		if (resultFuture == null
+				|| action == null) {
+			return null;
+		}
+		try {
+			ServerDeploymentPlanResult result = resultFuture.get(timeout, TimeUnit.MILLISECONDS);
+			ServerDeploymentActionResult actionResult = result.getDeploymentActionResult(action.getId());
+			return createStatus(action, actionResult);
+		} catch (Exception e) {
+			throw new DeployerException(e);
+		}
+	}
+
+	private IStatus createStatus(DeploymentAction action, ServerDeploymentActionResult actionResult) {
+		if (actionResult == null) {
+			return null;
+		}
+
+		IStatus status = null;
+		switch (actionResult.getResult()) {
+		case NOT_EXECUTED:
+			status = createStatus(IStatus.ERROR, "The operation {0} was not executed on unit {1}", action
+					.getType().name(), getName());
+			break;
+		case EXECUTED:
+			status = Status.OK_STATUS;
+			break;
+		case FAILED:
+			status = createStatus(IStatus.ERROR, "The operation {0} failed for unit {1}", action.getType()
+					.name(), getName());
+			break;
+		case ROLLED_BACK:
+			status = createStatus(IStatus.ERROR, "The operation {0} for unit {1} was rolled back", action
+					.getType().name(), getName());
+			break;
+		case CONFIGURATION_MODIFIED_REQUIRES_RESTART:
+			status = createStatus(
+					IStatus.WARNING,
+					"The operation {0} was not executed on unit {1}. The server configuration was changed though and the server needs to be restarted",
+					action.getType().name(), getName());
+			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: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/Deployable.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/DeployerException.java (from rev 30584, workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeployerException.java)
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/DeployerException.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/DeployerException.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -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.as7.internal.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);
+	}
+
+}


Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/DeployerException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/DeploymentManager.java (from rev 30584, workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeploymentManager.java)
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/DeploymentManager.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/DeploymentManager.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -0,0 +1,169 @@
+/*
+ * 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.as7.internal.deployment;
+
+import static org.jboss.as.protocol.StreamUtils.safeClose;
+
+import java.io.File;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
+
+/**
+ * Used to deploy/undeploy deployments to a running <b>standalone</b>
+ * application server
+ * 
+ * @author <a href="adietish at redhat.com">André Dietisheim</a>
+ */
+public class DeploymentManager {
+
+	public static final long DEFAULT_TIMEOUT = 15000;
+
+	private final List<IDeploymentPlanBuilderOperation> deployments = new ArrayList<IDeploymentPlanBuilderOperation>();
+	private final ModelControllerClient client;
+	private final ServerDeploymentManager manager;
+	private long timeout = DEFAULT_TIMEOUT;
+
+	public DeploymentManager(String host, int port) throws UnknownHostException {
+		client = ModelControllerClient.Factory.create(host, port);
+		manager = ServerDeploymentManager.Factory.create(client);
+	}
+
+	public synchronized DeploymentManager deploy(File file) {
+		deployments.add(new DeployOperation(file));
+		return this;
+	}
+
+	public synchronized DeploymentManager deploy(String name, File file) {
+		deployments.add(new DeployOperation(name, file));
+		return this;
+	}
+
+	public synchronized DeploymentManager undeploy(String name) {
+		deployments.add(new UndeployOperation(name));
+		return this;
+	}
+
+	public synchronized DeploymentManager undeploy(File file) {
+		deployments.add(new UndeployOperation(file));
+		return this;
+	}
+
+	public synchronized void execute() throws DeployerException {
+		try {
+			DeploymentPlanBuilder builder = manager.newDeploymentPlan();
+			for (IDeploymentPlanBuilderOperation deployment : deployments) {
+				builder = deployment.addTo(builder);
+			}
+			manager.execute(builder.build()).get(timeout, TimeUnit.MILLISECONDS);
+		} catch (Exception e) {
+			throw new DeployerException(e);
+		}
+	}
+
+	public void setTimeout(long timeout) {
+		this.timeout = timeout;
+	}
+
+	public void dispose() {
+		safeClose(client);
+	}
+
+	private static class DeployOperation extends FileOperation {
+
+		private DeployOperation(File file) {
+			super(file);
+		}
+
+		private DeployOperation(String name, File file) {
+			super(name, file);
+		}
+
+		public synchronized DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception {
+			String name = getName();
+			return builder.add(name, getFile()).deploy(name);
+		}		
+	}
+	
+	private static class UndeployOperation extends FileOperation {
+
+		private UndeployOperation(File file) {
+			super(file);
+		}
+
+		private UndeployOperation(String name) {
+			super(name, null);
+		}
+
+		public synchronized DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception {
+			String name = getName();
+			return builder.undeploy(name).undeploy(name);
+		}
+	}
+	
+	private abstract static class FileOperation extends NamedOperation {
+
+		private File file;
+
+		private FileOperation(File file) {
+			this(null, file);
+		}
+
+		private FileOperation(String name, File file) {
+			super(name);
+			this.file = file;
+		}
+
+		protected File getFile() {
+			return file;
+		}
+
+		protected String getName() {
+			if (name != null) {
+				return name;
+			} else {
+				return file.getName();
+			}
+		}
+
+	}
+
+	private abstract static class NamedOperation implements IDeploymentPlanBuilderOperation {
+
+		protected String name;
+
+		private NamedOperation(String name) {
+			this.name = name;
+		}
+	}
+
+	private interface IDeploymentPlanBuilderOperation {
+
+		public DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception;
+
+	}
+}


Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/DeploymentManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/DetypedDeployer.java (from rev 30584, workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DetypedDeployer.java)
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/DetypedDeployer.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/DetypedDeployer.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -0,0 +1,143 @@
+/*
+ * 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.as7.internal.deployment;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.UnknownHostException;
+import java.util.List;
+import java.util.concurrent.CancellationException;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.Operation;
+import org.jboss.as.controller.client.OperationBuilder;
+import org.jboss.as.protocol.StreamUtils;
+import org.jboss.dmr.ModelNode;
+
+/**
+ * @author André Dietisheim
+ */
+public class DetypedDeployer {
+
+	public static void undeploy(String name, String host, int port) throws DeployerException {
+		ModelControllerClient client = null;
+		try {
+			client = ModelControllerClient.Factory.create(host, port);
+			// undeploy
+			ModelNode request = new ModelNode();
+			request.get("operation").set("undeploy");
+			request.get("address").add("deployment", name);
+			ModelNode result = client.execute(request);
+			throwOnFailure(result);
+
+			// remove
+			request = new ModelNode();
+			request.get("operation").set("remove");
+			request.get("address").add("deployment", name);
+			result = client.execute(request);
+		} catch (Exception e) {
+			throw new DeployerException(e);
+		} finally {
+			StreamUtils.safeClose(client);
+		}
+	}
+
+	public static void deploy(File file, String host, int port) throws DeployerException {
+		deploy(file.getName(), file, host, port);
+	}
+
+	public static void deploy(String name, File file, String host, int port) throws DeployerException {
+		ModelControllerClient client = null;
+		try {
+			client = ModelControllerClient.Factory.create(host, port);
+
+			ModelNode request = new ModelNode();
+			request.get("operation").set("add");
+			request.get("address").add("deployment", name);
+			request.get("enabled").set(true);
+
+			OperationBuilder builder = OperationBuilder.Factory.create(request);
+			builder.addInputStream(new BufferedInputStream(new FileInputStream(file)));
+			Operation operation = builder.build();
+			request.get("input-stream-index").set(0);
+
+			ModelNode result = client.execute(operation);
+			System.out.println(result);
+
+			throwOnFailure(result);
+		} catch (Exception e) {
+			throw new DeployerException(e);
+		} finally {
+			StreamUtils.safeClose(client);
+		}
+	}
+
+	public static void replace(String name, File file, String host, int port) throws DeployerException {
+		ModelControllerClient client = null;
+		try {
+			client = ModelControllerClient.Factory.create(host, port);
+
+			ModelNode request = new ModelNode();
+			request.get("operation").set("full-replace-deployment");
+			request.get("name").set(name);
+
+			OperationBuilder builder = OperationBuilder.Factory.create(request);
+			builder.addInputStream(new BufferedInputStream(new FileInputStream(file)));
+			Operation operation = builder.build();
+			request.get("input-stream-index").set(0);
+
+			ModelNode result = client.execute(operation);
+
+			throwOnFailure(result);
+		} catch (Exception e) {
+			throw new DeployerException(e);
+		} finally {
+			StreamUtils.safeClose(client);
+		}
+	}
+
+	public static boolean isDeployed(String name, String host, int port) throws CancellationException, IOException {
+		ModelControllerClient client = ModelControllerClient.Factory.create(host, port);
+		try {
+			return JbossManagementUtil.isDeployed(name, client);
+		} finally {
+			StreamUtils.safeClose(client);
+		}
+	}
+
+	public static List<String> getDeployments(String host, int port) throws UnknownHostException {
+		ModelControllerClient client = ModelControllerClient.Factory.create(host, port);
+		return JbossManagementUtil.getDeployments(client);
+	}
+
+	private static void throwOnFailure(ModelNode result) throws DeployerException {
+		if (!JbossManagementUtil.isSuccess(result)) {
+			throw new DeployerException(JbossManagementUtil.getFailureDescription(result));
+		}
+	}
+
+	private DetypedDeployer() {
+		// inhibit instantiation
+	}
+}

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/JBossDeploymentManager.java (from rev 30584, workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JBossDeploymentManager.java)
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/JBossDeploymentManager.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/JBossDeploymentManager.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -0,0 +1,35 @@
+package org.jboss.ide.eclipse.as7.internal.deployment;
+
+import java.io.File;
+import java.util.concurrent.Future;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.as7.deployment.IJBossDeploymentManager;
+
+public class JBossDeploymentManager implements IJBossDeploymentManager {
+
+	public Future asyncDeploy(String host, int port, String deploymentName,
+			File file, IProgressMonitor monitor) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object syncDeploy(String host, int port, String deploymentName,
+			File file, IProgressMonitor monitor) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Future asyncUndeploy(String host, int port, String deploymentName,
+			boolean removeFile, IProgressMonitor monitor) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object syncUndeploy(String host, int port, String deploymentName,
+			boolean removeFile, IProgressMonitor monitor) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/JBossManagementService.java (from rev 30584, workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JBossManagementService.java)
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/JBossManagementService.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/JBossManagementService.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -0,0 +1,25 @@
+package org.jboss.ide.eclipse.as7.internal.deployment;
+
+import org.jboss.ide.eclipse.as7.deployment.IJBossDeploymentManager;
+import org.jboss.ide.eclipse.as7.deployment.IJBossManagementInterface;
+import org.jboss.ide.eclipse.as7.deployment.IJBossManagementService;
+
+public class JBossManagementService implements IJBossManagementService {
+
+	private IJBossDeploymentManager deploymentManager = null;
+	private IJBossManagementInterface manager = null;
+	
+	@Override
+	public IJBossDeploymentManager getDeploymentManager() {
+		if( deploymentManager == null )
+			deploymentManager = new JBossDeploymentManager();
+		return deploymentManager;
+	}
+
+	@Override
+	public IJBossManagementInterface getManagementInterface() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/JbossManagementUtil.java (from rev 30584, workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/JbossManagementUtil.java)
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/JbossManagementUtil.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/JbossManagementUtil.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as7.internal.deployment;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.Property;
+import org.jboss.ide.eclipse.as7.internal.deployment.operations.DefaultOperationRequestBuilder;
+import org.jboss.ide.eclipse.as7.internal.deployment.operations.OperationFormatException;
+
+/**
+ *
+ * @author Alexey Loubyansky
+ */
+public class JbossManagementUtil {
+
+    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 byte[] getHash(ModelNode operationResult) {
+        if(!operationResult.hasDefined("result"))
+            return null;
+        return operationResult.get("result").asBytes();
+    }
+
+    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");
+            builder.addProperty("child-type", "deployment");
+            request = builder.buildRequest();
+        } catch (OperationFormatException e) {
+            throw new IllegalStateException("Failed to build operation", e);
+        }
+
+        try {
+            ModelNode outcome = client.execute(request);
+            if (isSuccess(outcome)) {
+                return getList(outcome);
+            }
+        } catch (Exception e) {
+        }
+
+        return Collections.emptyList();
+    }
+
+    public static List<String> getJmsResources(ModelControllerClient client, String type) {
+
+        DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+        final ModelNode request;
+        try {
+            builder.addNode("subsystem", "jms");
+            builder.operationName("read-children-names");
+            builder.addProperty("child-type", type);
+            request = builder.buildRequest();
+        } catch (OperationFormatException e) {
+            throw new IllegalStateException("Failed to build operation", e);
+        }
+
+        try {
+            ModelNode outcome = client.execute(request);
+            if (isSuccess(outcome)) {
+                return getList(outcome);
+            }
+        } catch (Exception e) {
+        }
+
+        return Collections.emptyList();
+    }
+
+    public static boolean isTopic(ModelControllerClient client, String name) {
+        List<String> topics = getJmsResources(client, "topic");
+        return topics.contains(name);
+    }
+
+    public static boolean isQueue(ModelControllerClient client, String name) {
+        List<String> queues = getJmsResources(client, "queue");
+        return queues.contains(name);
+    }
+
+    public static boolean isConnectionFactory(ModelControllerClient client, String name) {
+        List<String> cf = getJmsResources(client, "connection-factory");
+        return cf.contains(name);
+    }
+}

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/TypedDeployer.java (from rev 30584, workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/TypedDeployer.java)
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/TypedDeployer.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/TypedDeployer.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -0,0 +1,148 @@
+/*
+ * 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.as7.internal.deployment;
+
+import java.io.File;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.helpers.standalone.DeploymentPlan;
+import org.jboss.as.controller.client.helpers.standalone.InitialDeploymentPlanBuilder;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
+import org.jboss.as.protocol.StreamUtils;
+
+/**
+ * 
+ * @author André Dietisheim
+ */
+public class TypedDeployer {
+
+	public static void undeploySync(String name, String host, int port, IProgressMonitor monitor) throws DeployerException {
+		Future f = undeploy(name, host, port);
+		syncWait(f, monitor);
+	}	 
+	
+	public static void syncDeploy(String name, File file, String host, int port, IProgressMonitor monitor) throws DeployerException {
+		Future f = deploy(name, file, host, port);
+		syncWait(f, monitor);
+	}
+	
+	private static void syncWait(Future f, IProgressMonitor monitor) {
+		while(!f.isDone()) {
+			if( monitor.isCanceled()) {
+				f.cancel(true);
+				return;
+			}
+			try {
+				Thread.sleep(150);
+			} catch(InterruptedException ie) {
+			}
+		}
+	}
+	
+	public static Future undeploy(String name, String host, int port) throws DeployerException {
+		ModelControllerClient client = null;
+		try {
+			client = ModelControllerClient.Factory.create(host, port);
+			ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);
+			InitialDeploymentPlanBuilder builder = manager.newDeploymentPlan();
+
+			DeploymentPlan plan = builder.undeploy(name).andRemoveUndeployed().build();
+			return manager.execute(plan);
+		} catch (Exception e) {
+			throw new DeployerException(e);
+		} finally {
+			StreamUtils.safeClose(client);
+		}
+	}
+
+	public static Future deploy(File file, String host, int port) throws DeployerException {
+		return deploy(file.getName(), file, host, port);
+	}
+
+	public static Future deploy(String name, File file, String host, int port) throws DeployerException {
+		return internalDeploy(name, file, host, port, false);
+	}
+
+	public static Future replace(File file, String host, int port) throws DeployerException {
+		return replace(file.getName(), file, host, port);
+	}
+
+	public static Future replace(String name, File file, String host, int port) throws DeployerException {
+		return internalDeploy(name, file, host, port, true);
+	}
+
+	public static Future internalDeploy(String name, File file, String host, int port, boolean replace) throws DeployerException {
+		ModelControllerClient client = null;
+		try {
+			client = ModelControllerClient.Factory.create(host, port);
+			ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);
+			InitialDeploymentPlanBuilder builder = manager.newDeploymentPlan();
+
+			DeploymentPlan plan = null;
+			if( replace )
+				plan = builder.replace(name, file).build();
+			else 
+				plan = builder.add(name, file).deploy(name).build();
+				
+			return manager.execute(plan);
+		} catch (Exception e) {
+			throw new DeployerException(e);
+		} finally {
+			StreamUtils.safeClose(client);
+		}
+	}
+	
+	
+	//
+	// public static boolean isDeployed(String name, String host, int port)
+	// throws CancellationException, IOException {
+	// ModelControllerClient client = ModelControllerClient.Factory.create(host,
+	// port);
+	// try {
+	// return Util.isDeployed(name, client);
+	// } finally {
+	// StreamUtils.safeClose(client);
+	// }
+	// }
+	//
+	// public static List<String> getDeployments(String host, int port) throws
+	// UnknownHostException {
+	// ModelControllerClient client = ModelControllerClient.Factory.create(host,
+	// port);
+	// return Util.getDeployments(client);
+	// }
+	//
+	// private static void throwOnFailure(ModelNode result) throws
+	// DeployerException {
+	// if (!Util.isSuccess(result)) {
+	// throw new DeployerException(Util.getFailureDescription(result));
+	// }
+	// }
+
+	private TypedDeployer() {
+		// inhibit instantiation
+	}
+
+}


Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/TypedDeployer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/CommandFormatException.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/operations/CommandFormatException.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/CommandFormatException.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -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.as7.deployment.internal.operations;
+package org.jboss.ide.eclipse.as7.internal.deployment.operations;
 
 /**
  * @author Alexey Loubyansky

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/CommandLineException.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/operations/CommandLineException.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/CommandLineException.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -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.as7.deployment.internal.operations;
+package org.jboss.ide.eclipse.as7.internal.deployment.operations;
 
 /**
  * @author Alexey Loubyansky

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/DefaultOperationRequestAddress.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/operations/DefaultOperationRequestAddress.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/DefaultOperationRequestAddress.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -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.as7.deployment.internal.operations;
+package org.jboss.ide.eclipse.as7.internal.deployment.operations;
 
 import java.util.ArrayList;
 import java.util.Iterator;

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/DefaultOperationRequestBuilder.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/operations/DefaultOperationRequestBuilder.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/DefaultOperationRequestBuilder.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -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.as7.deployment.internal.operations;
+package org.jboss.ide.eclipse.as7.internal.deployment.operations;
 
 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.as7.deployment.internal.operations.OperationRequestAddress.Node;
+import org.jboss.ide.eclipse.as7.internal.deployment.operations.OperationRequestAddress.Node;
 
 /**
  *

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/OperationFormatException.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/operations/OperationFormatException.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/OperationFormatException.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -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.as7.deployment.internal.operations;
+package org.jboss.ide.eclipse.as7.internal.deployment.operations;
 
 
 /**

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/OperationRequestAddress.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/operations/OperationRequestAddress.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/OperationRequestAddress.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -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.as7.deployment.internal.operations;
+package org.jboss.ide.eclipse.as7.internal.deployment.operations;
 
 
 

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/OperationRequestBuilder.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/operations/OperationRequestBuilder.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/OperationRequestBuilder.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -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.as7.deployment.internal.operations;
+package org.jboss.ide.eclipse.as7.internal.deployment.operations;
 
 import org.jboss.dmr.ModelNode;
 

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/ValidatingOperationCallbackHandler.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/operations/ValidatingOperationCallbackHandler.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/internal/deployment/operations/ValidatingOperationCallbackHandler.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -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.as7.deployment.internal.operations;
+package org.jboss.ide.eclipse.as7.internal.deployment.operations;
 
 import java.util.regex.Pattern;
 

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentManagerIntegratonTest.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentManagerIntegratonTest.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentManagerIntegratonTest.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -35,8 +35,8 @@
 
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Platform;
-import org.jboss.ide.eclipse.as7.deployment.internal.DeployerException;
-import org.jboss.ide.eclipse.as7.deployment.internal.DeploymentManager;
+import org.jboss.ide.eclipse.as7.internal.deployment.DeployerException;
+import org.jboss.ide.eclipse.as7.internal.deployment.DeploymentManager;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DetypedDeployerIntegrationTest.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DetypedDeployerIntegrationTest.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DetypedDeployerIntegrationTest.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -31,7 +31,7 @@
 
 import org.jboss.ide.eclipse.as7.deployment.detyped.DeployerException;
 import org.jboss.ide.eclipse.as7.deployment.detyped.DetypedDeployer;
-import org.jboss.ide.eclipse.as7.deployment.internal.TypedDeployer;
+import org.jboss.ide.eclipse.as7.internal.deployment.TypedDeployer;
 import org.junit.Test;
 
 /**

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/TypedDeployerIntegrationTest.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/TypedDeployerIntegrationTest.java	2011-04-15 03:25:25 UTC (rev 30584)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/TypedDeployerIntegrationTest.java	2011-04-15 10:01:21 UTC (rev 30585)
@@ -25,8 +25,8 @@
 
 import java.io.File;
 
-import org.jboss.ide.eclipse.as7.deployment.internal.DeployerException;
-import org.jboss.ide.eclipse.as7.deployment.internal.TypedDeployer;
+import org.jboss.ide.eclipse.as7.internal.deployment.DeployerException;
+import org.jboss.ide.eclipse.as7.internal.deployment.TypedDeployer;
 import org.junit.Test;
 
 /**



More information about the jbosstools-commits mailing list