org.tinyjee.maven.dim.sh
Class BundledBrushesResolver

java.lang.Object
  extended by org.tinyjee.maven.dim.sh.BundledBrushesResolver
All Implemented Interfaces:
BrushResolver

public class BundledBrushesResolver
extends Object
implements BrushResolver

Resolves the bundled brushes.

Author:
Juergen_Kellerer, 2010-09-03

Constructor Summary
BundledBrushesResolver()
           
 
Method Summary
protected  String detectAliasByContent(Map<Integer,List<String>> content)
          Detects the brush alias by file content.
protected  String detectAliasByExtension(String file)
          Detects the brush alias by file extension.
 String detectBrushAlias(URL source, Map<Integer,List<String>> sourceContent)
          Auto Detects the brush alias name from the source URL or content.
protected  Properties getTypeMappingProperties()
          Returns the backing properties used to map types.
 Collection<URL> resolveBrushes()
          Returns a list of URLs that point to ".JS" or ".ZIP" files containing additional brush definitions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BundledBrushesResolver

public BundledBrushesResolver()
Method Detail

resolveBrushes

public Collection<URL> resolveBrushes()
Returns a list of URLs that point to ".JS" or ".ZIP" files containing additional brush definitions.

Specified by:
resolveBrushes in interface BrushResolver
Returns:
a list of URLs that point to ".JS" or ".ZIP" files containing additional brush definitions.

detectBrushAlias

public String detectBrushAlias(URL source,
                               Map<Integer,List<String>> sourceContent)
Auto Detects the brush alias name from the source URL or content.

Specified by:
detectBrushAlias in interface BrushResolver
Parameters:
source - the source URL (.. to be used for extension matching).
sourceContent - the extracted content of the source (.. to be used for content based matching, e.g. shebang).
Returns:
a valid alias name of a brush that is defined inside the brushes returned by BrushResolver.resolveBrushes() or 'null' if no alias can be resolved. Note: If the content is HTML with a compiled / script language inside tags, the returned value is "html/[brush-alias]" (e.g. JSP would map to "html/java").

getTypeMappingProperties

protected Properties getTypeMappingProperties()
Returns the backing properties used to map types.

Returns:
the backing properties used to map types.

detectAliasByExtension

protected String detectAliasByExtension(String file)
Detects the brush alias by file extension.

Parameters:
file - the file to detect the alias for.
Returns:
the brush alias, or 'null' if no mapping exists.

detectAliasByContent

protected String detectAliasByContent(Map<Integer,List<String>> content)
Detects the brush alias by file content.

Parameters:
content - the file content.
Returns:
the brush alias, or 'null' if no mapping exists.