/** * Launches the platform for a new platform instance * * @param instance The instance being provisioned * @return The protocol reply */ private XSPReply provisionLaunchPlatform(RemoteCollaborationManaged instance) { File instanceDirectory = new File(storageInstances, instance.getIdentifier()); File adminScript = new File(instanceDirectory, "admin.sh"); ProcessBuilder processBuilder = new ProcessBuilder("sh", adminScript.getAbsolutePath(), "start"); processBuilder.directory(instanceDirectory); try { Process process = processBuilder.start(); process.waitFor(); } catch (IOException | InterruptedException exception) { Logging.get().error(exception); return new XSPReplyException(exception); } return XSPReplySuccess.instance(); } }
/** * Write the current configuration to the storage * * @return The protocol reply */ private XSPReply writeBack() { try (Writer writer = IOUtils.getWriter(storage)) { writer.write(serializedJSON()); writer.flush(); } catch (IOException exception) { Logging.get().error(exception); return new XSPReplyException(exception); } return XSPReplySuccess.instance(); }
/** * Serializes the manifest for this collaboration * * @return The protocol reply */ private XSPReply serializeManifest() { try (Writer writer = IOUtils.getWriter(fileManifest)) { writer.write(manifest.serializedJSON()); writer.flush(); return XSPReplySuccess.instance(); } catch (IOException exception) { Logging.get().error(exception); return new XSPReplyException(exception); } }
/** * Writes the platform instance descriptor * * @param instance The platform instance * @return The protocol reply */ private XSPReply provisionWriteDescriptor(RemoteCollaborationManaged instance) { File fileDescriptor = new File(storageInstances, instance.getIdentifier() + ".json"); try (Writer writer = IOUtils.getWriter(fileDescriptor)) { writer.write(instance.getDescriptor().serializedJSON()); writer.flush(); } catch (IOException exception) { Logging.get().error(exception); return new XSPReplyException(exception); } return XSPReplySuccess.instance(); }
} catch (InvalidKeyException exception) { Logging.get().error(exception); return new XSPReplyException(exception);
} catch (IOException exception) { Logging.get().error(exception); return new XSPReplyException(exception); } catch (IOException exception) { Logging.get().error(exception); return new XSPReplyException(exception);
Logging.get().error(exception); IOUtils.deleteFolder(directory); return new XSPReplyException(exception);
} catch (IOException exception) { Logging.get().error(exception); return new XSPReplyException(exception); } catch (IOException exception) { Logging.get().error(exception); return new XSPReplyException(exception); } catch (IOException exception) { Logging.get().error(exception); return new XSPReplyException(exception); } catch (IOException exception) { Logging.get().error(exception); return new XSPReplyException(exception);
} catch (IOException exception) { Logging.get().error(exception); return new XSPReplyException(exception);
} catch (Throwable exception) { Logging.get().error(exception); doResponse(servletResponse, XSPReplyUtils.toHttpResponse(new XSPReplyException(exception), null)); } finally { securityService.logout();
} catch (IOException exception) { Logging.get().error(exception); return new XSPReplyException(exception);