com.arsdigita.cms.publishToFile
Class PublishToFile

java.lang.Object
  extended bycom.arsdigita.cms.publishToFile.PublishToFile
All Implemented Interfaces:
PublishToFileListener

public class PublishToFile
extends Object
implements PublishToFileListener

Methods for writing content (as static pages) to the file system when an item is published, and removing the files when the item is unpublished.

Version:
$Revision: #31 $ $DateTime: 2004/04/07 16:07:11 $
Author:
Jeff Teeters (teeters@arsdigita.com), David Lutterkort

Field Summary
static int DEFAULT_TIMEOUT
           
 
Constructor Summary
PublishToFile()
           
PublishToFile(com.arsdigita.cms.publishToFile.PublishedHTMLProvider provider)
           
 
Method Summary
 boolean doTask(QueueEntry qe)
          Called by the queue manager for each task.
static com.arsdigita.cms.publishToFile.DestinationStub getDestination(com.arsdigita.persistence.metadata.ObjectType type)
          Gets the destination stub for an object type.
static com.arsdigita.cms.publishToFile.DestinationStub getDestination(String objectType)
          Gets the destination stub for an object type.
static URL getSource(String path)
          Gets the source URL for retrieving the item with the specified path.
protected  String getTargetURL(ContentItem target)
          Return the URL of target on the destination live server.
protected  boolean isLocal(ContentItem asset)
          Determine if asset is local, and should therefore be written to the file system as part of writing the item that contains it.
protected  boolean move(QueueEntry qe)
          Process move task (for moving an item or folder to another folder).
protected  boolean publish(QueueEntry qe)
          Publish the page in the QueueEntry to the file system.
protected  boolean publishPageAtDocRoot(com.arsdigita.cms.publishToFile.RetrievedFile rf, Folder parent, ContentItem item, String media, com.arsdigita.web.Host host)
          Publish a page at a document root.
protected  boolean republish(QueueEntry qe)
          Republish (unpublish then publish) the page in the QueueEntry to the file system.
static void setRequestTimeout(int timeout)
          Set the timeout for requests fetching content
 void transactionEnd()
          Called just after processing of one block of queue entries has finished.
 void transactionStart()
          Called just before processing of one block of queue entries starts.
protected  boolean unpublish(QueueEntry qe)
          Unpublish item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TIMEOUT

public static final int DEFAULT_TIMEOUT
See Also:
Constant Field Values
Constructor Detail

PublishToFile

public PublishToFile()

PublishToFile

public PublishToFile(com.arsdigita.cms.publishToFile.PublishedHTMLProvider provider)
Method Detail

setRequestTimeout

public static void setRequestTimeout(int timeout)
Set the timeout for requests fetching content

Parameters:
timeout - the timeout in seconds

getDestination

public static com.arsdigita.cms.publishToFile.DestinationStub getDestination(String objectType)
Gets the destination stub for an object type. If no destination stub is available, gets the destination stub for the parent object type. Recursively. If no destination stub can be matched at all, returns null

Parameters:
objectType - the object type to find a destination stub for
Returns:
the best matching destination stub, or null

getDestination

public static com.arsdigita.cms.publishToFile.DestinationStub getDestination(com.arsdigita.persistence.metadata.ObjectType type)
Gets the destination stub for an object type. If no destination stub is available, gets the destination stub for the parent object type. Recursively. If no destination stub can be matched at all, returns null

Parameters:
type - the object type to find a destination stub for
Returns:
the best matching destination stub, or null

getSource

public static URL getSource(String path)
Gets the source URL for retrieving the item with the specified path.

Parameters:
path - the item path, relative to the servlet root (ie, no /ccm)
Returns:
the source URL for fetching the item

doTask

public final boolean doTask(QueueEntry qe)
                     throws PublishToFileException
Called by the queue manager for each task. Subclasses should override the methods publish, unpublish, republish, and move to be notified of the particular task to be performed.

Specified by:
doTask in interface PublishToFileListener
Parameters:
qe - QueueEntry describing the task that should be performed
Throws:
PublishToFileException

transactionStart

public void transactionStart()
Called just before processing of one block of queue entries starts. Does nothing.

Specified by:
transactionStart in interface PublishToFileListener

transactionEnd

public void transactionEnd()
Called just after processing of one block of queue entries has finished. Does nothing.

Specified by:
transactionEnd in interface PublishToFileListener

move

protected boolean move(QueueEntry qe)
Process move task (for moving an item or folder to another folder).

Parameters:
qe - QueueEntry for move task.

publish

protected boolean publish(QueueEntry qe)
Publish the page in the QueueEntry to the file system.

Parameters:
qe - QueueEntry for item to publish.

republish

protected boolean republish(QueueEntry qe)
Republish (unpublish then publish) the page in the QueueEntry to the file system.

Parameters:
qe - QueueEntry for item to publish.

unpublish

protected boolean unpublish(QueueEntry qe)
Unpublish item. Removes from file system files that were written as part of publishing item.

Parameters:
qe - The QueueEntry of the item to unpublish.

publishPageAtDocRoot

protected boolean publishPageAtDocRoot(com.arsdigita.cms.publishToFile.RetrievedFile rf,
                                       Folder parent,
                                       ContentItem item,
                                       String media,
                                       com.arsdigita.web.Host host)
Publish a page at a document root.

Parameters:
rf - - Retrieved File Information
parent - Folder where Item must be published
item - ContentItem, which will be published used when transforming page.

getTargetURL

protected String getTargetURL(ContentItem target)
Return the URL of target on the destination live server.

Parameters:
target - the item whose URL should be returned
Returns:
the URL of the item on the live server

isLocal

protected boolean isLocal(ContentItem asset)
Determine if asset is local, and should therefore be written to the file system as part of writing the item that contains it. If this method returns false, the asset is not written. Such assets need to be scheduled separately into the queue.

Parameters:
asset - an asset found during processing an item
Returns:
true if the asset is local and should be written to the file system


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2352 UTC