/** * 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 */ public boolean hasDeployment(final String name) throws IOException { checkState(); return deploymentManager.hasDeployment(name); }
/** * 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 */ public boolean hasDeployment(final String name) throws IOException { checkState(); return deploymentManager.hasDeployment(name); }
private String deployInternal(Archive<?> archive) throws DeploymentException { checkState(); final InputStream input = archive.as(ZipExporter.class).exportAsInputStream(); try { return deployInternal(archive.getName(), input); } finally { if (input != null) try { input.close(); } catch (IOException e) { log.warnf(e, "Failed to close resource %s", input); } } }
private String deployInternal(Archive<?> archive) throws DeploymentException { checkState(); final InputStream input = archive.as(ZipExporter.class).exportAsInputStream(); try { return deployInternal(archive.getName(), input); } finally { if (input != null) try { input.close(); } catch (IOException e) { log.warnf(e, "Failed to close resource %s", input); } } }
private String deployInternal(String name, InputStream input) throws DeploymentException { checkState(); final DeploymentResult result; try { result = deploymentManager.deploy(Deployment.of(input, name)); } catch (Exception ex) { throw createException("Cannot deploy: " + name, ex); } if (result.successful()) { return name; } throw new DeploymentException(String.format("Cannot deploy %s: %s", name, result.getFailureMessage())); }
private String deployInternal(String name, InputStream input) throws DeploymentException { checkState(); final DeploymentResult result; try { result = deploymentManager.deploy(Deployment.of(input, name)); } catch (Exception ex) { throw createException("Cannot deploy: " + name, ex); } if (result.successful()) { return name; } throw new DeploymentException(String.format("Cannot deploy %s: %s", name, result.getFailureMessage())); }
/** * Removes an archive from the running container. * <p> * All exceptions are caught and logged as a warning. {@link Error Errors} will still be thrown however. * </p> * * @param runtimeName the runtime name for the deployment * @param failOnMissing {@code true} if the undeploy should fail if the deployment was not found on the server, * {@code false} if the deployment does not exist and the undeploy should be ignored */ @SuppressWarnings("SameParameterValue") public void undeploy(final String runtimeName, final boolean failOnMissing) { checkState(); try { final DeploymentResult result = deploymentManager.undeploy(UndeployDescription.of(runtimeName).setFailOnMissing(failOnMissing)); if (!result.successful()) { log.warnf("Failed to undeploy %s: %s", runtimeName, result.getFailureMessage()); } } catch (Exception ex) { log.warnf(ex, "Cannot undeploy: %s", runtimeName); } }
/** * Removes an archive from the running container. * <p> * All exceptions are caught and logged as a warning. {@link Error Errors} will still be thrown however. * </p> * * @param runtimeName the runtime name for the deployment * @param failOnMissing {@code true} if the undeploy should fail if the deployment was not found on the server, * {@code false} if the deployment does not exist and the undeploy should be ignored */ @SuppressWarnings("SameParameterValue") public void undeploy(final String runtimeName, final boolean failOnMissing) { checkState(); try { final DeploymentResult result = deploymentManager.undeploy(UndeployDescription.of(runtimeName).setFailOnMissing(failOnMissing)); if (!result.successful()) { log.warnf("Failed to undeploy %s: %s", runtimeName, result.getFailureMessage()); } } catch (Exception ex) { log.warnf(ex, "Cannot undeploy: %s", runtimeName); } }