/** * Deploys the specified ZIP file to this container. * * @param zipDeployment * The ZIP file. * @param permissions * The permissions to be granted for classes of this classpath. * @throws LimbusException * Thrown on any error while unpacking or deploying this ZIP file. */ @Override public void deployZipFile(File zipDeployment, Set<Permission> permissions) throws LimbusException { checkState(); String deployName = toDeployName(zipDeployment.getName()); if (hasPlugin(deployName)) { throw new LimbusException(String.format("The plugin '%s' is already deployed.", deployName)); } try { File deployDirectory = getCreateOrFailPluginDirectory(deployName); Zip.unpack(zipDeployment, deployDirectory); } catch (Exception e) { throw new LimbusException(String.format("Cannot unpack ZIP plugin bundle %s", zipDeployment.getAbsolutePath()), e); } // Trigger deploy deployFromFilesystem(deployName, permissions); }
String deployName = toDeployName(groupId, artifactId, extension, version); try { File pluginDirectory = getCreateOrFailPluginDirectory(deployName);
/** * Starts the deploy process for an artifact already present in the containers work directory. * * @param deployName * The deploy name * @param permissions * The permissions to be granted for classes of this classpath. * @throws LimbusException * Thrown on any error while deploying. */ @Override public void deployFromFilesystem(String deployName, Set<Permission> permissions) throws LimbusException { checkState(); try { File pluginDirectory = getCreateOrFailPluginDirectory(deployName); // Create the classpath of the deployed files Classpath classpath = Classpath.create(deployName) .addAllFilesInDirectory(pluginDirectory); container.deployPlugin(classpath, permissions); } catch (Exception e) { // Clean deployed files from work removePlugin(deployName); // Forward deploy exception throw new LimbusException(String.format("Cannot deploy the specified classpath with deploy name %s", deployName), e); } }