nu.staldal.lagoon.core
Class Producer

java.lang.Object
  extended by nu.staldal.lagoon.core.Producer
All Implemented Interfaces:
ProducerInterface
Direct Known Subclasses:
ByteStreamConsumer, Read, Source, XMLStreamConsumer

public abstract class Producer
extends java.lang.Object
implements ProducerInterface

A Producer is one step in the pipeline process to build a file in a website.


Constructor Summary
Producer()
           
 
Method Summary
 void afterBuild()
           
 void beforeBuild()
           
 void destroy()
          Destroy the producer.
 LagoonContext getContext()
          Get the LagoonContext this producer is associated with.
 java.lang.String getEntryName()
          Get the name of the sitemap entry this producer is associated with.
 java.lang.Object getObjectFromRepository(java.lang.String key)
          Get an object from the repository.
 java.lang.String getParam(java.lang.String name)
          Get a parameter.
 java.util.Enumeration getParamNames()
          Get an Enumeration of all parameter names.
 int getPosition()
          Get the position of this producer in the pipeline.
 SourceManager getSourceMan()
          Get the SourceManager this producer is associated with.
 boolean putObjectIntoRepository(java.lang.String key, java.lang.Object obj)
          Store an object into the repository.
 java.io.InputStream readFileFromRepository(java.lang.String key)
          Read from a file in the repository.
 java.io.OutputStream storeFileInRepository(java.lang.String key)
          Store a file in the repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nu.staldal.lagoon.core.ProducerInterface
hasBeenUpdated, init
 

Constructor Detail

Producer

public Producer()
Method Detail

destroy

public void destroy()
             throws java.io.IOException
Description copied from interface: ProducerInterface
Destroy the producer. This method is invoked once after the start() method is invoked the last time. This method may use the getParam(), getParamNames(), and getContext() methods.

Specified by:
destroy in interface ProducerInterface
Throws:
java.io.IOException

beforeBuild

public void beforeBuild()
                 throws java.io.IOException
Throws:
java.io.IOException

afterBuild

public void afterBuild()
                throws java.io.IOException
Throws:
java.io.IOException

getEntryName

public java.lang.String getEntryName()
Get the name of the sitemap entry this producer is associated with.


getPosition

public int getPosition()
Get the position of this producer in the pipeline.


getSourceMan

public SourceManager getSourceMan()
Get the SourceManager this producer is associated with.


getContext

public LagoonContext getContext()
Get the LagoonContext this producer is associated with.


getParam

public java.lang.String getParam(java.lang.String name)
Get a parameter.

Parameters:
name - the name of the parameter to get
Returns:
the value of the requested parameter, or null if the parameter doesn't exitst

getParamNames

public java.util.Enumeration getParamNames()
Get an Enumeration of all parameter names.


readFileFromRepository

public java.io.InputStream readFileFromRepository(java.lang.String key)
Read from a file in the repository. Read from the returned InputStream and close() it.

Parameters:
key - the key to locate the file
Returns:
an InputStream to read the file from, or null if the file wasn't found.

storeFileInRepository

public java.io.OutputStream storeFileInRepository(java.lang.String key)
                                           throws java.io.IOException
Store a file in the repository. Write to the returned OutputStream and close() it.

Parameters:
key - the key to locate the file
Returns:
an OutputStream to write to the file, or null if the repository is unavailable.
Throws:
java.io.IOException

getObjectFromRepository

public java.lang.Object getObjectFromRepository(java.lang.String key)
                                         throws java.io.IOException
Get an object from the repository.

Parameters:
key - the key to locate the object
Returns:
the object, or null if not found
Throws:
java.io.IOException

putObjectIntoRepository

public boolean putObjectIntoRepository(java.lang.String key,
                                       java.lang.Object obj)
                                throws java.io.IOException
Store an object into the repository.

Parameters:
key - the key to locate the object
obj - the object to store, must be Serializable
Returns:
true if successful, false if the repository is unavailable.
Throws:
java.io.IOException