コード例 #1
0
ファイル: Container.java プロジェクト: cpnatwork/hydra_dev
 /**
  * Specialized Constructor, which creates a clone of the given container.
  *
  * @param clonedContainer Container.
  * @throws org.hydra.core.InvalidElementException the invalid element exception
  */
 public Container(final Container clonedContainer) throws InvalidElementException {
   this.fingerprint.setHash(clonedContainer.getFingerprint().getHash());
   this.repositoryFile = new File(this.config.getFPStore(), this.fingerprint.getHash());
   this.workspaceFile = new File(clonedContainer.cloneWorkspaceFile().getPath());
   for (final FingerprintedElement e : clonedContainer.listElements()) {
     if (e instanceof Artifact) {
       this.elements.add(e);
     } else {
       this.elements.add(new Container((Container) e));
     }
   }
 }
コード例 #2
0
ファイル: Container.java プロジェクト: cpnatwork/hydra_dev
 /**
  * Add a container and all if its contents found while searching recursively through the
  * directory.
  *
  * @param container Container.
  * @return success - boolean.
  */
 public boolean addContainerAndContents(final Container container) {
   boolean success = this.addElement(container);
   for (final File subFile : container.cloneWorkspaceFile().listFiles(new FilterInFiles())) {
     try {
       if (!this.addElement(new Artifact(subFile))) {
         success = false;
       }
     } catch (final Exception e) {
       success = false;
     }
   }
   for (final File subDirectory :
       container.cloneWorkspaceFile().listFiles(new FilterInDirectories())) {
     try {
       if (!this.addContainerAndContents(new Container(subDirectory))) {
         success = false;
       }
     } catch (final Exception e) {
       success = false;
     }
   }
   return success;
 }