org.priha.core
Class SessionProvider

java.lang.Object
  extended by org.priha.core.SessionProvider

public class SessionProvider
extends java.lang.Object

This is a special provider which stores the state of the Session.

At the moment this could be O(N) depending on the size of the unsaved items.


Constructor Summary
SessionProvider(SessionImpl session, ItemStore source)
           
 
Method Summary
 void addNode(NodeImpl ni)
          Call when you wish to add a new Node in this Session.
 void clear()
           
 void copy(Path srcpath, Path destpath)
           
 NodeImpl findByUUID(java.lang.String uuid)
           
 ItemImpl getItem(Path path)
           
 Path getPath(PathRef p)
           
 PathManager getPathManager()
           
 java.util.List<PropertyImpl> getReferences(java.lang.String uuid)
          Finds all references to the given UUID.
 ItemState getState(Path path)
          Get the current modified state of a Path.
 ItemState getState(PathRef m_path)
           
 boolean hasPendingChanges()
           
 boolean itemExists(Path path, ItemType type)
           
 java.util.List<Path> listNodes(Path parentpath)
           
 java.util.Collection<? extends Path> listProperties(Path path)
           
 java.util.Collection<? extends java.lang.String> listWorkspaces()
           
 void logout()
           
 boolean nodeExistsInRepository(Path path)
          Goes directly into the repository, to find whether a Node exists currently.
 void putProperty(NodeImpl impl, PropertyImpl property)
           
 void refresh(boolean keepChanges, Path path)
          Refreshes all the items within the given path.
 void remove(ItemImpl item)
           
 void save()
          Saves everything starting from root node.
 void save(Path path)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionProvider

public SessionProvider(SessionImpl session,
                       ItemStore source)
Method Detail

save

public void save()
          throws RepositoryException
Saves everything starting from root node.

Throws:
RepositoryException - If something goes wrong.

addNode

public void addNode(NodeImpl ni)
             throws RepositoryException
Call when you wish to add a new Node in this Session.

Parameters:
ni - Node to add
Throws:
RepositoryException - If the Path cannot be determined.

getItem

public ItemImpl getItem(Path path)
                 throws InvalidPathException,
                        RepositoryException
Throws:
InvalidPathException
RepositoryException

logout

public void logout()

copy

public void copy(Path srcpath,
                 Path destpath)
          throws RepositoryException
Throws:
RepositoryException

findByUUID

public NodeImpl findByUUID(java.lang.String uuid)
                    throws RepositoryException
Throws:
RepositoryException

getReferences

public java.util.List<PropertyImpl> getReferences(java.lang.String uuid)
                                           throws RepositoryException
Finds all references to the given UUID.

Parameters:
uuid -
Returns:
Throws:
RepositoryException

listNodes

public java.util.List<Path> listNodes(Path parentpath)
                               throws RepositoryException
Throws:
RepositoryException

listWorkspaces

public java.util.Collection<? extends java.lang.String> listWorkspaces()
                                                                throws RepositoryException
Throws:
RepositoryException

itemExists

public boolean itemExists(Path path,
                          ItemType type)
                   throws RepositoryException
Throws:
RepositoryException

remove

public void remove(ItemImpl item)
            throws RepositoryException
Throws:
RepositoryException

stop

public void stop()

hasPendingChanges

public boolean hasPendingChanges()

clear

public void clear()

save

public void save(Path path)
          throws RepositoryException
Throws:
RepositoryException

listProperties

public java.util.Collection<? extends Path> listProperties(Path path)
                                                    throws RepositoryException
Throws:
RepositoryException

putProperty

public void putProperty(NodeImpl impl,
                        PropertyImpl property)
                 throws RepositoryException
Throws:
RepositoryException

refresh

public void refresh(boolean keepChanges,
                    Path path)
Refreshes all the items within the given path.

Parameters:
keepChanges - If true, does nothing (Priha implements COPY-ON-WRITE). If false, purges all changes from the path.
path - The path from which to start refreshing.

nodeExistsInRepository

public boolean nodeExistsInRepository(Path path)
                               throws RepositoryException
Goes directly into the repository, to find whether a Node exists currently. It ignores the transient state; so any new node additions or removals are ignored.

Parameters:
path - The path to check
Returns:
True, if the backend holds a given Node.
Throws:
RepositoryException - If something goes wrong.

getPath

public Path getPath(PathRef p)
             throws PathNotFoundException
Throws:
PathNotFoundException

getPathManager

public PathManager getPathManager()

getState

public ItemState getState(Path path)
Get the current modified state of a Path.

Parameters:
path -
Returns:
Null, if the state does not exist in the change log.

getState

public ItemState getState(PathRef m_path)
                   throws PathNotFoundException
Throws:
PathNotFoundException