org.apache.cocoon.jcr.source
Class JCRNodeSource

java.lang.Object
  extended by org.apache.cocoon.jcr.source.JCRNodeSource
All Implemented Interfaces:
ModifiableSource, ModifiableTraversableSource, Source, TraversableSource

public class JCRNodeSource
extends Object
implements Source, TraversableSource, ModifiableTraversableSource

A Source for a JCR node.

Version:
$Id: JCRNodeSource.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Field Summary
protected  String computedURI
          The full URI
protected  JCRSourceFactory factory
          The factory that created this Source
protected  Node node
          The node pointed to by this source (can be null)
protected  String path
          The node path
protected  Session session
          The session this source is bound to
 
Constructor Summary
JCRNodeSource(JCRNodeSource parent, Node node)
           
JCRNodeSource(JCRSourceFactory factory, Node node)
           
JCRNodeSource(JCRSourceFactory factory, Session session, String path)
           
 
Method Summary
 boolean canCancel(OutputStream os)
           
 void cancel(OutputStream os)
           
 void delete()
           
 boolean exists()
           
 Source getChild(String name)
           
 Collection getChildren()
           
 long getContentLength()
           
 Node getContentNode()
          Returns the JCR Node used to store the content of this source.
 InputStream getInputStream()
           
 long getLastModified()
           
 String getMimeType()
           
 String getName()
           
 Node getNode()
          Returns the JCR Node this source points to, or null if it denotes a non-existing path.
 OutputStream getOutputStream()
           
 Source getParent()
           
 String getPath()
          Returns the path within the repository this source points to.
 String getScheme()
           
 Session getSession()
          Returns the JCR Session used by this source.
 String getURI()
           
 SourceValidity getValidity()
           
 boolean isCollection()
           
 void makeCollection()
           
 void refresh()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

computedURI

protected String computedURI
The full URI


path

protected final String path
The node path


factory

protected final JCRSourceFactory factory
The factory that created this Source


session

protected final Session session
The session this source is bound to


node

protected Node node
The node pointed to by this source (can be null)

Constructor Detail

JCRNodeSource

public JCRNodeSource(JCRSourceFactory factory,
                     Session session,
                     String path)
              throws SourceException
Throws:
SourceException

JCRNodeSource

public JCRNodeSource(JCRSourceFactory factory,
                     Node node)
              throws SourceException
Throws:
SourceException

JCRNodeSource

public JCRNodeSource(JCRNodeSource parent,
                     Node node)
              throws SourceException
Throws:
SourceException
Method Detail

getNode

public Node getNode()
Returns the JCR Node this source points to, or null if it denotes a non-existing path.

Returns:
the JCR node.

getPath

public String getPath()
Returns the path within the repository this source points to.

Returns:
the path

getSession

public Session getSession()
Returns the JCR Session used by this source.

Returns:
the JCR session.

getContentNode

public Node getContentNode()
Returns the JCR Node used to store the content of this source.

Returns:
the JCR content node, or null if no such node exist, either because the source is a collection or doesn't currently contain data.

exists

public boolean exists()
Specified by:
exists in interface Source

getInputStream

public InputStream getInputStream()
                           throws IOException,
                                  SourceNotFoundException
Specified by:
getInputStream in interface Source
Throws:
IOException
SourceNotFoundException

getURI

public String getURI()
Specified by:
getURI in interface Source

getScheme

public String getScheme()
Specified by:
getScheme in interface Source

getValidity

public SourceValidity getValidity()
Specified by:
getValidity in interface Source

refresh

public void refresh()
Specified by:
refresh in interface Source

getMimeType

public String getMimeType()
Specified by:
getMimeType in interface Source

getContentLength

public long getContentLength()
Specified by:
getContentLength in interface Source

getLastModified

public long getLastModified()
Specified by:
getLastModified in interface Source

isCollection

public boolean isCollection()
Specified by:
isCollection in interface TraversableSource

getChildren

public Collection getChildren()
                       throws SourceException
Specified by:
getChildren in interface TraversableSource
Throws:
SourceException

getChild

public Source getChild(String name)
                throws SourceException
Specified by:
getChild in interface TraversableSource
Throws:
SourceException

getName

public String getName()
Specified by:
getName in interface TraversableSource

getParent

public Source getParent()
                 throws SourceException
Specified by:
getParent in interface TraversableSource
Throws:
SourceException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Specified by:
getOutputStream in interface ModifiableSource
Throws:
IOException

delete

public void delete()
            throws SourceException
Specified by:
delete in interface ModifiableSource
Throws:
SourceException

canCancel

public boolean canCancel(OutputStream os)
Specified by:
canCancel in interface ModifiableSource

cancel

public void cancel(OutputStream os)
            throws IOException
Specified by:
cancel in interface ModifiableSource
Throws:
IOException

makeCollection

public void makeCollection()
                    throws SourceException
Specified by:
makeCollection in interface ModifiableTraversableSource
Throws:
SourceException


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