Examples of FileInfo


Examples of org.codehaus.plexus.components.io.fileselectors.FileInfo

                for (String path : paths) {
                    String relName = path.substring(this.directory.length());
                    if (isDirectory(path)) {
                        scanDirectory(path, visitor);
                    } else {
                        FileInfo fileInfo = new SimpleFileInfo(relName);
                        try {
                            if (selector.isSelected(fileInfo)) {
                                URLConnection cn = servletContext.getResource(path).openConnection();
                                long lastModified = cn.getLastModified();
                                visitor.visit(path, lastModified);
View Full Code Here

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

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

      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

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

      } 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

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

      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

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

      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

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

  @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

Examples of org.eclipse.core.filesystem.provider.FileInfo

  @Override
  public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException {
    if (serverFileInfo == null) {
      serverResourceInfo = null;
      this.effectivePermissions = null;
      FileInfo fi = new FileInfo(getName());
      HDFSServer server = getServer();
      if (server != null) {
        try {
          if (".project".equals(getName())) {
            fi.setExists(getLocalFile().exists());
            fi.setLength(getLocalFile().length());
          } else {
            ResourceInformation fileInformation = getClient().getResourceInformation(uri.getURI(), server.getUserId());
            if (fileInformation != null) {
              serverResourceInfo = fileInformation;
              fi.setDirectory(fileInformation.isFolder());
              fi.setExists(true);
              fi.setLastModified(fileInformation.getLastModifiedTime());
              fi.setLength(fileInformation.getSize());
              fi.setName(fileInformation.getName());
              String userId = server.getUserId();
              List<String> groupIds = server.getGroupIds();
              if (userId == null) {
                userId = getDefaultUserId();
                groupIds = getDefaultGroupIds();
              }
              fileInformation.updateEffectivePermissions(userId, groupIds);
              this.effectivePermissions = fileInformation.getEffectivePermissions();
              fi.setAttribute(EFS.ATTRIBUTE_OWNER_READ, fileInformation.getUserPermissions().read);
              fi.setAttribute(EFS.ATTRIBUTE_OWNER_WRITE, fileInformation.getUserPermissions().write);
              fi.setAttribute(EFS.ATTRIBUTE_OWNER_EXECUTE, fileInformation.getUserPermissions().execute);
              fi.setAttribute(EFS.ATTRIBUTE_GROUP_READ, fileInformation.getGroupPermissions().read);
              fi.setAttribute(EFS.ATTRIBUTE_GROUP_WRITE, fileInformation.getGroupPermissions().write);
              fi.setAttribute(EFS.ATTRIBUTE_GROUP_EXECUTE, fileInformation.getGroupPermissions().execute);
              fi.setAttribute(EFS.ATTRIBUTE_OTHER_READ, fileInformation.getOtherPermissions().read);
              fi.setAttribute(EFS.ATTRIBUTE_OTHER_WRITE, fileInformation.getOtherPermissions().write);
              fi.setAttribute(EFS.ATTRIBUTE_OTHER_EXECUTE, fileInformation.getOtherPermissions().execute);
            }
          }
        } catch (IOException e) {
          throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, e.getMessage(), e));
        } catch (InterruptedException e) {
          throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, e.getMessage(), e));
        } finally {
        }
      } else {
        // No server definition
        fi.setExists(false);
      }
      serverFileInfo = fi;
    }
    if (localFileInfo == null) {
      if (isLocalFile()) {
        File file = getLocalFile();
        localFileInfo = new FileInfo(file.getName());
        if (file.exists()) {
          localFileInfo.setExists(true);
          localFileInfo.setLastModified(file.lastModified());
          localFileInfo.setLength(file.length());
          localFileInfo.setDirectory(file.isDirectory());
View Full Code Here

Examples of org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot.FileInfo

                    fileInfos.put(fileInfo.metadata().name(), fileInfo);
                }
                final Store.MetadataSnapshot sourceMetaData = new Store.MetadataSnapshot(snapshotMetaData);
                final Store.RecoveryDiff diff = sourceMetaData.recoveryDiff(recoveryTargetMetadata);
                for (StoreFileMetaData md : diff.identical) {
                    FileInfo fileInfo = fileInfos.get(md.name());
                    numberOfFiles++;
                    totalSize += md.length();
                    numberOfReusedFiles++;
                    reusedTotalSize += md.length();
                    recoveryState.getIndex().addReusedFileDetail(fileInfo.name(), fileInfo.length());
                    if (logger.isTraceEnabled()) {
                        logger.trace("[{}] [{}] not_recovering [{}] from [{}], exists in local store and is same", shardId, snapshotId, fileInfo.physicalName(), fileInfo.name());
                    }
                }

                for (StoreFileMetaData md : Iterables.concat(diff.different, diff.missing)) {
                    FileInfo fileInfo = fileInfos.get(md.name());
                    numberOfFiles++;
                    totalSize += fileInfo.length();
                    filesToRecover.add(fileInfo);
                    recoveryState.getIndex().addFileDetail(fileInfo.name(), fileInfo.length());
                    if (logger.isTraceEnabled()) {
                        if (md == null) {
                            logger.trace("[{}] [{}] recovering [{}] from [{}], does not exists in local store", shardId, snapshotId, fileInfo.physicalName(), fileInfo.name());
                        } else {
                            logger.trace("[{}] [{}] recovering [{}] from [{}], exists in local store but is different", shardId, snapshotId, fileInfo.physicalName(), fileInfo.name());
                        }
                    }
                }
                final RecoveryState.Index index = recoveryState.getIndex();
                index.totalFileCount(numberOfFiles);
View Full Code Here

Examples of org.globus.ftp.FileInfo

        /** Mocking server responses to prevent server failure **/

        Mockito.doReturn("testdata").when(ftpProtocol).getCurentDir();

        Vector<FileInfo> vector = new Vector<FileInfo>();
        FileInfo file = new FileInfo();
        file.setName("users.properties");
        byte b = 1;
        file.setFileType(b);
        vector.add(file);

        Mockito.doAnswer(new Answer() {
            public Object answer(InvocationOnMock invocation) {
                return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.