1 package jp.sourceforge.stigmata.birthmarks;
3 import java.util.Locale;
5 import jp.sourceforge.stigmata.Birthmark;
6 import jp.sourceforge.stigmata.BirthmarkComparator;
7 import jp.sourceforge.stigmata.BirthmarkElement;
8 import jp.sourceforge.stigmata.BirthmarkExtractor;
9 import jp.sourceforge.stigmata.BirthmarkPreprocessor;
10 import jp.sourceforge.stigmata.spi.BirthmarkSpi;
11 import jp.sourceforge.stigmata.utils.LocalizedDescriptionManager;
14 * Abstract class for {@link BirthmarkSpi <code>BirthmarkSpi</code>}
16 * @author Haruaki TAMADA
18 public abstract class AbstractBirthmarkService implements BirthmarkSpi{
20 public String getDisplayType(){
21 return getDisplayType(Locale.getDefault());
25 public String getDisplayType(Locale locale){
26 LocalizedDescriptionManager manager = LocalizedDescriptionManager.getInstance();
27 String type = manager.getDisplayType(locale, getType());
35 public String getDescription(){
36 return getDescription(Locale.getDefault());
40 public String getDescription(Locale locale){
41 LocalizedDescriptionManager manager = LocalizedDescriptionManager.getInstance();
42 String description = manager.getDescription(locale, getType());
43 if(description == null){
44 description = getDefaultDescription();
50 public abstract BirthmarkComparator getComparator();
53 public String getComparatorClassName(){
54 return getComparator().getClass().getName();
58 public abstract BirthmarkExtractor getExtractor();
61 public String getExtractorClassName(){
62 return getExtractor().getClass().getName();
66 public BirthmarkPreprocessor getPreprocessor(){
71 public String getPreprocessorClassName(){
72 BirthmarkPreprocessor preprocessor = getPreprocessor();
74 if(preprocessor != null){
75 name = preprocessor.getClass().getName();
81 public abstract String getType();
84 public abstract String getDefaultDescription();
87 public boolean isExperimental(){
92 public boolean isUserDefined(){
97 public String getVersion(){
98 return getClass().getPackage().getImplementationVersion();
102 public String getVendorName(){
103 return getClass().getPackage().getImplementationVendor();
107 public Birthmark buildBirthmark(){
108 return getExtractor().createBirthmark();
112 public BirthmarkElement buildBirthmarkElement(String value){
113 if(value == null || value.equals("<null>")){
114 return NullBirthmarkElement.getInstance();
116 return new BirthmarkElement(value);