Documentation of 'hep.aida.ref.tree.Tree' Java class
Tree
hep.aida.ref.tree

Class Tree

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void add(java.lang.String path, IManagedObject child)
      This "add" method is called from the IStore, and can create new folders if it is needed.
      void addFromFactory(java.lang.String path, IManagedObject child)
      This "add" method is called from Factories (HistogramFactory, ...), and can create new folders if it is needed.
      void cd(java.lang.String path)
      Change to a given directory.
      void checkForChildren(java.lang.String path)
      This message is sent by a listener to indicate interest in a particular path within the tree.
      void close()
      Closes the underlying store.
      void commit()
      Commit any open transaction to the underlying store(s).
      void cp(java.lang.String oldPath, java.lang.String newPath)
      Copy an object from a path to another.
      void cp(java.lang.String oldPath, java.lang.String newPath, boolean recursive)
      Copy an object from a path to another.
      IManagedObject find(java.lang.String path)
      Get the IManagedObject at a given path in the ITree.
      IManagedObject findObject(java.lang.String path) 
      java.lang.String findPath(IManagedObject object)
      Get the full path of an IManagedObject.
      ITree findTree(java.lang.String path)
      Get a mounted ITree at a given path in the current ITree.
      void fireConnectionEvent(java.lang.String pathString, boolean connect) 
      java.lang.Object getLock() 
      java.util.Map getOptions() 
      void hasBeenFilled(java.lang.String path)
      Is called by the Store to let Tree know that a particular folder has been filled already.
      boolean hasStore() 
      void init(java.lang.String storeName, boolean readOnly, boolean createNew, java.lang.String storeType, java.lang.String options, boolean readOnlyUserDefined)
      Associate the tree with a store
      void init(java.lang.String storeName, java.lang.String storeType, int mode, java.lang.String options)
      Non-AIDA methods are down here.
      boolean isReadOnly()
      Check if the store associated with this ITree is read only.
      java.lang.String[] listObjectNames()
      Get the list of names of the IManagedObjects under a given path, including directories (but not "." and "..").
      java.lang.String[] listObjectNames(java.lang.String path)
      Get the list of names of the IManagedObjects under a given path, including directories (but not "." and "..").
      java.lang.String[] listObjectNames(java.lang.String path, boolean recursive)
      Get the list of names of the IManagedObjects under a given path, including directories (but not "." and "..").
      java.lang.String[] listObjectTypes()
      Get the list of types of the IManagedObjects under a given path.
      java.lang.String[] listObjectTypes(java.lang.String path)
      Get the list of types of the IManagedObjects under a given path.
      java.lang.String[] listObjectTypes(java.lang.String path, boolean recursive)
      Get the list of types of the IManagedObjects under a given path.
      void ls()
      List, into a given output stream, all the IManagedObjects, including directories (but not "." and ".."), in a given path.
      void ls(java.lang.String path)
      List, into a given output stream, all the IManagedObjects, including directories (but not "." and ".."), in a given path.
      void ls(java.lang.String path, boolean recursive)
      List, into a given output stream, all the IManagedObjects, including directories (but not "." and ".."), in a given path.
      void ls(java.lang.String path, boolean recursive, java.io.OutputStream os)
      List, into a given output stream, all the IManagedObjects, including directories (but not "." and ".."), in a given path.
      void mkdir(java.lang.String path)
      Create a new directory.
      void mkdirs(java.lang.String path)
      Create a directory recursively.
      void mount(java.lang.String path, ITree tree, java.lang.String treePath)
      Mounts a tree within another (target) tree.
      void mv(java.lang.String oldPath, java.lang.String newPath)
      Move an IManagedObject or a directory from one directory to another.
      java.lang.String name()
      Get the name of an ITree.
      java.lang.String pwd()
      Get the path of the current working directory.
      void rm(java.lang.String path)
      Remove an IManagedObject by specifying its path.
      void rmdir(java.lang.String path)
      Remove a directory and all the contents underneath.
      void setFolderIsWatched(java.lang.String path, boolean state)
      This message is sent by a listener to indicate interest in a particular path within the tree.
      void setLock(java.lang.Object lock) 
      void setOverwrite()
      Set the strategy of what should happen if two objects have the same path.
      void setOverwrite(boolean overwrite)
      Set the strategy of what should happen if two objects have the same path.
      java.lang.String storeName()
      Get the name of the store.
      java.lang.String storeType()
      Get the type of the store.
      void symlink(java.lang.String path, java.lang.String alias)
      Create a symbolic link to an object in the ITree.
      void unmount(java.lang.String path)
      Unmount a subtree at a given path (mount point).
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • name

        public java.lang.String name()
        Description copied from interface: ITree
        Get the name of an ITree.
        Specified by:
        name in interface ITree
        Returns:
        The name of the ITree.
      • storeName

        public java.lang.String storeName()
        Get the name of the store.
        Specified by:
        storeName in interface ITree
        Returns:
        The store's name.
      • storeType

        public java.lang.String storeType()
        Description copied from interface: ITree
        Get the type of the store.
        Specified by:
        storeType in interface ITree
        Returns:
        The store's type.
      • setLock

        public void setLock(java.lang.Object lock)
        Specified by:
        setLock in interface IDevTree
      • getLock

        public java.lang.Object getLock()
        Specified by:
        getLock in interface IDevTree
      • hasStore

        public boolean hasStore()
      • findObject

        public IManagedObject findObject(java.lang.String path)
                                  throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • find

        public IManagedObject find(java.lang.String path)
                            throws java.lang.IllegalArgumentException
        Get the IManagedObject at a given path in the ITree. The path can either be absolute or relative to the current working directory.
        Specified by:
        find in interface ITree
        Parameters:
        path - The path.
        Returns:
        The corresponding IManagedObject.
        Throws:
        java.lang.IllegalArgumentException - If the path does not correspond to an IManagedObject.
      • findTree

        public ITree findTree(java.lang.String path)
                       throws java.lang.IllegalArgumentException
        Description copied from interface: ITree
        Get a mounted ITree at a given path in the current ITree. The path can either be absolute or relative to the current working directory.
        Specified by:
        findTree in interface ITree
        Parameters:
        path - The path.
        Returns:
        The corresponding ITree.
        Throws:
        java.lang.IllegalArgumentException - If the path does not correspond to an ITree.
      • close

        public void close()
                   throws java.io.IOException
        Closes the underlying store. Changes will be saved only if commit() has been called before. The call is propagated to the dependent mounted trees.
        Specified by:
        close in interface ITree
        Throws:
        java.io.IOException - If there are problems writing out the underlying store.
      • cd

        public void cd(java.lang.String path)
                throws java.lang.IllegalArgumentException
        Change to a given directory.
        Specified by:
        cd in interface ITree
        Parameters:
        path - The absolute or relative path of the directory we are changing to.
        Throws:
        java.lang.IllegalArgumentException - If the path does not exist or path is not a directory.
      • pwd

        public java.lang.String pwd()
        Get the path of the current working directory.
        Specified by:
        pwd in interface ITree
        Returns:
        The path of the current working directory.
      • ls

        public void ls()
                throws java.lang.IllegalArgumentException
        List, into a given output stream, all the IManagedObjects, including directories (but not "." and ".."), in a given path. Directories end with "/". The list can be recursive. in all the directories under path (the default is false.
        Specified by:
        ls in interface ITree
        Throws:
        java.lang.IllegalArgumentException - If the path does not exist.
      • ls

        public void ls(java.lang.String path)
                throws java.lang.IllegalArgumentException
        List, into a given output stream, all the IManagedObjects, including directories (but not "." and ".."), in a given path. Directories end with "/". The list can be recursive.
        Specified by:
        ls in interface ITree
        Parameters:
        path - The path where the list has to be performed (by default the current directory "."). in all the directories under path (the default is false.
        Throws:
        java.lang.IllegalArgumentException - If the path does not exist.
      • ls

        public void ls(java.lang.String path,
                       boolean recursive)
                throws java.lang.IllegalArgumentException
        List, into a given output stream, all the IManagedObjects, including directories (but not "." and ".."), in a given path. Directories end with "/". The list can be recursive.
        Specified by:
        ls in interface ITree
        Parameters:
        path - The path where the list has to be performed (by default the current directory ".").
        recursive - If true the list is extended recursively in all the directories under path (the default is false.
        Throws:
        java.lang.IllegalArgumentException - If the path does not exist.
      • ls

        public void ls(java.lang.String path,
                       boolean recursive,
                       java.io.OutputStream os)
                throws java.lang.IllegalArgumentException
        List, into a given output stream, all the IManagedObjects, including directories (but not "." and ".."), in a given path. Directories end with "/". The list can be recursive.
        Specified by:
        ls in interface ITree
        Parameters:
        path - The path where the list has to be performed (by default the current directory ".").
        recursive - If true the list is extended recursively in all the directories under path (the default is false.
        os - The output stream into which the list is dumped (by default the standard output).
        Throws:
        java.lang.IllegalArgumentException - If the path does not exist.
      • listObjectNames

        public java.lang.String[] listObjectNames()
                                           throws java.lang.IllegalArgumentException
        Get the list of names of the IManagedObjects under a given path, including directories (but not "." and ".."). Directories end with "/". The returned names are appended to the given path unless the latter is ".". in all the directories under path (the default is false.
        Specified by:
        listObjectNames in interface ITree
        Throws:
        java.lang.IllegalArgumentException - If the path does not exist.
      • listObjectNames

        public java.lang.String[] listObjectNames(java.lang.String path)
                                           throws java.lang.IllegalArgumentException
        Get the list of names of the IManagedObjects under a given path, including directories (but not "." and ".."). Directories end with "/". The returned names are appended to the given path unless the latter is ".".
        Specified by:
        listObjectNames in interface ITree
        Parameters:
        path - The path where the list has to be performed (by default the current directory "."). in all the directories under path (the default is false.
        Throws:
        java.lang.IllegalArgumentException - If the path does not exist.
      • listObjectNames

        public java.lang.String[] listObjectNames(java.lang.String path,
                                                  boolean recursive)
                                           throws java.lang.IllegalArgumentException
        Get the list of names of the IManagedObjects under a given path, including directories (but not "." and ".."). Directories end with "/". The returned names are appended to the given path unless the latter is ".".
        Specified by:
        listObjectNames in interface ITree
        Parameters:
        path - The path where the list has to be performed (by default the current directory ".").
        recursive - If true the list is extended recursively in all the directories under path (the default is false.
        Throws:
        java.lang.IllegalArgumentException - If the path does not exist.
      • listObjectTypes

        public java.lang.String[] listObjectTypes()
                                           throws java.lang.IllegalArgumentException
        Get the list of types of the IManagedObjects under a given path. The types are the leaf class of the Interface, e.g. "IHistogram1D", "ITuple", etc. Directories are marked with "dir". The order of the types is the same as the order for the listObjectNames() method to achieve a one-to-one correspondance between object names and types. in all the directories under path (the default is false.
        Specified by:
        listObjectTypes in interface ITree
        Throws:
        java.lang.IllegalArgumentException - If the path does not exist.
      • listObjectTypes

        public java.lang.String[] listObjectTypes(java.lang.String path)
                                           throws java.lang.IllegalArgumentException
        Get the list of types of the IManagedObjects under a given path. The types are the leaf class of the Interface, e.g. "IHistogram1D", "ITuple", etc. Directories are marked with "dir". The order of the types is the same as the order for the listObjectNames() method to achieve a one-to-one correspondance between object names and types.
        Specified by:
        listObjectTypes in interface ITree
        Parameters:
        path - The path where the list has to be performed (by default the current directory "."). in all the directories under path (the default is false.
        Throws:
        java.lang.IllegalArgumentException - If the path does not exist.
      • listObjectTypes

        public java.lang.String[] listObjectTypes(java.lang.String path,
                                                  boolean recursive)
                                           throws java.lang.IllegalArgumentException
        Get the list of types of the IManagedObjects under a given path. The types are the leaf class of the Interface, e.g. "IHistogram1D", "ITuple", etc. Directories are marked with "dir". The order of the types is the same as the order for the listObjectNames() method to achieve a one-to-one correspondance between object names and types.
        Specified by:
        listObjectTypes in interface ITree
        Parameters:
        path - The path where the list has to be performed (by default the current directory ".").
        recursive - If true the list is extended recursively in all the directories under path (the default is false.
        Throws:
        java.lang.IllegalArgumentException - If the path does not exist.
      • mkdir

        public void mkdir(java.lang.String path)
                   throws java.lang.IllegalArgumentException
        Create a new directory. Given a path only the last directory in it is created if all the intermediate subdirectories already exist.
        Specified by:
        mkdir in interface ITree
        Parameters:
        path - The absolute or relative path of the new directory.
        Throws:
        java.lang.IllegalArgumentException - If a subdirectory within the path does not exist or it is not a directory. Also if the directory already exists.
      • mkdirs

        public void mkdirs(java.lang.String path)
                    throws java.lang.IllegalArgumentException
        Create a directory recursively. Given a path the last directory and all the intermediate non-existing subdirectories are created.
        Specified by:
        mkdirs in interface IAddable
        Specified by:
        mkdirs in interface ITree
        Parameters:
        path - The absolute or relative path of the new directory.
        Throws:
        java.lang.IllegalArgumentException - If an intermediate subdirectory is not a directory.
      • rmdir

        public void rmdir(java.lang.String path)
                   throws java.lang.IllegalArgumentException
        Remove a directory and all the contents underneath.
        Specified by:
        rmdir in interface ITree
        Parameters:
        path - The absolute or relative path of the directory to be removed.
        Throws:
        java.lang.IllegalArgumentException - If path does not exist or if it is not a directory.
      • rm

        public void rm(java.lang.String path)
                throws java.lang.IllegalArgumentException
        Remove an IManagedObject by specifying its path. If the path points to a mount point, the mount point should first commit, then close and delete the tree object.
        Specified by:
        rm in interface ITree
        Parameters:
        path - The absolute or relative path of the IManagedObject to be removed.
        Throws:
        java.lang.IllegalArgumentException - If path does not exist.
      • findPath

        public java.lang.String findPath(IManagedObject object)
                                  throws java.lang.IllegalArgumentException
        Get the full path of an IManagedObject.
        Specified by:
        findPath in interface ITree
        Parameters:
        object - The IManagedObject whose path is to be returned.
        Returns:
        The object's absolute path. In C++ if the object does not exist, an empty string is returned.
        Throws:
        java.lang.IllegalArgumentException - If the IManagedObject does not exist.
      • mv

        public void mv(java.lang.String oldPath,
                       java.lang.String newPath)
                throws java.lang.IllegalArgumentException
        Move an IManagedObject or a directory from one directory to another.
        Specified by:
        mv in interface ITree
        Parameters:
        oldPath - The path of the IManagedObject or direcoty to be moved.
        newPath - The path of the diretory in which the object has to be moved to.
        Throws:
        java.lang.IllegalArgumentException - If either path does not exist.
      • commit

        public void commit()
                    throws java.io.IOException
        Commit any open transaction to the underlying store(s). It flushes objects into the disk for non-memory-mapped stores.
        Specified by:
        commit in interface ITree
        Throws:
        java.io.IOException - If the underlying store cannot be written out.
      • setOverwrite

        public void setOverwrite()
        Set the strategy of what should happen if two objects have the same path. Default is overwrite.
        Specified by:
        setOverwrite in interface ITree
      • setOverwrite

        public void setOverwrite(boolean overwrite)
        Set the strategy of what should happen if two objects have the same path. Default is overwrite.
        Specified by:
        setOverwrite in interface ITree
        Parameters:
        overwrite - true to enable overwriting.
      • cp

        public void cp(java.lang.String oldPath,
                       java.lang.String newPath)
                throws java.lang.IllegalArgumentException
        Copy an object from a path to another.
        Specified by:
        cp in interface ITree
        Parameters:
        oldPath - The path of the object to be copied.
        newPath - The path where the object is to be copied.
        Throws:
        java.lang.IllegalArgumentException - If either path does not exist.
      • cp

        public void cp(java.lang.String oldPath,
                       java.lang.String newPath,
                       boolean recursive)
                throws java.lang.IllegalArgumentException
        Copy an object from a path to another.
        Specified by:
        cp in interface ITree
        Parameters:
        oldPath - The path of the object to be copied.
        newPath - The path where the object is to be copied.
        recursive - true if a recursive copy has to be performed.
        Throws:
        java.lang.IllegalArgumentException - If either path does not exist.
      • symlink

        public void symlink(java.lang.String path,
                            java.lang.String alias)
                     throws java.lang.IllegalArgumentException
        Create a symbolic link to an object in the ITree.
        Specified by:
        symlink in interface ITree
        Parameters:
        path - The absolute or relative path of the object to be linked.
        alias - The absolute or relative name of the link.
        Throws:
        java.lang.IllegalArgumentException - If path or any subidrectory within path does not exist.
      • mount

        public void mount(java.lang.String path,
                          ITree tree,
                          java.lang.String treePath)
                   throws java.lang.IllegalArgumentException
        Mounts a tree within another (target) tree. A tree can only be mounted once. Example:
             target.mount("/home/tonyj",tree,"/");
         
        Specified by:
        mount in interface ITree
        Parameters:
        path - The path in the target tree
        tree - The tree to mount within the target tree
        treePath - The mount point within the tree to be mounted.
        Throws:
        IllegalArtumentException - If something does not exist.
        java.lang.IllegalArgumentException
      • unmount

        public void unmount(java.lang.String path)
                     throws java.lang.IllegalArgumentException
        Unmount a subtree at a given path (mount point). Whenever a tree is destroyed it first unmounts all dependent trees.
        Specified by:
        unmount in interface ITree
        Parameters:
        path - The path of the subtree to be unmounted.
        Throws:
        java.lang.IllegalArgumentException - If path does not exist.
      • init

        public void init(java.lang.String storeName,
                         java.lang.String storeType,
                         int mode,
                         java.lang.String options)
                  throws java.io.IOException
        Non-AIDA methods are down here.
        Throws:
        java.io.IOException
      • init

        public void init(java.lang.String storeName,
                         boolean readOnly,
                         boolean createNew,
                         java.lang.String storeType,
                         java.lang.String options,
                         boolean readOnlyUserDefined)
                  throws java.io.IOException
        Associate the tree with a store
        Parameters:
        storeName - The name of the output storage unit.
        readOnly - true if the tree is readonly.
        createNew - true if the tree has to create a new file.
        storeType - The type of the output storage unit.
        Throws:
        java.io.IOException
      • hasBeenFilled

        public void hasBeenFilled(java.lang.String path)
                           throws java.lang.IllegalArgumentException
        Is called by the Store to let Tree know that a particular folder has been filled already. "path" is path to a folder, cannot point to an Object.
        Specified by:
        hasBeenFilled in interface IAddable
        Specified by:
        hasBeenFilled in interface IDevTree
        Parameters:
        path - The path of the diretory which has been filled by the Store.
        Throws:
        java.lang.IllegalArgumentException - If the path does not exist, or if it is not a directory.
      • isReadOnly

        public boolean isReadOnly()
        Description copied from interface: ITree
        Check if the store associated with this ITree is read only.
        Specified by:
        isReadOnly in interface ITree
        Returns:
        true if it is read only.
      • add

        public void add(java.lang.String path,
                        IManagedObject child)
        This "add" method is called from the IStore, and can create new folders if it is needed. Does not overwrite existing objects, just skip them.
        Specified by:
        add in interface IAddable
        Specified by:
        add in interface IDevTree
        Parameters:
        path - The path of the diretory in which the object has to be added.
        child - The IManagedObject to be added.
      • addFromFactory

        public void addFromFactory(java.lang.String path,
                                   IManagedObject child)
        This "add" method is called from Factories (HistogramFactory, ...), and can create new folders if it is needed. It does overwrite existing objects.
      • fireConnectionEvent

        public void fireConnectionEvent(java.lang.String pathString,
                                        boolean connect)
      • checkForChildren

        public void checkForChildren(java.lang.String path)
        This message is sent by a listener to indicate interest in a particular path within the tree. If the path corresponds to a folder, that folder will be asked to notify listeners of all existing children, and to continue to notify listeners of any future changes.
      • setFolderIsWatched

        public void setFolderIsWatched(java.lang.String path,
                                       boolean state)
        This message is sent by a listener to indicate interest in a particular path within the tree. If the path corresponds to a folder, that folder will be asked to notify listeners of any future changes.
      • getOptions

        public java.util.Map getOptions()

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.