Package org.jboss.fresh.vfs

Examples of org.jboss.fresh.vfs.FileName


  public FileReadInfo read(UserCtx uctx, FileOpInfo info) throws VFSException {
    MountData dat = findFS(info.filename);
    if(dat == null)
      return null;

    FileName untranName = info.filename;
    info.filename = translate(dat, info.filename);

    FileReadInfo inf = dat.vfs.read(uctx, info);
    info.filename = untranName;
    return inf;
View Full Code Here


    MountData dat = findFS(filename);
    if(dat == null)
      return filename;

    FileName name = dat.vfs.resolve(ctx, translate(dat, filename), partial);
   
    return untranslate(dat, name);
  }
View Full Code Here

  protected FileName resolve(FileName filename, boolean partial) throws Exception {
    //log.debug( "[XXXXXXXXXXXXXXXXXX] resolve : " + filename + ", PARTIAL = " + partial );
    // log.trace("/vfs/cache", "filename: " + filename + ", PARTIAL = " + partial);

    FileName result = null;

    if (filename.toString().equals("/"))
      return filename;

    FileName parent = filename.getPath();
    String name = filename.getName();
    List[] fromCache;

    if (partial) {
      fromCache = cache.resolve(parent, true);
View Full Code Here

  public boolean exists(UserCtx ctx, FileName name, boolean direct) throws VFSException {

    boolean result;
//log.debug( "ZZZZZZZZZZZZZZZZZZZZZ exists( " + name + ", " + direct + " );" );
    try {
      FileName file = resolve(name, direct);
      boolean[] fromCache = cache.exists(name);

      if (fromCache != null)
        result = fromCache[0];
      else
View Full Code Here

  public MemVFSMeta(String sfJndiName, String fsname) throws Exception {
    this.sfJndiName = sfJndiName;
    fsroot = new RegistryContext(fsname);

    FileInfo inf = new FileInfo(new FileName("/"));
    inf.setCreateDate(new Date());
    inf.setFileType(FileInfo.TYPE_DIR);
    inf.setLastModified(inf.getCreateDate());
    inf.setLength(0);
View Full Code Here

    inf.setLastModified(node.getLastModified());
    inf.setLength(node.getLength());
    inf.setMime(node.getMime());
    inf.setTag(node.getTag());
    if(node.getLink() != null) {
      inf.setTarget(new FileName(node.getLink()));
    }
    return inf;
  }
View Full Code Here

    // if found broken link return whatever you have in list
    // first item in a list is always passed path param
    LinkedList ls = new LinkedList();
   
    if(path == null) {
      ls.add(new FileName("/"));
      return ls;
    }

    //ls.add(path);

    Object node = null;
    String name = path.toString();

    for(int i=0; i<256; i++) {
      try {
        node = fsroot.lookup(name);
      } catch(NameNotFoundException ex) {
        node = null;
      }

      if(node instanceof FNode) {
        ls.add(new FileName(name));
        FNode fnode = (FNode) node;
        if(fnode.getType() == FNode.LINK) {
          name = fnode.getLinkRef();
        } else {
          return ls;
        }
      } else {
        ls.add(new FileName(name));
        return ls;
      }
    }

    throw new VFSException("Link resolution infinitely looped: " + name);
View Full Code Here

  private static Logger log = Logger.getLogger(DiskVFSStore.class);

  public DiskVFSStore(VFSMeta meta, String rootpath) throws Exception {
    this.meta = meta;
    fsroot = new File(rootpath);
    root = new FileName("/");
  }
View Full Code Here

 
  /** FileName must not be null, it can point to inexisting file.
   */
  public boolean hasContent(FileName filename) throws Exception {

    FileName adjusted = root.absolutize(filename);
    File thefile = new File(fsroot, adjusted.toString());

    return thefile.length() != 0;
  }
View Full Code Here

  /** Writes a chunk of content data.
   *  FileOpInfo must be filled filename (file doesn't need to exist), filepos, and len.
   */
  public void writeContent(FileOpInfo info) throws Exception {
    FileName adjusted = root.absolutize(info.filename);
    File thefile = new File(fsroot, adjusted.toString());

    RandomAccessFile raf = new RandomAccessFile(thefile, "rw");
    try {
      if(!info.append)
        raf.setLength(0);
View Full Code Here

TOP

Related Classes of org.jboss.fresh.vfs.FileName

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.