Package org.dru.clay.respository.transport

Examples of org.dru.clay.respository.transport.FileInfo


      final String lastModified = headers.getLastModified();
      final Long size = headers.getContentLength() == null ? 0 : headers.getContentLength();
      final Date date = lastModified == null ? new Date(0) : dateFormat.get().parse(lastModified);


      return new FileInfo(size, date.getTime(), bos.toByteArray());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here


      throw new IllegalArgumentException("Invalid scheme for " + this.getClass().getName());
    }

    try {
      final List<URI> links = new ArrayList<URI>();
      final FileInfo fileInfo = get(directory);
      final String content = new String(fileInfo.getContent(), "UTF-8");

      int index = 0;
      final Matcher matcher = HREF_PATTERN.matcher(content);
      while (matcher.find(index)) {
        index = matcher.end();
View Full Code Here

      } catch (Exception e) {
        logger.fine("Cache miss for " + cachedUri + " : " + e.getMessage());
      }
    }

    final FileInfo fileInfo = transport.get(uri);
    final byte[] content = fileInfo.getContent();
    FileOutputStream outputStream = null;
    final File file = new File(cachedUri.getPath());
    try {
      file.getParentFile().mkdirs();
      outputStream = new FileOutputStream(file);
      outputStream.write(content, 0, content.length);
    } catch (Exception e) {
      logger.warning("Couldn't update file cache for " + cachedUri);
    } finally {
      IOUtils.silentClose(outputStream);
    }
   
    file.setLastModified(fileInfo.getLastModified());
    reader.touch(cachedUri, fileInfo.getLastModified());

    return fileInfo;
  }
View Full Code Here

      throw new IllegalArgumentException("Invalid scheme for " + this.getClass().getName());
    }

    try {
      final File file = new File(uri.getPath());
      return new FileInfo(file.length(), file.lastModified(), IOUtils.read(new FileInputStream(file)));
    } catch (FileNotFoundException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

      ssh.newSCPFileTransfer().download(file.getPath(), destination);
     
      final byte[] content = outputStream.toByteArray();
      final long length = content.length;
      final long lastModified = System.currentTimeMillis(); // TODO: not good
      return new FileInfo(length, lastModified, content);
    } catch (Exception e) {
      throw new RuntimeException(e);
    } finally {
      close(session);
    }
View Full Code Here

  @Override
  public ResolveResult resolve(Transport transport, Module module) {
    try {
      final URI ivyUri = calculateIvyURI(module);
      final FileInfo fileInfo = transport.get(ivyUri);
      final IvyXml ivyXml = new IvyXmlParser().parse(module, fileInfo.getContent());
      return ivyXml;
    } catch (URISyntaxException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.dru.clay.respository.transport.FileInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.