Changeset 8542


Ignore:
Timestamp:
2004-11-12T16:50:25+13:00 (19 years ago)
Author:
kjdon
Message:

addRecogniser now returns the recogniser, so it can be configured if necessary

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes/RecogniserManager.java

    r8493 r8542  
    2424   *  Add a recogniser to this manager
    2525   */
    26   public void addRecogniser(String documentType)
    27   { ClassLoader loader = ClassLoader.getSystemClassLoader();
    28     java.lang.Class thisClass = null;
    29     try {
    30        thisClass = loader.loadClass("org.greenstone.gsdl3.gs3build.doctypes." + documentType + "Recogniser");
     26    public RecogniserInterface addRecogniser(String documentType)
     27    {
     28    ClassLoader loader = ClassLoader.getSystemClassLoader();
     29    java.lang.Class thisClass = null;
     30    try {
     31        thisClass = loader.loadClass("org.greenstone.gsdl3.gs3build.doctypes." + documentType + "Recogniser");
     32        Object instance = thisClass.newInstance();
     33        this.addRecogniser((RecogniserInterface) instance);
     34        return (RecogniserInterface)instance;
     35    }
     36    catch (ClassNotFoundException ex) {
     37        System.err.println(ex);
     38        return null;
     39    }
     40    catch (InstantiationException instEx) {
     41        System.err.println(instEx);
     42    }
     43    catch (IllegalAccessException accEx) {
     44        System.err.println(accEx);
     45    }
     46    return null;
    3147    }
    32     catch (ClassNotFoundException ex) {
    33     System.err.println(ex);
    34     }
    35 
    36     try {
    37       Object instance = thisClass.newInstance();
    38       this.addRecogniser((RecogniserInterface) instance);
    39     }
    40     catch (InstantiationException instEx) {
    41     System.err.println(instEx);
    42     }
    43     catch (IllegalAccessException accEx) {
    44     System.err.println(accEx);
    45     }
    46   }
    47 
     48   
    4849  /**
    4950   *
Note: See TracChangeset for help on using the changeset viewer.