public List<String> getPayloadPaths() { ArrayList<String> pathList = new ArrayList<>(); Collection<BagFile> payload = this.bilBag.getPayload(); if (payload != null) { for (Iterator<BagFile> it = payload.iterator(); it.hasNext();) { BagFile bf = it.next(); pathList.add(bf.getFilepath()); } } return pathList; }
/** * @return pathList */ public List<String> getPayloadPaths() { final ArrayList<String> pathList = new ArrayList<String>(); final Collection<BagFile> payload = this.bilBag.getPayload(); if (payload != null) { for (final BagFile bf : payload) { pathList.add(bf.getFilepath()); } } return pathList; }
public String getDataContent() { totalSize = 0; StringBuffer dcontent = new StringBuffer(); dcontent.append(this.getDataDirectory() + "/"); dcontent.append('\n'); Collection<BagFile> files = this.bilBag.getPayload(); if (files != null) { for (Iterator<BagFile> it = files.iterator(); it.hasNext();) { try { BagFile bf = it.next(); if (bf != null) { totalSize += bf.getSize(); dcontent.append(bf.getFilepath()); dcontent.append('\n'); } } catch (Exception e) { log.error("Failed to get data content", e); } } } this.setSize(totalSize); return dcontent.toString(); }
/** * @return dataContent */ public String getDataContent() { totalSize = 0; final StringBuilder dcontent = new StringBuilder(); dcontent.append(this.getDataDirectory()).append("/"); dcontent.append('\n'); final Collection<BagFile> files = this.bilBag.getPayload(); if (files != null) { for (final BagFile file : files) { try { if (file != null) { totalSize += file.getSize(); dcontent.append(file.getFilepath()); dcontent.append('\n'); } } catch (final Exception e) { log.error("Failed to get data content", e); } } } this.setSize(totalSize); return dcontent.toString(); }
public void updateManifestPane() { bagTagFileTree = new BagTree(this, bag.getName()); Collection<BagFile> tags = bag.getTags(); for (Iterator<BagFile> it = tags.iterator(); it.hasNext();) { BagFile bf = it.next(); bagTagFileTree.addNode(bf.getFilepath()); } bagTagFileTreePanel.refresh(bagTagFileTree); }
public void addTagFile() { File selectFile = new File(File.separator + "."); JFrame frame = new JFrame(); JFileChooser fo = new JFileChooser(selectFile); fo.setDialogType(JFileChooser.OPEN_DIALOG); fo.setFileSelectionMode(JFileChooser.FILES_ONLY); if (bagView.getBagRootPath() != null){ fo.setCurrentDirectory(bagView.getBagRootPath().getParentFile()); } fo.setDialogTitle("Tag File Chooser"); int option = fo.showOpenDialog(frame); if (option == JFileChooser.APPROVE_OPTION) { DefaultBag bag = bagView.getBag(); File file = fo.getSelectedFile(); bag.addTagFile(file); bagView.bagTagFileTree = new BagTree(bagView, bag.getName()); Collection<BagFile> tags = bag.getTags(); for (Iterator<BagFile> it = tags.iterator(); it.hasNext();) { BagFile bf = it.next(); bagView.bagTagFileTree.addNode(bf.getFilepath()); } bagView.bagTagFileTreePanel.refresh(bagView.bagTagFileTree); ApplicationContextUtil.addConsoleMessage("Tag file added: " + file.getAbsolutePath()); } }
BagFile bf = it.next(); String content = ""; if (bf.getFilepath().contains("manifest")){ content = bf.toString(); content = tokenFormat(bf.toString()); log.debug("BagFile: {}::{}", bf.getFilepath(), content); BagTextPane manifestPane = new BagTextPane(content); manifestPaneList.add(manifestPane); manifestScrollPane.setForeground(selectedColor); manifestScrollPaneList.add(manifestScrollPane); String tabName = bf.getFilepath(); log.debug("manifestName: {}", tabName); addTab(tabName, manifestScrollPane);
public void addTagFiles(List<File> files) { DefaultBag bag = bagView.getBag(); if (bagView.bagTagFileTree.isEnabled()) { if (files != null) { for (int i = 0; i < files.size(); i++) { bag.addTagFile(files.get(i)); } bagView.bagTagFileTree = new BagTree(bagView, bag.getName()); Collection<BagFile> tags = bag.getTags(); for (Iterator<BagFile> it = tags.iterator(); it.hasNext();) { BagFile bf = it.next(); bagView.bagTagFileTree.addNode(bf.getFilepath()); } bagView.bagTagFileTreePanel.refresh(bagView.bagTagFileTree); } ApplicationContextUtil.addConsoleMessage("Tag files changed."); } } }
public void createNewBag(String profileName) { log.info("Creating a new bag with version: {}, profile: {}", BagFactory.LATEST.versionString, profileName); bagView.clearBagHandler.clearExistingBag(); DefaultBag bag = bagView.getBag(); bagView.infoInputPane.bagInfoInputPane.enableForms(true); String bagName = bagView.getPropertyMessage("bag.label.noname"); bag.setName(bagName); bagView.infoInputPane.setBagName(bagName); bagView.bagTagFileTree = new BagTree(bagView, bag.getName()); Collection<BagFile> tags = bag.getTags(); for (Iterator<BagFile> it = tags.iterator(); it.hasNext();) { BagFile bf = it.next(); bagView.bagTagFileTree.addNode(bf.getFilepath()); } bagView.bagTagFileTreePanel.refresh(bagView.bagTagFileTree); bagView.updateBaggerRules(); bag.setRootDir(bagView.getBagRootPath()); bagView.infoInputPane.bagInfoInputPane.populateForms(bag); ApplicationContextUtil.addConsoleMessage("A new bag has been created in memory."); bagView.updateNewBag(); // set bagItVersion bagView.infoInputPane.bagVersionValue.setText(BagFactory.LATEST.versionString); // change profile changeProfile(profileName); }