1 package jp.sourceforge.stigmata.birthmarks;
7 import java.util.Locale;
9 import jp.sourceforge.stigmata.Birthmark;
10 import jp.sourceforge.stigmata.BirthmarkComparator;
11 import jp.sourceforge.stigmata.BirthmarkElement;
12 import jp.sourceforge.stigmata.BirthmarkExtractor;
13 import jp.sourceforge.stigmata.BirthmarkPreprocessor;
14 import jp.sourceforge.stigmata.spi.BirthmarkSpi;
15 import jp.sourceforge.stigmata.utils.LocalizedDescriptionManager;
18 * Abstract class for {@link BirthmarkSpi <code>BirthmarkSpi</code>}
20 * @author Haruaki TAMADA
23 public abstract class AbstractBirthmarkService implements BirthmarkSpi{
24 public String getDisplayType(){
25 return getDisplayType(Locale.getDefault());
28 public String getDisplayType(Locale locale){
29 LocalizedDescriptionManager manager = LocalizedDescriptionManager.getInstance();
30 String type = manager.getDisplayType(locale, getType());
37 public String getDescription(){
38 return getDescription(Locale.getDefault());
41 public String getDescription(Locale locale){
42 LocalizedDescriptionManager manager = LocalizedDescriptionManager.getInstance();
43 String description = manager.getDescription(locale, getType());
44 if(description == null){
45 description = getDefaultDescription();
50 public abstract BirthmarkComparator getComparator();
52 public String getComparatorClassName(){
53 return getComparator().getClass().getName();
56 public abstract BirthmarkExtractor getExtractor();
58 public String getExtractorClassName(){
59 return getExtractor().getClass().getName();
62 public BirthmarkPreprocessor getPreprocessor(){
66 public String getPreprocessorClassName(){
67 BirthmarkPreprocessor preprocessor = getPreprocessor();
69 if(preprocessor != null){
70 name = preprocessor.getClass().getName();
75 public abstract String getType();
77 public abstract String getDefaultDescription();
79 public boolean isExpert(){
83 public boolean isUserDefined(){
87 public String getVersion(){
88 return getClass().getPackage().getImplementationVersion();
91 public String getVendorName(){
92 return getClass().getPackage().getImplementationVendor();
95 public Birthmark buildBirthmark(){
96 return getExtractor().createBirthmark();
99 public BirthmarkElement buildBirthmarkElement(String value){
100 if(value == null || value.equals("<null>")){
101 return NullBirthmarkElement.getInstance();
103 return new BirthmarkElement(value);