public static List<Component> getComponents(File appDir) { List<Component> components = new ArrayList<>(); for (Bundle bundle : Bundle.getBundles(new File(appDir, ApplicationPackage.COMPONENT_DIR))) { components.add(new Component(bundle, new ComponentInfo(new File(ApplicationPackage.COMPONENT_DIR, bundle.getFile().getName()).getPath()))); } return components; }
@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(); } } }
private void addAndSendApplicationBundles(DeployState deployState) { for (ComponentInfo component : deployState.getApplicationPackage().getComponentsInfo(deployState.getVespaVersion())) { FileReference reference = FileSender.sendFileToServices(component.getPathRelativeToAppDir(), containers); applicationBundles.add(reference); } }
private static List<ComponentInfo> getComponentsInfo(File appDir) { List<ComponentInfo> components = new ArrayList<>(); for (Bundle bundle : Bundle.getBundles(new File(appDir, ApplicationPackage.COMPONENT_DIR))) { components.add(new ComponentInfo(new File(ApplicationPackage.COMPONENT_DIR, bundle.getFile().getName()).getPath())); } return components; }