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:
javax.jcr.Item
Direct Known Subclasses:
ClientNode, ClientProperty

public class ClientItem
extends ClientObject
implements javax.jcr.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(javax.jcr.Session session, RemoteItem remote, LocalAdapterFactory factory)
          Creates a local adapter for the given remote item.
 
Method Summary
 void accept(javax.jcr.ItemVisitor visitor)
          Accepts the visitor to visit this item.
 javax.jcr.Item getAncestor(int level)
          
 int getDepth()
          
 java.lang.String getName()
          
 javax.jcr.Node getParent()
          
 java.lang.String getPath()
          
 javax.jcr.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(javax.jcr.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(javax.jcr.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 javax.jcr.Session getSession()
Returns the current session without contacting the remote item.

Specified by:
getSession in interface javax.jcr.Item

getPath

public java.lang.String getPath()
                         throws javax.jcr.RepositoryException

Specified by:
getPath in interface javax.jcr.Item
Throws:
javax.jcr.RepositoryException

getName

public java.lang.String getName()
                         throws javax.jcr.RepositoryException

Specified by:
getName in interface javax.jcr.Item
Throws:
javax.jcr.RepositoryException

getAncestor

public javax.jcr.Item getAncestor(int level)
                           throws javax.jcr.RepositoryException

Specified by:
getAncestor in interface javax.jcr.Item
Throws:
javax.jcr.RepositoryException

getParent

public javax.jcr.Node getParent()
                         throws javax.jcr.RepositoryException

Specified by:
getParent in interface javax.jcr.Item
Throws:
javax.jcr.RepositoryException

getDepth

public int getDepth()
             throws javax.jcr.RepositoryException

Specified by:
getDepth in interface javax.jcr.Item
Throws:
javax.jcr.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 javax.jcr.Item
Returns:
false

isNew

public boolean isNew()

Specified by:
isNew in interface javax.jcr.Item

isModified

public boolean isModified()

Specified by:
isModified in interface javax.jcr.Item

isSame

public boolean isSame(javax.jcr.Item item)
               throws javax.jcr.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 javax.jcr.Item
Throws:
javax.jcr.RepositoryException
See Also:
Item.getPath()

accept

public void accept(javax.jcr.ItemVisitor visitor)
            throws javax.jcr.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 javax.jcr.Item
Throws:
javax.jcr.RepositoryException

save

public void save()
          throws javax.jcr.RepositoryException

Specified by:
save in interface javax.jcr.Item
Throws:
javax.jcr.RepositoryException

refresh

public void refresh(boolean keepChanges)
             throws javax.jcr.RepositoryException

Specified by:
refresh in interface javax.jcr.Item
Throws:
javax.jcr.RepositoryException

remove

public void remove()
            throws javax.jcr.RepositoryException

Specified by:
remove in interface javax.jcr.Item
Throws:
javax.jcr.RepositoryException


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