private void deploy() throws LimbusException, IOException { LimbusEngine limbusEngine = system.getComponent(LimbusEngine.class); List<URL> urls = new LinkedList<>(); List<JavaArchive> archives = new LinkedList<>(dependencies); for (JavaArchive a : archives) { addJavaArchiveAsURL(urls, a, null); } addJavaArchiveAsURL(urls, deployment, null); this.classpath = Classpath.create(deployName) .add(urls); limbusEngine.deployPlugin(classpath, permissions); }
@Override protected void performInitialize() throws LimbusException { try { // Create the properties this.properties = new LimbusProperties(filesystem, getClass(), true, false); // Register as a deployment listener container.addDeploymentListener(this); // When created by the container, clean old deployments cleanWorkDirectory(); // Make sure work folder is available getCreateOrFailWorkDirectory(); // Make sure deploy folder is available getCreateOrFailDeployDirectory(); // Start hot deploy listener startFileDeployWatchService(); // Deploy all artifacts from deploy directory. deployAll(); } catch (Exception e) { throw new LimbusException("Cannot initialize Limbus Deploy Service.", e); } }
for (String deployName : deployedComponents) { try { container.undeployPlugin(findPlugin(deployName)); } catch (LimbusException e) { log.error(String.format("Cannot undeploy the deployment with name \'%s\'.", deployName), e); container.removeDeploymentListener(this);
.showDialog(gui); if (selectedButton == MessageDialogButton.Yes) { Classpath classpath = engine.getClasspath(undeployName); engine.undeployPlugin(classpath);
.showDialog(gui); } else { if (engine.hasClasspath(deployName)) { new MessageDialogBuilder().setTitle("Error while deploying") .setText("A deployment with the same name already exists. Please choose another name.")
private void undeployFromFilesystem(String deployName) throws LimbusException { checkState(); if (hasPlugin(deployName)) { Classpath classpath = findPlugin(deployName); try { container.undeployPlugin(classpath); } finally { removePlugin(deployName); } } }
@Override public Container getComponent(final LimbusMaintenanceConsole console) { Panel panel = new Panel(new BorderLayout()); Label headLine = new Label("The following list shows the loaded URLs loaded in the shared classpath."); panel.addComponent(headLine, BorderLayout.Location.TOP); TextBox sharedClasspath = new TextBox("", Style.MULTI_LINE); sharedClasspath.setReadOnly(true); Classpath classpath = container.getSharedClasspath(); for (URL url : classpath.getClasspath()) { sharedClasspath.addLine("- " + url.toString()); } panel.addComponent(sharedClasspath, BorderLayout.Location.CENTER); return panel; }
@Override public Container getComponent(final LimbusMaintenanceConsole console) { Panel panel = new Panel(new BorderLayout()); Label headLine = new Label( "The following list shows the deployed classpaths available in this container. Select a classpath entry to show the list of loaded URLs."); final TextBox loadedURLs = new TextBox("", Style.MULTI_LINE); loadedURLs.setReadOnly(true); ActionListBox selectClasspath = new ActionListBox(); Set<Classpath> pluginClasspaths = container.getPluginClasspaths(); int count = 1; for (Classpath pluginClasspath : pluginClasspaths) { final Classpath classpath = pluginClasspath; selectClasspath.addItem("Classpath " + count, new Runnable() { @Override public void run() { loadedURLs.setText(""); for (URL url : classpath.getClasspath()) { loadedURLs.addLine("- " + url.toString()); } } }); count++; } panel.addComponent(headLine, BorderLayout.Location.TOP); panel.addComponent(selectClasspath.withBorder(Borders.singleLine("Deployed classpaths")), BorderLayout.Location.LEFT); panel.addComponent(loadedURLs.withBorder(Borders.singleLine("Classpath URL entries")), BorderLayout.Location.CENTER); return panel; }
.showDialog(gui); } else { if (engine.hasClasspath(deployName)) { new MessageDialogBuilder().setTitle("Error while deploying") .setText("A deployment with the same name already exists. Please choose another name.")
/** * 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); } }