org.apache.cocoon.components.source.impl
Class SlideSource

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.source.impl.SlideSource
All Implemented Interfaces:
Initializable, Contextualizable, LogEnabled, Serviceable, InspectableSource, LockableSource, VersionableSource, ModifiableSource, ModifiableTraversableSource, MoveableSource, Source, TraversableSource

public class SlideSource
extends AbstractLogEnabled
implements Contextualizable, Serviceable, Initializable, Source, ModifiableTraversableSource, MoveableSource, LockableSource, InspectableSource, VersionableSource

A sources from jakarta slide repositories.

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

Constructor Summary
SlideSource(org.apache.slide.common.NamespaceAccessToken nat, String scheme, String scope, String path, String principal, String version)
          Create a slide source.
 
Method Summary
 void addSourceLocks(SourceLock sourcelock)
          Add a lock to this source
 boolean canCancel(OutputStream stream)
          Can the data sent to an OutputStream returned by getOutputStream() be cancelled ?
 void cancel(OutputStream stream)
          Cancel the data sent to an OutputStream returned by getOutputStream().
 void contextualize(Context context)
          Pass the Context to the component.
 void copyTo(Source source)
          Copy the current source to a specified destination.
 void delete()
          Delete the source.
 boolean exists()
          Does this source actually exist ?
 Source getChild(String name)
           
 Collection getChildren()
           
 long getContentLength()
          Return the content length of the content or -1 if the length is unknown.
 InputStream getInputStream()
          Return an InputStream object to read from the source.
 long getLastModified()
          Get the last modification date of the source or 0 if it is not possible to determine the date.
 String getLatestSourceRevision()
          Get the latest revision
 String getMimeType()
          The mime-type of the content described by this object.
 String getName()
           
 OutputStream getOutputStream()
          Get an OutputStream where raw bytes can be written to.
 Source getParent()
           
 String getScheme()
           
 SourceLock[] getSourceLocks()
          Returns a enumeration of the existing locks
 SourceProperty[] getSourceProperties()
          Returns a enumeration of the properties
 SourceProperty getSourceProperty(String namespace, String name)
          Returns a property from a source.
 String getSourceRevision()
          Get the current revision of the source
 String getSourceRevisionBranch()
          Get the current branch of the revision from the source
 String getURI()
          Return the unique identifer for this source
 SourceValidity getValidity()
          Get the Validity object.
 void initialize()
           
 boolean isCollection()
           
 boolean isVersioned()
          If this source versioned
 void makeCollection()
           
 void moveTo(Source source)
          Move the current source to a specified destination.
 void refresh()
          Refresh the content of this object after the underlying data content has changed.
 void removeSourceProperty(String namespace, String name)
          Remove a specified source property.
 void service(ServiceManager manager)
          Pass the ServiceManager to the composer.
 void setSourceProperty(SourceProperty property)
          Sets a property for a source.
 void setSourceRevision(String revision)
          Not implemented.
 void setSourceRevisionBranch(String branch)
          Not implemented.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SlideSource

public SlideSource(org.apache.slide.common.NamespaceAccessToken nat,
                   String scheme,
                   String scope,
                   String path,
                   String principal,
                   String version)
Create a slide source.

Parameters:
nat - Namespace access token
scheme - Scheme of the source
path - Path of the source.
Method Detail

contextualize

public void contextualize(Context context)
Pass the Context to the component. This method is called after the LogEnabled.enableLogging() (if present) method and before any other method.

Specified by:
contextualize in interface Contextualizable
Parameters:
context - The context.

service

public void service(ServiceManager manager)
Pass the ServiceManager to the composer. The Serviceable implementation should use the specified ServiceManager to acquire the services it needs for execution

Specified by:
service in interface Serviceable
Parameters:
manager - The ServiceManager which this Serviceable uses

initialize

public void initialize()
                throws SourceException
Specified by:
initialize in interface Initializable
Throws:
SourceException

getInputStream

public InputStream getInputStream()
                           throws IOException,
                                  SourceException
Return an InputStream object to read from the source. This is the data at the point of invocation of this method, so if this is Modifiable, you might get different content from two different invocations.

Specified by:
getInputStream in interface Source
Returns:
Input stream for the source.
Throws:
IOException - If an IO excepetion occurs.
SourceException - If an exception occurs.

getURI

public String getURI()
Return the unique identifer for this source

Specified by:
getURI in interface Source
Returns:
System identifier for the source.

getScheme

public String getScheme()
Specified by:
getScheme in interface Source
Returns:
Scheme of the source.
See Also:
Source.getScheme()

getValidity

public SourceValidity getValidity()
Get the Validity object. This can either wrap the last modification date or the expires information or... If it is currently not possible to calculate such an information null is returned.

Specified by:
getValidity in interface Source
Returns:
Validity for the source.

refresh

public void refresh()
Refresh the content of this object after the underlying data content has changed.

Specified by:
refresh in interface Source

getMimeType

public String getMimeType()
The mime-type of the content described by this object. If the source is not able to determine the mime-type by itself this can be null.

Specified by:
getMimeType in interface Source
Returns:
Mime type of the source.

exists

public boolean exists()
Does this source actually exist ?

Specified by:
exists in interface Source
Returns:
true if the resource exists.

