Package maqetta.server.orion

Source Code of maqetta.server.orion.VOrionWorkspace

package maqetta.server.orion;

import java.io.IOException;

import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.maqetta.server.IStorage;
import org.maqetta.server.IVResource;
import org.maqetta.server.VWorkspaceRoot;


public class VOrionWorkspace extends VWorkspaceRoot{

  private VOrionWorkspaceStorage store;
 
    public VOrionWorkspace(VOrionWorkspaceStorage storage) {
      this.store=storage;
  }

  public IVResource create(String path) throws IOException {
    IPath ps = new Path(path);
    IVResource parent = this;
   
    for(int i=0;i<ps.segmentCount();i++){
      String segment = ps.segment(i);
      IVResource f= parent.get(segment);
      if(f==null ){
        IStorage file = this.store.create(path);
        f = new VOrionResource(file, parent, segment);
       
       
      }else if(f.isVirtual()){
       
        IStorage file = this.store.create(path);
        if(f.isDirectory())
          file.mkdirs();
        f = new VOrionResource(file, parent, segment);
        parent.add(f);
       
      }
      parent = f;
    }
   
   
    return parent;
  }

}
TOP

Related Classes of maqetta.server.orion.VOrionWorkspace

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.