Ejemplo n.º 1
0
 private void createOrUpdateFile(FileRecord file)
     throws DigitalLibraryException, IOException, NotFoundException, AccessDeniedException {
   HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().begin();
   try {
     InputStream f = file.open();
     ResourceMetadata r1 = dl.createOrUpdateFile(RO_URI, file.path, f, file.mimeType);
     f.close();
     assertNotNull(r1);
   } finally {
     HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();
   }
 }
Ejemplo n.º 2
0
 private void checkCantCreateOrUpdateFile(FileRecord file)
     throws DigitalLibraryException, IOException, NotFoundException {
   HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().begin();
   InputStream f = file.open();
   try {
     dl.createOrUpdateFile(RO_URI, file.path, f, file.mimeType);
     fail("Should throw an exception when creating file");
   } catch (Exception e) {
     // good
   } finally {
     f.close();
     HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();
   }
 }
Ejemplo n.º 3
0
 /**
  * Initialize this instance.
  *
  * @param record the file record.
  */
 public NTFSDirectory(NTFSFileSystem fs, FileRecord record) throws IOException {
   this.fs = fs;
   this.index = new NTFSIndex(record);
   id = Long.toString(record.getReferenceNumber());
 }