Package org.jcoredb.fs

Examples of org.jcoredb.fs.IContainer


   
    JSONArray childs = new JSONArray("containers");
   
    for (int i = 0; i < cs.length; i++)
    {
       IContainer c = cs[i];
      
       JSONNode child = new JSONNode();
       JSONAttribute id = new JSONAttribute("id", ""+c.getId(), AttrType.Number);
       child.add(id);
      
       childs.add(child);
    }
   
View Full Code Here


  @Override
  public void write(Block block) throws BlockWriteErr, SegmentGetErr
  {
    BlockId id = block.getId();
   
    IContainer c = containers.get(id.getContainerId());
    DataSegment seg = (DataSegment) c.getSegment(id.getSegmentId());
   
    seg.writeBlock(block);
  }
View Full Code Here

   * @see org.jcoredb.fs.IFileSystem#read(org.jcoredb.fs.BlockId)
   */
  @Override
  public Block read(BlockId id) throws BlockReadErr, SegmentGetErr
  {
    IContainer c = containers.get(id.getContainerId());
    DataSegment seg = (DataSegment) c.getSegment(id.getSegmentId());

    Block b =  seg.readBlock(id.getId());
   
    if (b!=null) b.setId(id);
   
View Full Code Here

  @Override
  public BlockId append(Block block, boolean only) throws BlockAppendErr
  {
    BlockId blockId = block.getId();
   
    IContainer c = containers.get(block.getId().getContainerId());
   
    blockId = c.append(block, only);
   
    return blockId;
  }
View Full Code Here

   * @see org.jcoredb.fs.IFileSystem#delete(org.jcoredb.fs.BlockId, boolean)
   */
  @Override
  public void delete(BlockId id, boolean soft) throws BlockDeleteErr
  {
    IContainer c = containers.get(id.getContainerId());
   
    c.delete(id, soft);
  }
View Full Code Here

   * @see org.jcoredb.fs.IFileSystem#drop(int)
   */
  @Override
  public void drop(int containerId) throws ContainerDropErr
  {
    IContainer c = containers.get(containerId);
    c.drop();
    this.containers.remove(c);
  }
View Full Code Here

   
    try
    {
      BlockId id = block.getId();
   
      IContainer c = fs.getContainer(id.getContainerId());
      DataSegment seg = (DataSegment) c.getSegment(id.getSegmentId());
     
      seg.writeBlock(block);
    }
    catch (Exception e)
    {
View Full Code Here

   */
  @Override
  public void create() {
   
    IFileSystem fs = FileSystemRegistry.get(new FileSystemRegKey(Constants.HOST, Configs.getFSConfig().getRootDir()));
    IContainer c = fs.getContainer(id);
   
    if (c!=null)
    {
   
      JSONNode root = JSONHelper.createSuccessNode();
      JSONAttribute id = new JSONAttribute("id", ""+c.getId(), AttrType.Number);
      JSONAttribute parentpath = new JSONAttribute("parentpath", c.getParentPath(), AttrType.String);
      JSONAttribute numberofsegs = new JSONAttribute("numberofsegs", ""+c.getNumOfSegs(), AttrType.Number);
     
      root.add(id);
      root.add(parentpath);
      root.add(numberofsegs);
     
      JSONArray segments = new JSONArray("segments");
     
      for (int i = 0; i < c.getSegments().length; i++)
      {
         ISegment s = c.getSegments()[i];

         JSONNode segementNode = new JSONNode();
         JSONAttribute segId = new JSONAttribute("id", ""+s.getId(), AttrType.Number);
         segementNode.add(segId);
        
View Full Code Here

TOP

Related Classes of org.jcoredb.fs.IContainer

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.