All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wildfly.plugin.tools.DeploymentManager Maven / Gradle / Ivy

/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package org.wildfly.plugin.tools;

import java.io.IOException;
import java.util.Set;

import org.jboss.as.controller.client.ModelControllerClient;

/**
 * Allows deployment operations to be executed on a running server. This will work with both standalone servers and
 * managed domain servers.
 * 

* The {@linkplain DeploymentResult#asModelNode() server result} for each deployment operation will be the result of a * composite operation. *

*

* If the server is a managed domain {@linkplain DeploymentDescription#getServerGroups() server groups} are required. If * the server is a standalone server no server groups are allowed to be define. A failed {@link DeploymentResult} * will be returned if the server groups are empty for a managed domain or populated for a standalone server. *

* * @author James R. Perkins */ @SuppressWarnings("unused") public interface DeploymentManager { /** * Deploys the content to the server. *

* If the deployment is not {@linkplain Deployment#setEnabled(boolean) enabled} a {@code deploy} operation will * need to be invoked. This can also be achieved by invoking the {@link #deployToRuntime(DeploymentDescription)} * method. *

* * @param deployment the deployment to deploy * * @return the result of the deployment * * @throws IOException if a failure occurs communicating with the server * @see #deployToRuntime(DeploymentDescription) */ DeploymentResult deploy(Deployment deployment) throws IOException; /** * Deploys the content of each deployment to the server. *

* If the deployment is not {@linkplain Deployment#setEnabled(boolean) enabled} a {@code deploy} operation will * need to be invoked. This can also be achieved by invoking the {@link #deployToRuntime(Set)} method. *

*

* Also note that it is safe to trigger a {@code deploy} operation on already deployed deployments. *

* * @param deployments a set of deployments to deploy * * @return the result of the deployment * * @throws IOException if a failure occurs communicating with the server * @see #deployToRuntime(Set) */ DeploymentResult deploy(Set deployments) throws IOException; /** * Deploys the content to the server if it does not already exist on the server. If the deployment already exist the * deployment is replaced. *

* If the deployment is not {@linkplain Deployment#setEnabled(boolean) enabled} a {@code deploy} operation will * need to be invoked. This can also be achieved by invoking the {@link #deployToRuntime(DeploymentDescription)} * method. *

* * @param deployment the deployment to deploy * * @return the result of the deployment * * @throws IOException if a failure occurs communicating with the server * @see #deployToRuntime(DeploymentDescription) */ DeploymentResult forceDeploy(Deployment deployment) throws IOException; /** * Deploys the content to the server if it does not already exist on the server. If the deployment already exist the * deployment is replaced. *

* If the deployment is not {@linkplain Deployment#setEnabled(boolean) enabled} a {@code deploy} operation will * need to be invoked. This can also be achieved by invoking the {@link #deployToRuntime(Set)} method. *

*

* Also note that it is safe to trigger a {@code deploy} operation on already deployed deployments. *

* * @param deployments a set of deployments to deploy * * @return the result of the deployment * * @throws IOException if a failure occurs communicating with the server * @see #deployToRuntime(Set) */ DeploymentResult forceDeploy(Set deployments) throws IOException; /** * Deploys existing deployment content to the runtime. * * @param deployment the deployment description to deploy * * @return the result of the deployment * * @throws IOException if a failure occurs communicating with the server */ DeploymentResult deployToRuntime(DeploymentDescription deployment) throws IOException; /** * Deploys existing deployment content to the runtime for each deployment description. * * @param deployments the deployment descriptions to deploy * * @return the result of the deployment * * @throws IOException if a failure occurs communicating with the server */ DeploymentResult deployToRuntime(Set deployments) throws IOException; /** * Redeploys the content to the server. Uses a {@code full-replace-deployment} operation to upload the new content, * undeploy the old content, deploy the new content and then remove the old content. *

* If the deployment is not {@linkplain Deployment#setEnabled(boolean) enabled} a {@code deploy} or {@code redeploy} * operation will need to be invoked. This can also be achieved by invoking the * {@link #deployToRuntime(DeploymentDescription)} method or the {@link #redeployToRuntime(DeploymentDescription)} * method. *

* * @param deployment the deployment to redeploy * * @return the result of the deployment * * @throws IOException if a failure occurs communicating with the server * @see #redeployToRuntime(DeploymentDescription) */ DeploymentResult redeploy(Deployment deployment) throws IOException; /** * Redeploys the content to the server. Uses a {@code full-replace-deployment} operation to upload the new content, * undeploy the old content, deploy the new content and then remove the old content. *

* If the deployment is not {@linkplain Deployment#setEnabled(boolean) enabled} a {@code deploy} or {@code redeploy} * operation will need to be invoked. This can also be achieved by invoking the {@link #deployToRuntime(Set)} * method or the {@link #redeployToRuntime(Set)} method. *

*

* Also note that it is safe to trigger a {@code deploy} or operation on already deployed deployments. *

* * @param deployments a set of deployments to redeploy * * @return the result of the deployment * * @throws IOException if a failure occurs communicating with the server * @see #redeployToRuntime(Set) */ DeploymentResult redeploy(Set deployments) throws IOException; /** * Redeploys existing deployment content to the runtime. * * @param deployment the deployment description to redeploy * * @return the result of the deployment * * @throws IOException if a failure occurs communicating with the server */ DeploymentResult redeployToRuntime(DeploymentDescription deployment) throws IOException; /** * Redeploys existing deployment content to the runtime for each deployment description. * * @param deployments the deployment descriptions to redeploy * * @return the result of the deployment * * @throws IOException if a failure occurs communicating with the server */ DeploymentResult redeployToRuntime(Set deployments) throws IOException; /** * Undeploys the deployment from the server. * * @param undeployDescription the description for undeploying the content * * @return the result of the deployment * * @throws IOException if a failure occurs communicating with the server */ DeploymentResult undeploy(UndeployDescription undeployDescription) throws IOException; /** * Undeploys the deployment from the server. * * @param undeployDescriptions the descriptions for undeploying the content * * @return the result of the deployment * * @throws IOException if a failure occurs communicating with the server */ DeploymentResult undeploy(Set undeployDescriptions) throws IOException; /** * Returns the available deployments. * * @return the deployments * * @throws IOException if a failure occurs communicating with the server */ Set getDeployments() throws IOException; /** * Returns all the deployments on the specified server-group. These deployments may also belong to other server * groups. * * @param serverGroup the server group to get the deployments for * * @return the deployments * * @throws IOException if a failure occurs communicating with the server * @throws IllegalStateException if the running server is not a managed domain */ Set getDeployments(String serverGroup) throws IOException; /** * Returns the names of deployed content. * * @return the names of deployed content * * @throws IOException if a failure occurs communicating with the server */ Set getDeploymentNames() throws IOException; /** * Checks if the deployment content is on the server. * * @param name the name of the deployment * * @return {@code true} if the deployment content exists otherwise {@code false} * * @throws IOException if a failure occurs communicating with the server */ boolean hasDeployment(String name) throws IOException; /** * Checks if the deployment content is on the server. * * @param name the name of the deployment * @param serverGroup the server group to check for the deployment on * * @return {@code true} if the deployment content exists otherwise {@code false} */ boolean hasDeployment(String name, String serverGroup) throws IOException; /** * Checks if the deployment has been deployed to the runtime. The deployment must already exist on the server. *

* If a deployment is enabled it has been deployed to the runtime. Otherwise the deployment has not been * deployed to the runtime. *

* * @param name the name of the deployment * * @return {@code true} if the deployment content exists and is enabled otherwise {@code false} * * @throws IOException if a failure occurs communicating with the server * @see #isEnabled(String, String) for managed domain deployments */ boolean isEnabled(String name) throws IOException; /** * Checks if the deployment has been deployed to the runtime. The deployment must already exist on the server. *

* If a deployment is enabled it has been deployed to the runtime. Otherwise the deployment has not been * deployed to the runtime. *

* * @param name the name of the deployment * @param serverGroup the server group to check for the deployment on * * @return {@code true} if the deployment content exists and is enabled otherwise {@code false} * * @see #isEnabled(String) for standalone deployments */ boolean isEnabled(String name, String serverGroup) throws IOException; /** * Creates a new deployment manager. *

* The client will not be {@linkplain ModelControllerClient#close() closed} by the {@link DeploymentManager}. * The user is responsible for {@linkplain ModelControllerClient#close() closing} the client. *

* * @param client the client used to communicate with the server * * @return a new deployment manager * * @since 1.2 */ public static DeploymentManager create(final ModelControllerClient client) { return new DefaultDeploymentManager(client); } /** * A factory to create a new deployment manager */ @Deprecated(forRemoval = true, since = "1.2") class Factory { /** * Creates a new deployment manager. *

* The client will not be {@linkplain ModelControllerClient#close() closed} by the {@link DeploymentManager}. * The user is responsible for {@linkplain ModelControllerClient#close() closing} the client. *

* * @param client the client used to communicate with the server * * @return a new deployment manager */ @Deprecated(forRemoval = true, since = "1.2") public static DeploymentManager create(final ModelControllerClient client) { return new DefaultDeploymentManager(client); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy