Class SandboxedStorage

  • All Implemented Interfaces:
    ej.storage.Storage

    public class SandboxedStorage
    extends java.lang.Object
    implements ej.storage.Storage
    Extends the storage on file system to add sandboxing for the applications.
    • Constructor Summary

      Constructors 
      Constructor Description
      SandboxedStorage()
      Creates a sandboxed storage on file system.
      SandboxedStorage​(java.lang.String root)
      Creates a storage on file system specifying the root folder where the root folder will be created.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.OutputStream append​(java.lang.String s)  
      boolean exists​(java.lang.String s)  
      java.lang.String[] getIds()  
      java.lang.String getRootFolder​(ej.kf.Module module)
      Gets the root folder of the storage service for a given module.
      long getSize​(java.lang.String s)  
      java.io.InputStream load​(java.lang.String s)  
      java.io.OutputStream modify​(java.lang.String s, int i)  
      void move​(java.lang.String s, java.lang.String s1)  
      void remove​(java.lang.String s)  
      java.io.OutputStream store​(java.lang.String s)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SandboxedStorage

        public SandboxedStorage()
                         throws java.io.IOException
        Creates a sandboxed storage on file system.

        The root folder is determined dynamically depending on the KF context. Each module has a different one.

        Throws:
        java.io.IOException - if the root cannot be created.
        See Also:
        Kernel.getContextOwner(), StorageFs()
      • SandboxedStorage

        public SandboxedStorage​(java.lang.String root)
                         throws java.io.IOException
        Creates a storage on file system specifying the root folder where the root folder will be created.

        The root folder is determined dynamically depending on the KF context. Each module has a different one.

        Parameters:
        root - the root folder.
        Throws:
        java.lang.IllegalArgumentException - if the root already exists and is not a directory.
        java.io.IOException - if the root cannot be created.
    • Method Detail

      • getRootFolder

        public java.lang.String getRootFolder​(ej.kf.Module module)
        Gets the root folder of the storage service for a given module.
        Parameters:
        module - the module.
        Returns:
        the root folder.
      • store

        public java.io.OutputStream store​(java.lang.String s)
                                   throws java.io.IOException
        Specified by:
        store in interface ej.storage.Storage
        Throws:
        java.io.IOException
      • modify

        public java.io.OutputStream modify​(java.lang.String s,
                                           int i)
                                    throws java.io.IOException
        Specified by:
        modify in interface ej.storage.Storage
        Throws:
        java.io.IOException
      • append

        public java.io.OutputStream append​(java.lang.String s)
                                    throws java.io.IOException
        Specified by:
        append in interface ej.storage.Storage
        Throws:
        java.io.IOException
      • load

        public java.io.InputStream load​(java.lang.String s)
                                 throws java.io.IOException
        Specified by:
        load in interface ej.storage.Storage
        Throws:
        java.io.IOException
      • move

        public void move​(java.lang.String s,
                         java.lang.String s1)
                  throws java.io.IOException
        Specified by:
        move in interface ej.storage.Storage
        Throws:
        java.io.IOException
      • remove

        public void remove​(java.lang.String s)
                    throws java.io.IOException
        Specified by:
        remove in interface ej.storage.Storage
        Throws:
        java.io.IOException
      • getSize

        public long getSize​(java.lang.String s)
                     throws java.io.IOException
        Specified by:
        getSize in interface ej.storage.Storage
        Throws:
        java.io.IOException
      • exists

        public boolean exists​(java.lang.String s)
                       throws java.io.IOException
        Specified by:
        exists in interface ej.storage.Storage
        Throws:
        java.io.IOException
      • getIds

        public java.lang.String[] getIds()
                                  throws java.io.IOException
        Specified by:
        getIds in interface ej.storage.Storage
        Throws:
        java.io.IOException