org.eclipse.internal.xpand2.pr
Class ProtectedRegionResolverImpl

java.lang.Object
  extended by org.eclipse.internal.xpand2.pr.ProtectedRegionResolverImpl
All Implemented Interfaces:
ProtectedRegionResolver

public class ProtectedRegionResolverImpl
extends java.lang.Object
implements ProtectedRegionResolver

Default implementation of the ProtectedRegionResolver interface.


Nested Class Summary
static class ProtectedRegionResolverImpl.ProtectedRegionImpl
           
 
Field Summary
protected  java.lang.String encoding
           
protected  boolean useBASE64
           
 
Constructor Summary
ProtectedRegionResolverImpl()
           
 
Method Summary
 ProtectedRegion createProtectedRegion(java.lang.String id, boolean disabled)
          Creates a ProtectedRegion instance.
protected  java.util.Collection<ProtectedRegionResolverImpl.ProtectedRegionImpl> getAllRegions(java.io.File file)
          Retrieves all Protected Regions from a source file.
 ProtectedRegion getProtectedRegion(java.lang.String id)
          Retrieve a ProtectedRegion by its Id.
 void init()
          Initializes the ProtectedRegionResolver.
 void reportRegions(java.io.File dumpPath)
          Dumps all known protected regions to files.
 void setDefaultExcludes(boolean defaultExcludes)
          This flag determines whether default file exclusion patterns should be used.
 void setFileEncoding(java.lang.String encoding)
          Sets the file encoding to be used when reading files.
 void setIgnoreList(java.lang.String ignoreList)
          Sets a custom list of file patterns that should be filtered during scanning of source files and directories.
 void setSrcPathes(java.lang.String srcPathsAsString)
          Sets the source paths that should be scanned.
 void setUseBASE64(boolean useBASE64)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

useBASE64

protected boolean useBASE64

encoding

protected java.lang.String encoding
Constructor Detail

ProtectedRegionResolverImpl

public ProtectedRegionResolverImpl()
Method Detail

getAllRegions

protected java.util.Collection<ProtectedRegionResolverImpl.ProtectedRegionImpl> getAllRegions(java.io.File file)
                                                                                       throws ProtectedRegionSyntaxException,
                                                                                              java.io.IOException
Retrieves all Protected Regions from a source file.

Parameters:
file - The source file to scan.
Returns:
All found Protected Regions in the specified file.
Throws:
ProtectedRegionSyntaxException - If one of the Protected Regions in the file is incomplete or invalid.
java.io.IOException - On errors occuring when reading the file

createProtectedRegion

public ProtectedRegion createProtectedRegion(java.lang.String id,
                                             boolean disabled)
Description copied from interface: ProtectedRegionResolver
Creates a ProtectedRegion instance.

Specified by:
createProtectedRegion in interface ProtectedRegionResolver
Parameters:
id - The Protected Region's Id.
disabled - The Protected Region's activation status ( true: disabled, false: enabled)
Returns:
A new instance

getProtectedRegion

public ProtectedRegion getProtectedRegion(java.lang.String id)
Description copied from interface: ProtectedRegionResolver
Retrieve a ProtectedRegion by its Id.

Specified by:
getProtectedRegion in interface ProtectedRegionResolver
Parameters:
id - The Id of the ProtectedRegion searched for.
Returns:
The Protected Region identified by id. Returns null if the Protected Region is not known to the Resolver.

init

public void init()
          throws java.lang.IllegalStateException
Initializes the ProtectedRegionResolver. This starts the scan over all configured paths (property 'srcPaths').

A second call (already initialized) to this method will return immediately.

Throws:
java.lang.IllegalStateException - If a Protected Region Id is detected the second time, i.e. it is not unique.

reportRegions

public void reportRegions(java.io.File dumpPath)
Dumps all known protected regions to files. For each protected region a file is created.

Parameters:
dumpPath - Directory where the dump files are created within.

setDefaultExcludes

public void setDefaultExcludes(boolean defaultExcludes)
This flag determines whether default file exclusion patterns should be used.

Parameters:
defaultExcludes - true: Use default file exclusion patterns, false: ignore them, just use the patterns specified by ignoreList

setFileEncoding

public void setFileEncoding(java.lang.String encoding)
Sets the file encoding to be used when reading files.

Parameters:
encoding - A valid encoding string.

setIgnoreList

public void setIgnoreList(java.lang.String ignoreList)
Sets a custom list of file patterns that should be filtered during scanning of source files and directories.

Parameters:
ignoreList - A comma separated list of file patterns to ignore during scan.

setSrcPathes

public void setSrcPathes(java.lang.String srcPathsAsString)
                  throws java.lang.IllegalArgumentException
Sets the source paths that should be scanned.

Parameters:
srcPathsAsString - A comma separated list of directory paths.
Throws:
java.lang.IllegalArgumentException - If one of the passed arguments is not a directory or does not exist

setUseBASE64

public void setUseBASE64(boolean useBASE64)