private void addAndSendApplicationBundles(DeployState deployState) { for (ComponentInfo component : deployState.getApplicationPackage().getComponentsInfo(deployState.getVespaVersion())) { FileReference reference = FileSender.sendFileToServices(component.getPathRelativeToAppDir(), containers); applicationBundles.add(reference); } }
@Override public void validate(VespaModel model, DeployState deployState) { ApplicationPackage app = deployState.getApplicationPackage(); for (ComponentInfo info : app.getComponentsInfo(deployState.getVespaVersion())) { try { this.jarFile = new JarFile(app.getFileReference(Path.fromString(info.getPathRelativeToAppDir()))); } catch (ZipException e) { throw new IllegalArgumentException("Error opening jar file '" + info.getPathRelativeToAppDir() + "'. Please check that this is a valid jar file"); } catch (IOException e) { e.printStackTrace(); } try { validateAll(deployState.getDeployLogger()); } catch (IOException e) { e.printStackTrace(); } } }
@Override protected ApplicationConfigProducerRoot doBuild(DeployState deployState, AbstractConfigProducer parent, Element producerSpec) { ApplicationConfigProducerRoot root = new ApplicationConfigProducerRoot(parent, name, deployState.getDocumentModel(), deployState.getVespaVersion(), deployState.getProperties().applicationId()); root.setHostSystem(new HostSystem(root, "hosts", deployState.getProvisioner(), deployState.getDeployLogger())); new Client(root); return root; } }
static Pair<VespaModel, Container> createContainerModel(Path applicationPath, FileRegistry fileRegistry, File preprocessedApplicationDir, Networking networkingOption, ConfigModelRepo configModelRepo) throws Exception { DeployLogger logger = new BaseDeployLogger(); FilesApplicationPackage rawApplicationPackage = new FilesApplicationPackage.Builder(applicationPath.toFile()) .includeSourceFiles(true).preprocessedDir(preprocessedApplicationDir).build(); ApplicationPackage applicationPackage = rawApplicationPackage.preprocess(getZone(), logger); validateApplication(applicationPackage); DeployState deployState = createDeployState(applicationPackage, fileRegistry, logger); VespaModel root = VespaModel.createIncomplete(deployState); ApplicationConfigProducerRoot vespaRoot = new ApplicationConfigProducerRoot(root, "vespa", deployState.getDocumentModel(), deployState.getVespaVersion(), deployState.getProperties().applicationId()); Element spec = containerRootElement(applicationPackage); ContainerModel containerModel = newContainerModelBuilder(networkingOption).build(deployState, root, configModelRepo, vespaRoot, spec); containerModel.getCluster().prepare(deployState); initializeContainerModel(containerModel, configModelRepo); Container container = first(containerModel.getCluster().getContainers()); // TODO: Separate out model finalization from the VespaModel constructor, // such that the above and below code to finalize the container can be // replaced by root.finalize(); initializeContainer(deployState.getDeployLogger(), container, spec); root.freezeModelTopology(); return new Pair<>(root, container); }