use of org.guvnor.ala.wildfly.access.exceptions.WildflyClientException in project kie-wb-common by kiegroup.
the class WildflyRuntimeManager method pause.
@Override
public void pause(RuntimeId runtimeId) throws RuntimeOperationException {
WildflyRuntime runtime = (WildflyRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
try {
wildfly.getWildflyClient(runtime.getProviderId()).stop(runtime.getId());
refresh(runtimeId);
} catch (WildflyClientException ex) {
throw new RuntimeOperationException("Error Pausing container: " + runtimeId.getId() + "\n\t There as a problem with stopping your application, please check into the Wildfly Logs for more information.", ex);
}
}
use of org.guvnor.ala.wildfly.access.exceptions.WildflyClientException in project kie-wb-common by kiegroup.
the class WildflyRuntimeManager method restart.
@Override
public void restart(RuntimeId runtimeId) {
WildflyRuntime runtime = (WildflyRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
try {
wildfly.getWildflyClient(runtime.getProviderId()).restart(runtime.getId());
refresh(runtimeId);
} catch (WildflyClientException ex) {
throw new RuntimeOperationException("Error Restarting container: " + runtimeId.getId() + "\n\t There as a problem with restarting your application, please check into the Wildfly Logs for more information.", ex);
}
}
use of org.guvnor.ala.wildfly.access.exceptions.WildflyClientException in project kie-wb-common by kiegroup.
the class WildflyClient method start.
/*
* Start the application specified by the deploymentName
* @param String deploymentName
* @return the 200 on successful start
* @throw a WildflyClientException with the status code on failure
* @throw a WildflyClientException with the throwable in case of an internal exception
*/
public int start(String deploymentName) throws WildflyClientException {
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(new AuthScope(host, managementPort), new UsernamePasswordCredentials(user, password));
CloseableHttpClient httpclient = custom().setDefaultCredentialsProvider(credsProvider).build();
final HttpPost post = new HttpPost("http://" + host + ":" + managementPort + "/management");
post.addHeader("X-Management-Client-Name", "GUVNOR-ALA");
// the DMR operation
ModelNode operation = new ModelNode();
operation.get("operation").set("deploy");
operation.get("address").add("deployment", deploymentName);
post.setEntity(new StringEntity(operation.toJSONString(true), APPLICATION_JSON));
try {
HttpResponse response = httpclient.execute(post);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
throw new WildflyClientException("Error Starting App Status Code: " + statusCode);
}
return statusCode;
} catch (IOException ex) {
getLogger(WildflyClient.class.getName()).log(SEVERE, null, ex);
throw new WildflyClientException("Error Starting App : " + ex.getMessage(), ex);
}
}
use of org.guvnor.ala.wildfly.access.exceptions.WildflyClientException in project kie-wb-common by kiegroup.
the class WildflyClient method stop.
/*
* Stop the application specified by the deploymentName
* @param String deploymentName
* @return the 200 on successful stop
* @throw a WildflyClientException with the status code on failure
* @throw a WildflyClientException with the throwable in case of an internal exception
*/
public int stop(String deploymentName) throws WildflyClientException {
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(new AuthScope(host, managementPort), new UsernamePasswordCredentials(user, password));
CloseableHttpClient httpclient = custom().setDefaultCredentialsProvider(credsProvider).build();
final HttpPost post = new HttpPost("http://" + host + ":" + managementPort + "/management");
post.addHeader("X-Management-Client-Name", "GUVNOR-ALA");
// the DMR operation
ModelNode operation = new ModelNode();
operation.get("operation").set("undeploy");
operation.get("address").add("deployment", deploymentName);
post.setEntity(new StringEntity(operation.toJSONString(true), APPLICATION_JSON));
try {
HttpResponse response = httpclient.execute(post);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
throw new WildflyClientException("Error Stopping App Status Code: " + statusCode);
}
return statusCode;
} catch (IOException ex) {
LOG.error("Error Stopping App : " + ex.getMessage(), ex);
throw new WildflyClientException("Error Stopping App : " + ex.getMessage(), ex);
}
}
use of org.guvnor.ala.wildfly.access.exceptions.WildflyClientException in project kie-wb-common by kiegroup.
the class WildflyRuntimeManager method stop.
@Override
public void stop(RuntimeId runtimeId) throws RuntimeOperationException {
WildflyRuntime runtime = (WildflyRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
try {
wildfly.getWildflyClient(runtime.getProviderId()).stop(runtime.getId());
refresh(runtimeId);
} catch (WildflyClientException ex) {
throw new RuntimeOperationException("Error Stopping container: " + runtimeId.getId() + "\n\t There as a problem with stopping your application, please check into the Wildfly Logs for more information.", ex);
}
}
Aggregations