org.mmbase.util.magicfile
Class AbstractDetector

java.lang.Object
  extended by org.mmbase.util.magicfile.AbstractDetector
All Implemented Interfaces:
Detector
Direct Known Subclasses:
BasicDetector, XmlDetector

public abstract class AbstractDetector
extends Object
implements Detector

Version:
$Id: AbstractDetector.java 41722 2010-04-01 12:34:12Z michiel $

Field Summary
protected  List<Detector> childList
           
protected  String message
          Designation for this type in 'magic' file
protected  boolean valid
          Set this if parsing of magic file fails
 
Constructor Summary
AbstractDetector()
           
 
Method Summary
 void addChild(Detector detector, int level)
          Add an embedded detector object that searches for more details after an initial match.
 void configure(Element e)
           
 String getDesignation()
           
 String getExtension()
           
 List<String> getExtensions()
           
 String getMimeType()
           
 void setDesignation(String designation)
           
 void setExtension(String extension)
          Adds a possible extension.
 void setMimeType(String mimetype)
           
 void setValid(boolean v)
           
 String toString()
           
 boolean valid()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.util.magicfile.Detector
test
 

Field Detail

message

protected String message
Designation for this type in 'magic' file


childList

protected final List<Detector> childList

valid

protected boolean valid
Set this if parsing of magic file fails

Constructor Detail

AbstractDetector

public AbstractDetector()
Method Detail

addChild

public void addChild(Detector detector,
                     int level)
Add an embedded detector object that searches for more details after an initial match.

Specified by:
addChild in interface Detector

setExtension

public void setExtension(String extension)
Adds a possible extension. The last added one is the default (returned by 'getExtension').

Specified by:
setExtension in interface Detector

getExtension

public String getExtension()
Specified by:
getExtension in interface Detector

getExtensions

public List<String> getExtensions()
Specified by:
getExtensions in interface Detector

setMimeType

public void setMimeType(String mimetype)
Specified by:
setMimeType in interface Detector

getMimeType

public String getMimeType()
Specified by:
getMimeType in interface Detector

setDesignation

public void setDesignation(String designation)

getDesignation

public String getDesignation()
Specified by:
getDesignation in interface Detector

setValid

public void setValid(boolean v)
Specified by:
setValid in interface Detector

valid

public boolean valid()
Specified by:
valid in interface Detector
Returns:
Whether parsing of magic line for this detector succeeded

configure

public void configure(Element e)
Specified by:
configure in interface Detector

toString

public String toString()
Overrides:
toString in class Object


MMBase 2.0-SNAPSHOT - null