org.apache.jackrabbit.rmi.client
Class ClientItem

java.lang.Object
  extended by org.apache.jackrabbit.rmi.client.ClientObject
      extended by org.apache.jackrabbit.rmi.client.ClientItem
All Implemented Interfaces:
Item
Direct Known Subclasses:
ClientNode, ClientProperty

public class ClientItem
extends ClientObject
implements Item

Local adapter for the JCR-RMI RemoteItem interface. This class makes a remote item locally available using the JCR Item interface. Used mainly as the base class for the ClientProperty and ClientNode adapters.

See Also:
Item, RemoteItem

Constructor Summary
ClientItem(Session session, RemoteItem remote, LocalAdapterFactory factory)
          Creates a local adapter for the given remote item.
 
Method Summary
 void accept(ItemVisitor visitor)
          Accepts the visitor to visit this item.
 Item getAncestor(int level)
          
 int getDepth()
          
 String getName()
          
 Node getParent()
          
 String getPath()
          
 Session getSession()
          Returns the current session without contacting the remote item.
 boolean isModified()
          
 boolean isNew()
          
 boolean isNode()
          Returns false by default without contacting the remote item.
 boolean isSame(Item item)
          Checks whether this instance represents the same repository item as the given other instance.
 void refresh(boolean keepChanges)
          
 void remove()
          
 void save()
          
 
Methods inherited from class org.apache.jackrabbit.rmi.client.ClientObject
getFactory, getItem, getNode, getNodeTypeArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientItem

public ClientItem(Session session,
                  RemoteItem remote,
                  LocalAdapterFactory factory)
Creates a local adapter for the given remote item.

Parameters:
session - current session
remote - remote item
factory - local adapter factory
Method Detail

getSession

public Session getSession()
Returns the current session without contacting the remote item.

Specified by:
getSession in interface Item

getPath

public String getPath()
               throws RepositoryException

Specified by:
getPath in interface Item
Throws:
RepositoryException

getName

public String getName()
               throws RepositoryException

Specified by:
getName in interface Item
Throws:
RepositoryException

getAncestor

public Item getAncestor(int level)
                 throws RepositoryException

Specified by:
getAncestor in interface Item
Throws:
RepositoryException

getParent

public Node getParent()
               throws RepositoryException

Specified by:
getParent in interface Item
Throws:
RepositoryException

getDepth

public int getDepth()
             throws RepositoryException

Specified by:
getDepth in interface Item
Throws:
RepositoryException

isNode

public boolean isNode()
Returns false by default without contacting the remote item. This method should be overridden by Node subclasses.

Specified by:
isNode in interface Item
Returns:
false

isNew

public boolean isNew()

Specified by:
isNew in interface Item

isModified

public boolean isModified()

Specified by:
isModified in interface Item

isSame

public boolean isSame(Item item)
               throws RepositoryException
Checks whether this instance represents the same repository item as the given other instance. A simple heuristic is used to first check some generic conditions (null values, instance equality, type equality), after which the item paths are compared to determine sameness. A RuntimeException is thrown if the item paths cannot be retrieved.

Specified by:
isSame in interface Item
Throws:
RepositoryException
See Also:
Item.getPath()

accept

public void accept(ItemVisitor visitor)
            throws RepositoryException
Accepts the visitor to visit this item. Node and Property subclasses should override this method to call the appropriate ItemVisitor methods, as the default implementation does nothing.

Specified by:
accept in interface Item
Throws:
RepositoryException

save

public void save()
          throws RepositoryException

Specified by:
save in interface Item
Throws:
RepositoryException

refresh

public void refresh(boolean keepChanges)
             throws RepositoryException

Specified by:
refresh in interface Item
Throws:
RepositoryException

remove

public void remove()
            throws RepositoryException

Specified by:
remove in interface Item
Throws:
RepositoryException


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.