com.ibm.lab.soln.resources.nature_builder
Class ReadmeVisitor

java.lang.Object
  |
  +--com.ibm.lab.soln.resources.nature_builder.ReadmeVisitor
All Implemented Interfaces:
org.eclipse.core.resources.IResourceDeltaVisitor

public class ReadmeVisitor
extends java.lang.Object
implements org.eclipse.core.resources.IResourceDeltaVisitor

Processes an IResourceDelta to find .readme files and create stub .html files. Designed to be invoked as part of builder.

Source includes many System.out.println() trace entries that have been commented out. If you want to visualize the flow of build processing, uncomment these statements before starting a test cycle.

See Also:
IResourceDelta, IResourceDeltaVisitor

Constructor Summary
ReadmeVisitor()
           
 
Method Summary
 java.io.InputStream getReadmeContent(org.eclipse.core.resources.IFile readmeFile)
          Wraps the InputStream available for the IFile resource with some HTML content.
 void processReadme(org.eclipse.core.resources.IResource resource, org.eclipse.core.resources.IContainer container)
          Implements processing for a given .readme resource.
 boolean visit(org.eclipse.core.resources.IResourceDelta delta)
          Required implementation of the visit method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadmeVisitor

public ReadmeVisitor()
Method Detail

getReadmeContent

public java.io.InputStream getReadmeContent(org.eclipse.core.resources.IFile readmeFile)
Wraps the InputStream available for the IFile resource with some HTML content. Uses a simple approach, where a ByteArrayInputStream is used to convert a StringBuffer to a type of InputStream that can be joined with another using SequenceInputStream.
Parameters:
string -  
Returns:
InputStream

processReadme

public void processReadme(org.eclipse.core.resources.IResource resource,
                          org.eclipse.core.resources.IContainer container)
Implements processing for a given .readme resource. This includes creation of a matching .html file stub with limited hard coded content.

The .html file creation is forced. This means the create will succeed even if a .html file with the same name exists on the file system but not in the workspace.

Parameters:
org.eclipse.core.resources.IContainer -  
org.eclipse.core.resources.IResource -  

visit

public boolean visit(org.eclipse.core.resources.IResourceDelta delta)
              throws org.eclipse.core.runtime.CoreException
Required implementation of the visit method. The IResourceDelta is processed by providing it a visitor using the accept() method and using this method in the visitor to process any events of interest. Processing continues as long as this method returns true or when the end of the IResourceDelta has been reached.
Specified by:
visit in interface org.eclipse.core.resources.IResourceDeltaVisitor