getContentLength

public long getContentLength()
Return the content length of the content or -1 if the length is unknown.

Specified by:
getContentLength in interface Source
Returns:
Content length of the source.

getLastModified

public long getLastModified()
Get the last modification date of the source or 0 if it is not possible to determine the date.

Specified by:
getLastModified in interface Source
Returns:
Last modified date of the source.

getOutputStream

public OutputStream getOutputStream()
                             throws IOException,
                                    SourceException
Get an OutputStream where raw bytes can be written to. The signification of these bytes is implementation-dependent and is not restricted to a serialized XML document.

Specified by:
getOutputStream in interface ModifiableSource
Returns:
a stream to write to
Throws:
IOException
SourceException

canCancel

public boolean canCancel(OutputStream stream)
Can the data sent to an OutputStream returned by getOutputStream() be cancelled ?

Specified by:
canCancel in interface ModifiableSource
Parameters:
stream - The ouput stream, which should be cancelled.
Returns:
true if the stream can be cancelled

cancel

public void cancel(OutputStream stream)
            throws SourceException
Cancel the data sent to an OutputStream returned by getOutputStream().

After cancel, the stream should no more be used.

Specified by:
cancel in interface ModifiableSource
Parameters:
stream - The ouput stream, which should be cancelled.
Throws:
SourceException - If the ouput stream can't be cancelled.

delete

public void delete()
Delete the source.

Specified by:
delete in interface ModifiableSource

makeCollection

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

getChild

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

getChildren

public Collection getChildren()
                       throws SourceException
Specified by:
getChildren 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

isCollection

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

moveTo

public void moveTo(Source source)
            throws SourceException
Move the current source to a specified destination.

Specified by:
moveTo in interface MoveableSource
Parameters:
source -
Throws:
SourceException - If an exception occurs during the move.

copyTo

public void copyTo(Source source)
            throws SourceException
Copy the current source to a specified destination.

Specified by:
copyTo in interface MoveableSource
Parameters:
source -
Throws:
SourceException - If an exception occurs during the copy.

getSourceProperty

public SourceProperty getSourceProperty(String namespace,
                                        String name)
                                 throws SourceException
Returns a property from a source.

Specified by:
getSourceProperty in interface InspectableSource
Parameters:
namespace - Namespace of the property
name - Name of the property
Returns:
Property of the source.
Throws:
SourceException - If an exception occurs.

setSourceProperty

public void setSourceProperty(SourceProperty property)
                       throws SourceException
Sets a property for a source.

Specified by:
setSourceProperty in interface InspectableSource
Parameters:
property - Property of the source
Throws:
SourceException - If an exception occurs during this operation

getSourceProperties

public SourceProperty[] getSourceProperties()
                                     throws SourceException
Returns a enumeration of the properties

Specified by:
getSourceProperties in interface InspectableSource
Returns:
Enumeration of SourceProperty
Throws:
SourceException - If an exception occurs.

removeSourceProperty

public void removeSourceProperty(String namespace,
                                 String name)
                          throws SourceException
Remove a specified source property.

Specified by:
removeSourceProperty in interface InspectableSource
Parameters:
namespace - Namespace of the property.
name - Name of the property.
Throws:
SourceException - If an exception occurs.

addSourceLocks

public void addSourceLocks(SourceLock sourcelock)
                    throws SourceException
Add a lock to this source

Specified by:
addSourceLocks in interface LockableSource
Parameters:
sourcelock - Lock, which should be added
Throws:
SourceException - If an exception occurs during this operation

getSourceLocks

public SourceLock[] getSourceLocks()
                            throws SourceException
Returns a enumeration of the existing locks

Specified by:
getSourceLocks in interface LockableSource
Returns:
Enumeration of SourceLock
Throws:
SourceException - If an exception occurs.

isVersioned

public boolean isVersioned()
                    throws SourceException
If this source versioned

Specified by:
isVersioned in interface VersionableSource
Returns:
True if the current source is versioned.
Throws:
SourceException - If an exception occurs.

getSourceRevision

public String getSourceRevision()
Get the current revision of the source

Specified by:
getSourceRevision in interface VersionableSource
Returns:
The current revision of the source

setSourceRevision

public void setSourceRevision(String revision)
                       throws SourceException
Not implemented.

Specified by:
setSourceRevision in interface VersionableSource
Parameters:
revision - The revision, which should be used.
Throws:
SourceException - If an exception occurs.

getSourceRevisionBranch

public String getSourceRevisionBranch()
                               throws SourceException
Get the current branch of the revision from the source

Specified by:
getSourceRevisionBranch in interface VersionableSource
Returns:
The branch of the revision
Throws:
SourceException - If an exception occurs.

setSourceRevisionBranch

public void setSourceRevisionBranch(String branch)
                             throws SourceException
Not implemented.

Specified by:
setSourceRevisionBranch in interface VersionableSource
Parameters:
branch - The branch, which should be used.
Throws:
SourceException - If an exception occurs.

getLatestSourceRevision

public String getLatestSourceRevision()
                               throws SourceException
Get the latest revision

Specified by:
getLatestSourceRevision in interface VersionableSource
Returns:
Last revision of the source.
Throws:
SourceException - If an exception occurs.


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